Skip to content

Text: dynamic glyph atlas (rasterize glyphs once, compose strings as per-glyph quads) #1565

Description

@obiot

Summary

The structural fix for dynamic text, split out of #1554's re-scope: instead of baking every Text string into its own canvas-backed texture (re-uploaded on every content change), rasterize glyphs on demand into a shared atlas and compose strings as per-glyph quads — changing a string then allocates nothing and uploads at most the few glyphs never seen before.

Why

  • Canvas-text churn is a whole class of cost: every content change re-bakes a canvas and re-uploads a texture (and on a size-bucket change, reallocates it — see Text / Gradient textures: fixed-resolution gradient ramps + coarser text size buckets (re-scoped from NPOT drop) #1554). Counters, timers, damage numbers and typewriter text pay it continuously.
  • BitmapText already proves the compose-from-quads path in the engine, but requires pre-baked font assets. This ticket is the runtime-generated equivalent for system/web fonts: same rendering model, glyphs sourced from canvas rasterization on first use.

Sketch

Non-goals

  • Replacing BitmapText (pre-baked fonts remain the zero-rasterization option).
  • Distance-field text rendering — a possible later evolution of the same atlas, not part of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions