mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibWeb/CSS: Parse and propagate font-feature-settings property
This commit is contained in:
parent
55812aaed2
commit
95c17dfab5
Notes:
github-actions[bot]
2024-10-02 15:37:38 +00:00
Author: https://github.com/AtkinsSJ
Commit: 95c17dfab5
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1599
9 changed files with 129 additions and 1 deletions
|
@ -1028,6 +1028,33 @@ Optional<FlyString> StyleProperties::font_language_override() const
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<HashMap<FlyString, IntegerOrCalculated>> StyleProperties::font_feature_settings() const
|
||||
{
|
||||
auto value = property(PropertyID::FontFeatureSettings);
|
||||
|
||||
if (value->is_keyword())
|
||||
return {}; // normal
|
||||
|
||||
if (value->is_value_list()) {
|
||||
auto const& feature_tags = value->as_value_list().values();
|
||||
HashMap<FlyString, IntegerOrCalculated> result;
|
||||
result.ensure_capacity(feature_tags.size());
|
||||
for (auto const& tag_value : feature_tags) {
|
||||
auto const& feature_tag = tag_value->as_open_type_tagged();
|
||||
|
||||
if (feature_tag.value()->is_integer()) {
|
||||
result.set(feature_tag.tag(), feature_tag.value()->as_integer().value());
|
||||
} else {
|
||||
VERIFY(feature_tag.value()->is_math());
|
||||
result.set(feature_tag.tag(), IntegerOrCalculated { feature_tag.value()->as_math() });
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<HashMap<FlyString, NumberOrCalculated>> StyleProperties::font_variation_settings() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::FontVariationSettings);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue