Bug 1810310 - When letter-spacing is present, disable all varieties of 'optional' ligatures, not only 'common' ones. r=emilio

This fixes behavior on css/css-fonts/font-feature-resolution-002.html.

Differential Revision: https://phabricator.services.mozilla.com/D166865
This commit is contained in:
Jonathan Kew 2023-01-16 00:18:19 +00:00
Родитель e0d94a9a6d
Коммит 154e6b9926
2 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -587,12 +587,18 @@ void gfxFontShaper::MergeFontFeatures(
}
}
auto disableOptionalLigatures = [&]() -> void {
mergedFeatures.InsertOrUpdate(HB_TAG('l', 'i', 'g', 'a'), 0);
mergedFeatures.InsertOrUpdate(HB_TAG('c', 'l', 'i', 'g'), 0);
mergedFeatures.InsertOrUpdate(HB_TAG('d', 'l', 'i', 'g'), 0);
mergedFeatures.InsertOrUpdate(HB_TAG('h', 'l', 'i', 'g'), 0);
};
// Add features that are already resolved to tags & values in the style.
if (styleRuleFeatures.IsEmpty()) {
// Disable common ligatures if non-zero letter-spacing is in effect.
// Disable optional ligatures if non-zero letter-spacing is in effect.
if (aDisableLigatures) {
mergedFeatures.InsertOrUpdate(HB_TAG('l', 'i', 'g', 'a'), 0);
mergedFeatures.InsertOrUpdate(HB_TAG('c', 'l', 'i', 'g'), 0);
disableOptionalLigatures();
}
} else {
for (const gfxFontFeature& feature : styleRuleFeatures) {
@ -607,8 +613,7 @@ void gfxFontShaper::MergeFontFeatures(
} else if (aDisableLigatures) {
// Handle ligature-disabling setting at the boundary between high-
// and low-level features.
mergedFeatures.InsertOrUpdate(HB_TAG('l', 'i', 'g', 'a'), 0);
mergedFeatures.InsertOrUpdate(HB_TAG('c', 'l', 'i', 'g'), 0);
disableOptionalLigatures();
}
}
}

Просмотреть файл

@ -1,2 +0,0 @@
[font-feature-resolution-002.html]
expected: FAIL