You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for variable fonts / font variations #38800
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.
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.
Activity
simonwuelker commentedon Aug 20, 2025
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 aFontData(which isArc-ed) inFontand then always construct thePlatformFontfrom that. From a quick glance all platforms support this without copying the data.And then
Fontcould get a method likefn clone_with_parameters(&self, variations: ...) -> Self, which creates a new platform font and shaper but shares the font data.[-]Variable font support[/-][+]Add support for variable fonts / font variations[/+]fonts: Add support for `format(*-variations)` to `@font-face` (#38832)
fonts: Add font variations support for Windows (#38831)
simonwuelker commentedon Aug 25, 2025
CTFontCreateCopyWithAttributesyisibl commentedon Aug 28, 2025
Does Servo support
font-variation-settingsandfont-feature-settingsin the@font-facedescriptor?https://issues.chromium.org/issues/40398871
mrobinson commentedon Aug 28, 2025
@yisibl This bug tracks adding support for those properties.
minghuaw commentedon Sep 22, 2025
Is some kind of synthetic bold face fallback also considered as part of "Synthesize variations"? Or should this be tracked separately?
simonwuelker commentedon Sep 22, 2025
That would be a a seperate issue.
simonwuelker commentedon Nov 21, 2025
I have a working implementation for
font-optical-sizingin https://github.com/simonwuelker/servo/tree/font-optical-sizing, which depends on #40647Support `font-optical-sizing` (#40829)
Add `layout_variable_fonts_enabled` to experimental preferences (#40861)
fonts: Apply variations for `font-weight`, `font-stretch` (#40867)
fonts: Synthesize variations from `font-style` for macos & freetype s…
fonts: Synthesize variations from `font-style` for macos & freetype s…