Remix.run Logo
Karliss 4 hours ago

Ligatures like in "stuffing" isn't the worst case for mid ligature styling. You could introduce a split between stuff and ing preventing the forming of ligature and it would likely still look reasonable. That's actually one of the most straight forward things you can do for text layout, split text into runs with same style and then shape each run separately. That's also how you end up with mess shown in Safari screenshot. In non English scripts where ligatures are less optional things are trickier. Not applying the ligature can significantly affect the look. In some fonts/scripts where ligatures are used for diacritic marks or syllable based combinations of characters into single glyph.

Another aspect of mid ligature color changes is that if you allow color you probably allow any other style change including font size or the font itself, which in turn can have completely different size and shaped glyph for the corresponding ligature and even different set of ligatures. Thus making drawing of corresponding characters as single ligature impossible.

One of the most warranted and also one of the trickiest cases for wanting mid ligature style change is language education materials. You might want to highlight individual subcomponents of complex character combinations to explain rules behind them. For these cases the firefox splitting hack is not good enough. Although it seems like in current version of Firefox on Linux न्हृे is handling much better than in 2019 screenshot. This might be as much as improvement in Firefox and underlying libraries as it was in font. At the end of day if font draws a complex character combination as single shape there is nothing font rendering software can do to correctly split into logical components. Instead of ligatures you can draw such characters as multiple overlapping and appropriately placed glyphs (possibly in combination with context aware substitutions). Kind of like zalgo text, no font has separate glyphs for each letter with every combination of 20 stacked diacritic marks. That way the information about components isn't lost making it technically possible to correctly style each of them, but it's still not easy.