-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Investigate/implement renderer setting to disable ligatures #759
Comments
The font picker that gets added to the app settings, could be sure to include options for discretionary ligatures, as well as possibly stylistic sets? Opentype gives you a lot of options, as do Variable fonts, which could have a width slider for fonts which support that. This should also lead to a discussion about the design and features of Cascadia Code or future versions of Consolas and which of these Opentype/Variables features should be implemented. |
@miniksa shot in the dark here - I have done some DirectWrite work in the past and I think you can do what you want with "GetGlyphs". I am not sure the code I am referencing is even used in your scenario but I thought maybe with some luck the suggestion would be helpful. If not sorry for wasting your time.
|
@miniksa Please note that there are some features that are mandatory for supporting complex scripts, so they cannot be turned off. IDK whether Here are some sample code: https://github.com/fdwr/TextLayoutSampler/blob/master/DWritEx.ixx cc. @fdwr |
Is it appropriate to have a font rendering option that forces mono spaced glyphs? Or is this specifically an issue with the font? I may have this wrong but I think there are half/double spaced glyphs, however in other terminal emulators powerline / nerdfont arrow glyphs are single spaced glyphs but in this terminal it's making the arrows double spaced glyphs. By the way, what MS is doing for developers is incredible. |
Ah sorry guys, I see that this was talked about here:
|
Chiming in here to say that there is (anecdotally) a significant number of people who aren't big fans of fancy coding ligatures, and that being able to turn them off would be a godsend. Personally, I'd like to try using the shiny new Cascadia Code you guys have so lovingly put together, but not being able to disable its ligatures is stopping me from sticking with it. |
Currently, Fira Code & Cascadia Code rely on the opentype feature I am currently making a font with code ligatures (https://github.com/arrowtype/recursive), and looking into using discretionary ligatures So, in my mind, the ideal controls for this would be: |
@thundernixon Would you ever want to display |
@fwdr good question! It's hard to be totally confident in a universal statement about typography, especially because I am only familiar with Latin script. However, I think you are mostly correct in seeing this as a three-state option, rather than a four-state option. Both are abstractions, but the simpler one probably covers almost all reasonable (Latin) uses of these four features, and would have the benefit of being possible through a single setting with a radio-button option. I see it as:
It's natural to add ligatures for readability without adding ligatures for flair. However, I doubt many type designers or users would want to add ligatures for flair, without also adding ligatures for readability. |
@thundernixon |
@be5invis It's just not very user-friendly, is it? A user shouldn't have to know the specifics of the OpenType format to turn ligatures on or off. |
@obskyr well, it could basically follow the CSS approach to font control, which should presumably be friendly enough for most folks wanting to customize a developer app. It would likely be less about them knowing the opentype format, and more about font developers documenting what settings are available. It would open up so much more flexibility to allow users to specify variation axes and opentype features, and avoid asserting an abstraction onto all languages, users, and screens. After all, almost 100% of the user’s interface in a terminal is typography, so it might make sense to allow some control. Potentially, might there be a way to have a simple ligature (choices Off, Default, All) control, but allow this to be overridden by a @be5invis’s CSS-like advanced setting? |
@thundernixon |
@be5invis I like it! Though, I think the label
|
Though, I think it would have to be constrained what CSS could be written. Probably, it should be specifically https://helpx.adobe.com/fonts/using/open-type-syntax.html https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/OpenType_fonts_guide Specifically, I think |
Looping back on this with something related: VS Code now supports control over opentype features, including dlig, stylistic sets, and more! Basically, they have just allowed users to directly enter OpenType tages into the settings.json file, under
This isn't perfect, because the name of the setting isn't quite logical – ligatures are only one type of OpenType feature. A more apt name might be something like |
This isssue is now more important, because after the latest update, Cascadia Code includes ligatures which cause visual problems in Terminal, e.g. when printing "." after one another like a progress bar. |
It was brought to our attention that shipping a font with ligatures as our default font could be an accessibility issue for the visually-impaired. Unfortunately, we don't have a renderer setting to disable ligatures (#759). Fortunately however, we DO already have a version of Cascadia that doesn't have ligatures. If we ship that and set it as our default font, we'll at least let people _opt_ to have ligatures enabled by switching from `Cascadia Mono` to `Cascadia Code`. ## PR Checklist * [x] Closes internal discussion * [x] CLA signed * [ ] Tests added/passed * [x] Requires documentation to be updated * [x] I've discussed this with core contributors already.
My best guess here, which hasn't been validated yet, is passing a I would have to play around with it and/or ask the DWrite folks. |
It was brought to our attention that shipping a font with ligatures as our default font could be an accessibility issue for the visually-impaired. Unfortunately, we don't have a renderer setting to disable ligatures (#759). Fortunately however, we DO already have a version of Cascadia that doesn't have ligatures. If we ship that and set it as our default font, we'll at least let people _opt_ to have ligatures enabled by switching from `Cascadia Mono` to `Cascadia Code`. ## PR Checklist * [x] Closes internal discussion * [x] CLA signed * [ ] Tests added/passed * [x] Requires documentation to be updated * [x] I've discussed this with core contributors already.
Would this setting also disable the abnormal rendering of |
Yes. |
Adds support for users to be able to set font features and axes (see the spec for more details!) ## Detailed Description **CustomTextLayout** - Asks the `DxFontRenderData` for the font features when getting glyphs - _If any features have been set/updated, we always skip the "isTextSimple" shortcut_ - Asks the `_formatInUse` for any font axes when mapping characters in `_AnalyzeFontFallback` **DxFontRenderData** - Stores a map of font features (initialized to the [standard feature list]) - Stores a map of font axes - Has methods to add font features/axes to the map or update existing ones - Has methods to retrieve the font features/axes - Sets the font axes in the `IDWriteTextFormat` when creating it ## Validation Steps Performed It works! [standard feature list]: https://github.com/fdwr/TextLayoutSampler/blob/ac5aef67d1cc0cb67c5e3be29b30bda5a90c3e2b/DrawableObject.ixx#L802 Specified in #10457 Related to #1790 Closes #759 Closes #5828
🎉This issue was addressed in #10525, which has now been successfully released as Handy links: |
Found my problem: it's "features", not "feature"... after making that change I could see it working perfectly with CaskaydiaCove NF font! |
@pedrolamas, weird, your settings did not work for me. I had to set the following:
|
@trallnag I probably have changed it and never actually noticed, but my main issue was the node name! In any case, these are the current flags I use: "features": {
"calt": 0,
"clig": 0,
"dlig": 0,
"hlig": 0,
"liga": 0,
"rlig": 0,
"salt": 1
} |
@pedrolamas, do you know a place where these flags are documented? |
I think there is a setting somewhere in the DirectWrite stuff that will let you tell ligatures to go away and just use the individual symbols from a given font.
I think that by doing nothing, fonts like Fira Code are choosing the ligature.
This represents rooting around in DirectWrite land to see if:
Anyone could do the rooting around, so tagging as help-wanted. Please don't get too far without letting us know the investigation first.
Also, this is coming out of #514
The text was updated successfully, but these errors were encountered: