aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform/macos/font_list.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-04-29 19:02:07 +0200
committerGitHub <noreply@github.com>2024-04-29 17:02:07 +0000
commit4732da347795c7a9e009a5125c20c1f5c3215209 (patch)
tree9244f043b9049c2e14d4984fa8012e3eb7c15f87 /components/gfx/platform/macos/font_list.rs
parent628e33bfa95b286e1b8b974e426ffdad7850097e (diff)
downloadservo-4732da347795c7a9e009a5125c20c1f5c3215209.tar.gz
servo-4732da347795c7a9e009a5125c20c1f5c3215209.zip
fonts: Add support for more @font-face features (#32164)
There are a couple major changes here: 1. Support is added for the `weight`, `style`, `stretch` and `unicode-range` declarations in `@font-face`. 2. Font matching in the font cache can return templates and `FontGroupFamily` can own mulitple templates. This is due to needing support for "composite fonts". These are `@font-face` declarations that only differ in their `unicode-range` definition. This fixes a lot of non-determinism in font selection especially when dealing with pages that define "composite faces." A notable example of such a page is servo.org, which now consistently displays the correct web font. One test starts to fail due to an uncovered bug, but this will be fixed in a followup change. Fixes #20686. Fixes #20684. Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/gfx/platform/macos/font_list.rs')
-rw-r--r--components/gfx/platform/macos/font_list.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/components/gfx/platform/macos/font_list.rs b/components/gfx/platform/macos/font_list.rs
index 1792fb7a593..d4063576316 100644
--- a/components/gfx/platform/macos/font_list.rs
+++ b/components/gfx/platform/macos/font_list.rs
@@ -74,11 +74,8 @@ where
};
let traits = family_descriptor.traits();
- let descriptor = FontTemplateDescriptor {
- weight: traits.weight(),
- stretch: traits.stretch(),
- style: traits.style(),
- };
+ let descriptor =
+ FontTemplateDescriptor::new(traits.weight(), traits.stretch(), traits.style());
let identifier = LocalFontIdentifier {
postscript_name: Atom::from(family_descriptor.font_name()),
path: Atom::from(path),