-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeMirror's default CSS should disable font ligatures #3899
Comments
Good call. Done in attached patch. |
Is there a reproduction case? I tend to respect typography done by professionals, so it'll be great to know what is the downside. |
Browsers won't create individual bounding boxes for characters when ligatures are used, which breaks CodeMirror's cursor placement (among other things) |
Tried to reproduce, don't see any issues whatsoever (IE11, Chrome, FF - Windows): http://jsfiddle.net/5k94a6h2/1/ Is it platform-specific? |
I'm not (Chrome Linux) seeing any ligatures in that test case. |
I guess you mean the spacing between AV. That might be handled by the same CSS control, but doesn't cause the issue I was referring to -- that happens only when you actually get a different rendering for letter combinations. |
Got a reproduction case. Indeed, the cursor movement jumps over the ligature, inserting a zero-width space after: http://jsfiddle.net/5k94a6h2/4/ Given that CodeMirror is used for much more than just editing code, would you consider a PR for a fix? Ideally the width of the ligature should be distributed among the individual characters proportionally to the widths of the characters measured standalone. Detection can be triggered by zero-width characters. Proper zero-width characters unrelated to ligatures should remain zero-width (based on the fact they have zero width when standalone). Alternatively 'standalone' may be replaced with 'surrounded by spaces from both ends' to avoid being tripped by crazy Unicode. |
This is somewhat related to #2115 and definitely not easy to fix (especially in a performant way), because ligatures are complex and unpredictable, and querying the browser for the information you need is hard. |
Ligatures seem to work fine now, so maybe enabling again would be good |
What do you mean that they seem to work fine now? |
In CodeMirror, if you use a font that has fancy ligature support (like Fira Mono from https://mozilla.github.io/Fira/), you get pretty strange behavior in the editor when moving the cursor, selecting, etc. It's also generally not something one would be likely to want in a code editor, so I'd recommend it being disabled in the default CSS, e.g. with
font-variant-ligatures: none;
.The text was updated successfully, but these errors were encountered: