Skip to content

Add support for variable fonts / font variations #38800

Open
1 of 2 issues completed
Open

Description

@simonwuelker

Tasks:

Variable fonts are currently preference-gated under layout_variable_fonts_enabled, which is disabled by default.

Feel free to edit this as new things come up.

Activity

  1. simonwuelker commented on Aug 20, 2025

    @simonwuelker
    MemberAuthor

    One thing we need to figure out is how to share the font data between font instances with different variations. Currently, at least for system fonts, we always load the file each time we construct a PlatformFont. I think we can store a FontData (which is Arc-ed) in Font and then always construct the PlatformFont from that. From a quick glance all platforms support this without copying the data.

    And then Font could get a method like fn clone_with_parameters(&self, variations: ...) -> Self, which creates a new platform font and shaper but shares the font data.

  2. changed the title [-]Variable font support[/-] [+]Add support for variable fonts / font variations[/+] on Aug 21, 2025
  3. simonwuelker commented on Aug 25, 2025

    @simonwuelker
    MemberAuthor
    • I believe windows/freetype have no built-in mechanism to share font data between fonts with different variations, so we would need to pass data that is already shared to their font constructor methods.
    • For MacOS we can use CTFontCreateCopyWithAttributes
  4. yisibl commented on Aug 28, 2025

    @yisibl

    Does Servo support font-variation-settings and font-feature-settings in the @font-face descriptor?
    https://issues.chromium.org/issues/40398871

  5. mrobinson commented on Aug 28, 2025

    @mrobinson
    Member

    @yisibl This bug tracks adding support for those properties.

  6. minghuaw commented on Sep 22, 2025

    @minghuaw
    Contributor

    Is some kind of synthetic bold face fallback also considered as part of "Synthesize variations"? Or should this be tracked separately?

  7. simonwuelker commented on Sep 22, 2025

    @simonwuelker
    MemberAuthor

    Is some kind of synthetic bold face fallback also considered as part of "Synthesize variations"? Or should this be tracked separately?

    That would be a a seperate issue.

  8. simonwuelker commented on Nov 21, 2025

    @simonwuelker
    MemberAuthor

    I have a working implementation for font-optical-sizing in https://github.com/simonwuelker/servo/tree/font-optical-sizing, which depends on #40647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions