chiark / gitweb /
webstead: slightly cleverer path translation
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 16 Sep 2025 21:12:25 +0000 (22:12 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
Now paths with successive rlineto operations (to avoid overflowing the
Type 2 stack) work.

webstead.xhtml

index 2f17fe863a830a72dd2093c6f455cdf5b7e01ae3..0c23a5bd80633d62bde86342a620f88ff32983e8 100644 (file)
                     .setAttribute("d", charstring
                                   .replaceAll(/<!--(?:[^-]|-[^-])*-->/g, "")
                                   .replace(/^.* [hv]stem /, "")
-                                  .replace(/^cntrmask [01]*/, "")
-                                  .replace(/^/, "m ")
-                                  .replaceAll(/ rmoveto/g, "")
-                                  .replaceAll(/ rlineto/g, "m")
+                                  .replace(/^cntrmask [01]* /, "")
+                                  .replaceAll(/(\S+ +\S+ +)rmoveto/g, "m$1")
+                                  .replaceAll(/ rlineto/g, "")
                                   .replace(/ endchar/, ""));
             }
         });