fonts: Add support for format(*-variations) to @font-face (#38832)

This is necessary to fully support font variations.

Testing: This will be tested once variations are enabled.
Fixes: This is part of #38800.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-22 02:25:19 -07:00 committed by GitHub
parent 09db6b8669
commit 16ba172ba8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,7 @@ use net_traits::request::{Destination, Referrer, RequestBuilder};
use net_traits::{CoreResourceThread, FetchResponseMsg, ResourceThreads, fetch_async};
use parking_lot::{Mutex, RwLock};
use servo_arc::Arc as ServoArc;
use servo_config::pref;
use servo_url::ServoUrl;
use style::Atom;
use style::computed_values::font_variant_caps::T as FontVariantCaps;
@ -364,10 +365,16 @@ impl FontContext {
}
if let FontFaceSourceFormat::String(string) = format_hint {
return string == "truetype" ||
string == "opentype" ||
string == "woff" ||
string == "woff2";
if string == "truetype" || string == "opentype" || string == "woff" || string == "woff2"
{
return true;
}
return pref!(layout_variable_fonts_enabled) &&
(string == "truetype-variations" ||
string == "opentype-variations" ||
string == "woff-variations" ||
string == "woff2-variations");
}
false