Remix.run Logo
Karliss 15 hours ago

Few more additional ones, more about editing than just rendering:

The style change mid ligature has a related problem. While it might be reasonable not to support style change in the middle of ligature, you still want to select individual letters within ligatures like "ff", "ffi" and "fl". The problem just like with color change is that neither the text shaper nor program rendering text knows where each individual letter within ligature glyph is positioned. Font simply lacks this information.

From what I have seen most programs which support it use similar approximation as what Firefox uses for coloring - split the ligature into equal parts. Works good enough for something like "fi", "fl" not so much for some of ligatures within programming fonts that combine >= into ≥.

There are even worse edge cases in scripts for other languages. There are ligatures which look roughly like the 2 characters which formed it side by side but in reverse order. There are also some ligatures in CJK fonts which combine 4 characters in a square.

Backspace erases characters at finer granularity than it's possible to select them.

With regards to LTR/RTL selection weirdness I recently discovered that some editors display small flag on the cursor displaying current position direction when it's in mixed direction text.

gudzpoz 9 hours ago | parent | next [-]

> some editors display small flag on the cursor displaying current position direction

I was amazed to see IDEA/RustRover doing exactly this [1] when I added BIDI texts to my code to test things out.

[1] https://i.imgur.com/Qqlyqpc.png (image taken from IDEA issue tracker)

tomcam 12 hours ago | parent | prev | next [-]

I cannot imagine a use case where I would want to do a style change mid ligature. Can someone smarter than I am give a reasonable example of doing so?

jfengel 11 hours ago | parent [-]

The user may not think of the letters as connected. Suppose the user wanted to write "stuffing" and bold the letters "ing". The user may well not realize that the font thinks of "ffi" as anything other than three separate letters.

Karliss 4 hours ago | parent | next [-]

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.

tomcam 10 hours ago | parent | prev [-]

Excellent example! Thanks.

littlestymaar 7 hours ago | parent | prev [-]

> Few more additional ones, more about editing than just rendering

Right after TFA was published, someone put together the text editing version: Text editing hates you too: https://lord.io/text-editing-hates-you-too/