Comment by yankput
1 year ago
I don’t understand the WASM part at all and I feel dumb
How can WASM be in font? Font is a font, not WASM file. It’s a different format
1 year ago
I don’t understand the WASM part at all and I feel dumb
How can WASM be in font? Font is a font, not WASM file. It’s a different format
In theory, a font is purely set of vector graphics. In practice, just rasterizing vector graphics usually doesn't lead to good results on small font sizes combined with small pixel density, so vector graphics needs to be adjusted to better fit into pixel grid. There are multiple ways to do it, one of the ways is to write a script to adjust graphics so it better fits the pixel grid. For example TypeType fonts contain a virtual machine that is capable of just that [1]. By conceptual extension, then a font format might just as well contain a full blown virtual machine with potentially a program per glyph, WASM is a reasonable candidate for something like that.
- [1] https://learn.microsoft.com/en-us/typography/truetype/hintin...
But then nobody can interpret the machine, only software that you need to write on your own, which makes the whole exercise useless as you can just read the wasm directly?
I’m surely missing something btw
A font is processed by software, one part of the font rendering stack is converting a string into glyphs and their positions, other part is rasterizing glyphs into bitmap. In this case one library from the stack, HarfBuzz [1], got the support for, I assume, an extension to OpenType format, that allows to embed an extra section into the file [2]. So HarfBuzz can open these special OpenType files and make run wasm embedded into them. Which means software based on it, like Chrome browser or Android, will also be open these font files, but Windows likely not.
- [1] https://en.wikipedia.org/wiki/HarfBuzz - [2] https://www.phoronix.com/news/HarfBuzz-8.0
WASM is a binary format and can be embedded in other data formats.
But then what will actually interpret the WASM? The font reader? That doesn’t have WASM compatibility?