Skip to content

render text into svg paths; don't bundle fonts with the svg

this uses opentype.js to parse the fonts and render the given text into svg paths. Since the svg no longer has to include both fonts in their entirety, the resulting file sizes are much smaller (~44KB instead of 6.5MB)

Most obvious downside: the output is somewhat fragile to changes in the template: since we can't let svg automatically center a <path>, the text has to be centered "by hand", which depends on the width of the svg. It might be possible to extract that from the svg, but I don't know how, so instead it's just a hardcoded value (same for the font sizes, which might also be slightly off from what they are in the template; I'm not entirely sure about its unit).

Also one caveat: opentype.js doesn't have a fallback font in case glyphs are missing. Since Genos doesn't seem to include any japanese characters (or at least I haven't found a version which does), this currently leads boxes in the main header … (before, we at least had the pixelated default versions). I guess maybe it's possible to convince fontforge to add some from another font? but no idea how …

Merge request reports

Loading