Skip to content

Try to avoid hitting the platform font list for simple fonts #1677

Open

Description

@pcwalton

Apparently Gecko does this, per roc:

Obtaining the list of platform fonts is incredibly performance-sensitive. We have a gfxPlatformFontList object for this, which caches the font list indefinitely. When the system notifies us of a font list change, we rebuild our font list from scratch, but that's very rare of course. The tricky part is how to build this list without slowing down startup. The key thing is that we don't always need the list. We can look up simple fonts by family name without having a complete list of the platform fonts, and for each language we have a list of default font names that have a good chance of supporting the characters of that language; all that means we can render many pages without needing the platform font list. So, we build it incrementally after startup, off the main thread (as of recently, thanks to jdaggett).

Activity

  1. mrobinson commented on May 18, 2024

    @mrobinson
    Member

    Funnily enough, this is how Servo has worked for years. What we don't have is the ability to look through the platform list for a font that contains a given character. This would allow us to stop relying on the list of default font names once the list of system fonts has loaded in the background. In addition, it would be good to support two more types of fallback:

    1. Ask the system font selection API how to render a character or to find a font with a character.
    2. If all else fails use the LastResort font.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-platform/fontsI-perf-slow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions