mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
LibWeb: Disable ligatures if text-rendering is set to optimizeSpeed
If `font-variant-ligatures` is set to `normal` and `text-rendering` is set to `optimizeSpeed` then all ligatures are now disabled.
This commit is contained in:
parent
b4097623e5
commit
d7bdbeb446
Notes:
github-actions[bot]
2025-06-27 15:52:53 +00:00
Author: https://github.com/tcl3
Commit: d7bdbeb446
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5236
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 13 additions and 5 deletions
|
@ -211,15 +211,20 @@ HashMap<StringView, u8> InlineLevelIterator::shape_features_map() const
|
|||
|
||||
// 6.4 https://drafts.csswg.org/css-fonts/#font-variant-ligatures-prop
|
||||
auto ligature_or_null = computed_values.font_variant_ligatures();
|
||||
|
||||
auto disable_all_ligatures = [&]() {
|
||||
features.set("liga"sv, 0);
|
||||
features.set("clig"sv, 0);
|
||||
features.set("dlig"sv, 0);
|
||||
features.set("hlig"sv, 0);
|
||||
features.set("calt"sv, 0);
|
||||
};
|
||||
|
||||
if (ligature_or_null.has_value()) {
|
||||
auto ligature = ligature_or_null.release_value();
|
||||
if (ligature.none) {
|
||||
// Specifies that all types of ligatures and contextual forms covered by this property are explicitly disabled.
|
||||
features.set("liga"sv, 0);
|
||||
features.set("clig"sv, 0);
|
||||
features.set("dlig"sv, 0);
|
||||
features.set("hlig"sv, 0);
|
||||
features.set("calt"sv, 0);
|
||||
disable_all_ligatures();
|
||||
} else {
|
||||
switch (ligature.common) {
|
||||
case Gfx::FontVariantLigatures::Common::Common:
|
||||
|
@ -275,6 +280,9 @@ HashMap<StringView, u8> InlineLevelIterator::shape_features_map() const
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if (computed_values.text_rendering() == CSS::TextRendering::Optimizespeed) {
|
||||
// AD-HOC: Disable ligatures if font-variant-ligatures is set to normal and text rendering is set to optimize speed.
|
||||
disable_all_ligatures();
|
||||
} else {
|
||||
// A value of normal specifies that common default features are enabled, as described in detail in the next section.
|
||||
features.set("liga"sv, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue