Skip to content

Support font-variant-alternates and @font-feature-values for servo - #377

Merged
mrobinson merged 2 commits into
servo:mainfrom
simonwuelker:font-variant-alternates
Jul 16, 2026
Merged

Support font-variant-alternates and @font-feature-values for servo#377
mrobinson merged 2 commits into
servo:mainfrom
simonwuelker:font-variant-alternates

Conversation

@simonwuelker

@simonwuelker simonwuelker commented Jun 2, 2026

Copy link
Copy Markdown
Member

Servo PR: servo/servo#45308

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker
simonwuelker force-pushed the font-variant-alternates branch from b1220cf to 8de1e44 Compare July 10, 2026 12:43
Comment thread style/values/specified/font.rs Outdated
Comment thread style/values/specified/font.rs Outdated
Comment thread style/values/mod.rs Outdated
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker

Copy link
Copy Markdown
Member Author

The servo PR is approved, so this can be merged now.

@mrobinson
mrobinson added this pull request to the merge queue Jul 16, 2026
Merged via the queue into servo:main with commit d3de91c Jul 16, 2026
5 checks passed
nicoburns pushed a commit to nicoburns/servo that referenced this pull request Jul 17, 2026
This change is more complicated than the other `font-variant-*` related
PRs because `font-variant-alternates` requires the
`@font-feature-values` rule to work.

I've added a `FontFeatureValuesMap` to `LayoutContext` to efficiently
map from identifiers in `font-variant-alternates` to the font-specific
indices. This map is lazily initialized when needed and invalidated
whenever the stylesheets change.

To correctly perform lookups into the map we also need to compute the
family name for a given font. This is platform specific code and I don't
have access to macos/windows, so we only support freetype for now.
Presumably adding support for more platforms would not be difficult.
Note that for web fonts the property is supported on all systems,
because those specify `font-family` inside the `@font-face` rule.

Testing: New tests start to pass
Depends on servo/stylo#377

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Sep 2, 2026
…lues` for servo. r=firefox-style-system-reviewers,emilio

This imports servo/stylo#377, with some tweak
due to changes from https://phabricator.services.mozilla.com/D315884

Differential Revision: https://phabricator.services.mozilla.com/D322774
github-actions Bot pushed a commit to DioxusLabs/stylo that referenced this pull request Sep 3, 2026
…lues` for servo. r=firefox-style-system-reviewers,emilio

This imports servo#377, with some tweak
due to changes from https://phabricator.services.mozilla.com/D315884

Differential Revision: https://phabricator.services.mozilla.com/D322774
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants