NEW 289997
OpenType feature contextual substitutions break when split across multiple inline elements
https://bugs.webkit.org/show_bug.cgi?id=289997
Summary OpenType feature contextual substitutions break when split across multiple in...
Peter Dekkers
Reported 2025-03-18 14:46:41 PDT
Created attachment 474618 [details] Reproduction of the bug in a simple HTML file. Overview Contextual substitution OpenType features (https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#5.e), which include e.g. "kern", "liga" and "calt", break when the substitution context is split across multiple inline HTML elements. This works fine in Chrome and Firefox. Steps to Reproduce Load the attached reproduction HTML file. It uses the Roboto typeface and shows the "fl" ligature breaking when "f" is contained in a <span> element. Actual Results The "fl" ligature breaks in the sentence "The dog fled." Expected Results The "fl" ligature should not break as all the text is in an inline context.
Attachments
Reproduction of the bug in a simple HTML file. (907 bytes, text/html)
2025-03-18 14:46 PDT, Peter Dekkers
no flags
rendering in safari, firefox, chrome (1.23 MB, image/png)
2025-03-21 00:38 PDT, Karl Dubost
no flags
Karl Dubost
Comment 1 2025-03-21 00:38:55 PDT
Created attachment 474665 [details] rendering in safari, firefox, chrome Thanks Peter for the report. There is another interesting difference. The way the coloring is done. <p>The dog <span style="color: red;">f</span>led.</p> Safari: Ligature: NO, Color: red on f Firefox: Ligature: YES, Color: red on f Chrome: Ligature: YES, Color: red on both f and l
Peter Dekkers
Comment 2 2025-03-21 14:54:37 PDT
Thank you Karl for that interesting addition. A little more context (ha). The ligature is a single glyph in the font, so rendering half of it in a different colour wouldn't normally be supported by the font itself. You can see in the Firefox screenshot how colouring of the "f" in the ligature glyph seems to be done by splitting it right down the middle, which doesn't actually fully colour the "f" red — part of the cross bar and the instroke are still black. OpenType contextual substitutions don't always render the entire context as a single glyph, like they do with ligatures. An example of that would be "calt" (contextual alternates) rendering "2x2" as "2×2", substituting x for a multiplication sign. With "frac" (fractions) you could have both: "1/2" could be rendered as a single glyph "½" or as a combination of superscript ¹, subscript ₂ and some form of slash, "¹/₂".
Radar WebKit Bug Importer
Comment 3 2025-03-25 14:47:38 PDT
Note You need to log in before you can comment on or make changes to this bug.