Skip to content

Lazy-load fonts as needed #765

Open
Open
@bcamper

Description

Currently, all fonts in the scene are parsed and loaded when the scene is initially loaded. And there is a blocking effect because all fonts must be loaded before any text labels are rendered on the main thread (but the font loading process starts in parallel with the rest of the scene build process, so the actual blocking time depends on when the first label render request is made from a tile).

Instead, we should lazily load each font definition the first time it is need for label rendering. This requires doing some extra parsing/"matching" logic from font parameters in the draw group, back to the appropriate font face definition in the scene fonts block (and if no matching font is found, assume it's a built-in one).

This could also be used to address the Chrome bug with italics and variable fonts mentioned in #757, by issuing an explicit font load request for each new weight (which should resolve immediately, but needs to be verified).

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions