top | item 45665236

(no title)

afishhh | 4 months ago

> Drawing text isn't simple

I agree, but even this article seems to oversimplify.

> You can't really optimize texture copies much more.

Did the author try packing the textures in an atlas?

Texture atlases can improve performance significantly since then you can use instanced draw calls to draw a whole bunch of glyphs at once.

discuss

order

dcrazy|4 months ago

FWIW you cannot have Unicode-correct rendering by caching at the codepoint (what many people would call “character”) level. You can cache bitmaps for the individual “glyphs”—that is, items in the font’s `glyf` table. But your shaping engine still needs to choose the correct “glyphs” to assemble into the extended grapheme clusters dictated by your Unicode-aware layout engine.

afishhh|4 months ago

Exactly why I referred to drawing glyphs instead of characters :)

There's even more depth one can go into here: subpixel positioning. To correctly draw glyphs that may be on subpixel positions, you need to rasterize and cache glyphs separately for each subpixel position (with some limited amount of precision, to balance cache usefulness and accuracy).

However I have a feeling that describing an entire Unicode-aware text stack here may not be useful, especially if TFA seems to only care about simple-script monospace LTR.