LibWeb/CSS: Implement the font-kerning property

This sets whether the kerning information stored on the current font is
used.
This commit is contained in:
Tim Ledbetter 2025-06-22 18:59:42 +01:00 committed by Sam Atkins
commit 9b6da84fff
Notes: github-actions[bot] 2025-06-23 12:28:02 +00:00
17 changed files with 108 additions and 20 deletions

View file

@ -417,6 +417,20 @@ HashMap<StringView, u8> InlineLevelIterator::shape_features_map() const
}
}
// FIXME: vkrn should be enabled for vertical text.
switch (computed_values.font_kerning()) {
case CSS::FontKerning::Auto:
// FIXME: Use a heuristic to determine whether to enable kerning.
case CSS::FontKerning::Normal:
features.set("kern"sv, 1);
break;
case CSS::FontKerning::None:
features.set("kern"sv, 0);
break;
default:
break;
}
return features;
}

View file

@ -387,6 +387,7 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
computed_values.set_font_list(computed_style.computed_font_list());
computed_values.set_font_size(computed_style.property(CSS::PropertyID::FontSize).as_length().length().to_px(*this));
computed_values.set_font_weight(round_to<int>(computed_style.property(CSS::PropertyID::FontWeight).as_number().number()));
computed_values.set_font_kerning(computed_style.font_kerning());
computed_values.set_line_height(computed_style.line_height());
computed_values.set_vertical_align(computed_style.vertical_align());