font_cache: Handle filtering @font-face rules in Servo (#31601)

Instead of letting Stylo filter `@font-face` rules, handle this
filtering in Servo. It doesn't make sense that Stylo knows about what
fonts Servo supports. This also cleans up a bit the way that this is
handled, giving an entire stylesheet of rules to the font cache to
process instead of letting each layout thread walk the rules. This
brings more of the font-related code into the FontCacheThread itself.

This is the first step toward adding WOFF2 support and fixing various
web font related bugs.
This commit is contained in:
Martin Robinson 2024-03-11 15:47:52 +01:00 committed by GitHub
parent b03411f567
commit 45344dca2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 182 additions and 219 deletions

View file

@ -24,6 +24,7 @@ use style::values::computed::font::{
FamilyName, FontFamily, FontFamilyList, FontFamilyNameSyntax, FontSize, FontStretch, FontStyle,
FontWeight, SingleFontFamily,
};
use style::values::computed::FontLanguageOverride;
use webrender_api::{FontInstanceKey, FontKey, IdNamespace};
struct TestFontSource {
@ -100,6 +101,7 @@ fn style() -> FontStyleStruct {
font_size: FontSize::medium(),
font_stretch: FontStretch::hundred(),
hash: 0,
font_language_override: FontLanguageOverride::normal(),
};
style.compute_font_hash();
style