top | item 46406723

(no title)

Karliss | 2 months 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.

discuss

order

gudzpoz|2 months ago

> 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)

cmyr|2 months ago

A technical note: OpenType Layout does have a way of representing the appropriate _cursor positions_ to use for components of a ligature[1], which is a good proxy for where the individual glyph boundaries are in the trivial case (fi and fl, say) but these tables are not reliably included in all fonts, and they are not actually used by much client software (last I checked they were used by CoreText but not by HarfBuzz or DirectWrite.)

[1]: https://learn.microsoft.com/en-us/typography/opentype/spec/g...

tomcam|2 months ago

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|2 months ago

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.