Hacker News new | ask | show | jobs
by t0astbread 2213 days ago
Only tangentially related but I've recently looked into how fonts usually work (OpenType, TrueType and the like) and it's astonishing to me how complicated this all is.

For example: TrueType includes the ability to embed small executable programs in your font to adjust little details in the rasterization process (I believe it's called "hinting"). It has its own VM and bytecode for that!

1 comments

If you really break it down, a font is just a pixel shader that happens to embed its own texture atlas.

(I wonder if we could achieve a win by actually having a font-format that is just an abstract pixel shader that could be handed off to the GPU driver for compilation? Either way, we'd probably just pre-render glyph tiles to a texture, so I'm not sure it'd make much of a difference.)

I wonder if we could achieve a win by just deprecating OpenType with its weird custom database format and having fonts be ZIP files with images and a JSON manifest (or shaders and a manifest, whatever). The manifest could contain all the meta-information and information about ligatures and kerning and so on.