Repository navigation
fonts: Synthesize variations from font-style for macos & freetype systems - #46918
Conversation
c50f102 to
90a7008
Compare
|
Getting this working on all platforms is the last real blocker to getting rid of the |
|
@simonwuelker I'm happy to take another look at this when you think it's ready! |
I'll likely need a couple days before I have time to implement the changes we talked about, will dm you once its ready (: |
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
90a7008 to
246f1a8
Compare
246f1a8 to
3ced6e2
Compare
|
🔨 Triggering try run (#32087714483) for Linux (WPT) |
|
Test results for linux-wpt from try job (#32087714483): Flaky unexpected result (35)
Stable unexpected results that are known to be intermittent (13)
|
|
✨ Try run (#32087714483) succeeded. |
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
3ced6e2 to
f148104
Compare
| /// `self` is consumed to work around platform differences. On some platforms, changing the | ||
| /// variations requires creating an entirely new font face, whereas on others the returned | ||
| /// font is `self`. | ||
| fn copy_with_variations(self, _variations: &[FontVariation]) -> Result<Self, &'static str> { |
There was a problem hiding this comment.
I'm not entirely happy with the name of this function, so feel free to suggest something better.
mrobinson
left a comment
There was a problem hiding this comment.
Thanks! I have a few comments below. I've also added a new commit to this PR which adds support to this change for macOS. I hope to tackle Windows soon (hopefully tomorrow).
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
9447ed4 to
382b130
Compare
|
🔨 Triggering try run (#32201800050) for Linux (WPT) |
|
Test results for linux-wpt from try job (#32201800050): Flaky unexpected result (45)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (1)
|
|
|
mrobinson
left a comment
There was a problem hiding this comment.
Looks good. I'm happy to land Windows support in a followup.
Nice, thank you! |
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
e61a998 to
886ce74
Compare
font-style for freetype systemsfont-style for macos & freetype systems
…ystems (servo#46918) Synthesizing variations from `font-style` requires a bit more work than for other properties because depending on which variation axes the font has we need to set either `ital` (to 0 or 1) or `slnt` (to a number of degrees). Currently we synthesize variations too early, when the font data is not yet avaiable. That's why this change moves the implementation of https://drafts.csswg.org/css-fonts-4/#apply-font-matching-variations to `Font::new`. On macos and windows `PlatformFont::copy_with_variations` is not yet implemented, so variations are synthesized but they do nothing. I hope to fix this in future changes but its hard to approach since I don't have access to macos/windows machines. Testing: New tests start to pass Part of servo#38800 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Synthesizing variations from
font-stylerequires a bit more work than for other properties because depending on which variation axes the font has we need to set eitherital(to 0 or 1) orslnt(to a number of degrees). Currently we synthesize variations too early, when the font data is not yet avaiable. That's why this change moves the implementation of https://drafts.csswg.org/css-fonts-4/#apply-font-matching-variations toFont::new.On macos and windows
PlatformFont::copy_with_variationsis not yet implemented, so variations are synthesized but they do nothing. I hope to fix this in future changes but its hard to approach since I don't have access to macos/windows machines.Testing: New tests start to pass
Part of #38800