Skip to content
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

Ligatures variants need more explanation #583

Closed
SharakPL opened this issue Oct 17, 2021 · 26 comments · Fixed by #637
Closed

Ligatures variants need more explanation #583

SharakPL opened this issue Oct 17, 2021 · 26 comments · Fixed by #637

Comments

@SharakPL
Copy link
Contributor

Docs could use more valid examples for available ligatures variants. So far I see 'ss01' (this alone enables cursive alternative so what does 'calt' actually do?), 'ss02', 'ss03', 'ss19' (seems like it has the same effect as 'zero') and 'ss20'. Next part of the Readme looks like a copy-paste from FiraCode respository: it links there and has their example:

"editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'zero', 'onum'"

What does 'ss04', 'ss05', 'ss06' and 'onum' do in Cascadia font? 'onum' in FiraCode changes digits' vertical alignment, but it doesn't look like it works here. I don't see other mentioned stylistic sets in Cascadia Code or Cascadia Mono details:

obraz

A lot of confusion here. It should be explained precisely like for FiraCode

@Ionaru
Copy link

Ionaru commented Nov 13, 2021

calt seems to enable ligatures like => and ss01 seems to enable cursive italics.

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 13, 2021

Cascadia Code has ligatures by default and doesn't need any switch. Cascadia Mono is for terminals and doesn't use ligatures. Besides according to the docs 'ss01', 'calt' is required to enable cursive and it's not true, because ss01 alone does the job. calt alone or combined with other values does nothing.

@Ionaru
Copy link

Ionaru commented Nov 13, 2021

That's not the behaviour I'm seeing in VSCode.

Ligatures: true: Symbols enabled.
image

Ligatures: ss01: Cursive enabled.
image

Ligatures: calt: Symbols enabled.
image

Ligatures: calt, ss01: Both cursive and symbols enabled.
image

@SharakPL
Copy link
Contributor Author

Check again ;) Do you even have latest version 2110.31 or just the default that comes bundled with Windows Terminal or VSCode? I'm using Cascadia Code PL in VSCode so all ligatures are enabled by default. "editor.fontLigatures": "'ss01'" keeps ligatures and enables cursive. "editor.fontLigatures": "'calt'" changes nothing compared to "editor.fontLigatures": true. You would need "editor.fontLigatures": false to disable ligatures. Also no visible effect when calt is combined with other values. Cascadia Code has exactly the same behaviour (only powerline symbols are missing). The same with Cascadia Mono - missing ligatures obviously, but ss01 alone enables cursive version of the font and calt does nothing.

@kenmcd
Copy link

kenmcd commented Nov 13, 2021

calt alone does nothing, not even enabling cursive alternative.

calt stands for Contextual Alternates, not "cursive alternative."
It is calt which creates the ligatures in Cascadia Code.
The is no liga Standard Ligatures feature in Cascadia Code.
You have two ways to turn-on calt in VS Code - true or calt
ss01 only controls cursive italics in the Italic fonts.
The example which is described as for cursive italics which shows both calt and ss01 is just a poor example.
It actually shows two things - enabling ligatures (calt) and enabling cursive italics (ss01).
@Ionaru 's example above is working as expected.

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 13, 2021

calt alone does nothing, not even enabling cursive alternative.

calt stands for Contextual Alternates, not "cursive alternative."

I know. Already fixed my answer couple minutes before your comment 😛
Nevertheless the behaviour is still just as I explained earlier

cascadiacode

As you can see all ligatures are still there even without calt which changes nothing.

You have two ways to turn-on calt in VS Code - true or calt ss01 only controls cursive italics in the Italic fonts.
The example which is described as for cursive italics which shows both calt and ss01 is just a poor example.
It actually shows two things - enabling ligatures (calt) and enabling cursive italics (ss01).

Wrong! Any string here enables ligatures because it represents true (even "editor.fontLigatures": "",) and only explicit false disables ligature (or using Mono version of the font) - as it should be. calt has nothing to do with it.

So let me ask again @kenmcd @Ionaru : do you have last version of the font installed?

@kenmcd
Copy link

kenmcd commented Nov 13, 2021

As you can see all ligatures are still there even without calt which changes nothing.

I am not seeing this.
With a new install of VS Code 1.62.2 I see no ligatures or cursive italics.
So something is different.

@SharakPL
Copy link
Contributor Author

As you can see all ligatures are still there even without calt which changes nothing.

I am not seeing this.

Of course you are 😅 Both ligatures and cursive enabled without calt

obraz

@kenmcd
Copy link

kenmcd commented Nov 14, 2021

If you have an issue with how the font configuration works in VS Code,
it would be appropriate to post that issue in that repository.

Regarding your original question, the stylistic sets which do exist in these fonts are documented on the page you linked to.
The other stylistic sets in the Fira Code example do not exist in this font.
And onum does do not exist in this font either.
Those were just an example of how to configure OpenType features (for that font).

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 14, 2021

It's not an issue with VSCode and it's not even an issue with the font itselft, because it all works as expected. It's an issue with documentation which provides unclear/invalid examples of font configuration. Wasn't I clear on that in opening comment and issue template used?

@aaronbell
Copy link
Collaborator

aaronbell commented Nov 14, 2021

I see there has been some 'lively' discussion on this thread. And I'm glad you all figured out that calt means Contextual Alternatives 😉 .

My apologies that the documentation is not quite clear enough—given that the primarily user-defined features are all stylistic sets, I thought that providing guidance about those features (as seen in the image in the README) would be sufficient. And it seems that the sample I pulled from the VSCode repro was confusing. I'll get around to updating the documentation at some point, but if any of y'all would like to help out, please feel free to submit a PR!

Regarding use of calt in the code example:

When I wrote the documentation, writing editor.fontLigatures and providing a list of OT features would only turn on those features. This is shown by @Ionaru's example where not including calt in the list actually causes the coding ligatures to turned off. However, it appears that behavior may have changed (?). At least in my version of VSCode, whenever editor.fontLigatures is present, unless set to false or calt is specifically set to off, the coding ligatures will automatically be applied if present.

VSCode version:
Version: 1.62.2 (Universal)
Commit: 3a6960b964327f0e3882ce18fcebd07ed191b316

If that is indeed a change in behavior, then use of calt is no longer necessary and the documentation should be updated. I tried to see if there is any mention of this on the VSCode repro but was unable to locate any.

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 14, 2021

I would gladly make a PR, but that's the whole problem it's not clear which of the values used in description are actually related to and still valid for Cascadia Code, not FiraCode. Can you check again opening comment and confirm which of these are valid?

BTW.

...or calt is specifically set to off

How do you set calt or any other set to off? I thought simply not using it in editor.fontLigatures list turnes it off. Is there something like 'calt off'?

BTW2.
Is Cascadia Code even included in VSCode updates? I haven't found any reference in the repo so I doubt VSCode update would ever update Cascadia Code too (good, because it shouldn't install any fonts) so I'm guessing that's why @kenmcd and @Ionaru have older font versions and older behaviour. Only Windows Terminal has CC and CM included. Right?

@aaronbell
Copy link
Collaborator

The full set of features described in the font is shown in the source folder under features: https://github.com/microsoft/cascadia-code/tree/main/sources/features

However, most of these are functionality either required for aspects of the font to work seamlessly, or are not items that I would expect users want to turn on at all times.

As I said, the only items that I expect users to want to enable globally are the stylistic sets which are already listed in the README.

How do you set calt or any other set to off?

See microsoft/vscode#124718
The format is listed as "editor.fontLigatures": "'calt' off,"

Is Cascadia Code even included in VSCode updates?

No idea. I don’t believe so.

so I'm guessing that's why @kenmcd and @Ionaru have older font versions and older behaviour.

The behavior has nothing to do with the font. It is entirely how VSCode has implemented things.

@SharakPL
Copy link
Contributor Author

Stylistic sets are embedded into font itself so how is that not relevant?

@aaronbell
Copy link
Collaborator

I don’t understand your question.

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 14, 2021

so I'm guessing that's why @kenmcd and @Ionaru have older font versions and older behaviour.

The behavior has nothing to do with the font. It is entirely how VSCode has implemented things.

It's the font that provides stylistic sets, VSCode can only enable them. I'd say it's all about the font. You say it has nothing to do with the font. Care to explain why is that?

#402 Looks like calt actually does change ligatures... when it's turned off, so it must be enabled by defualt:

obraz
obraz
obraz

but it still doesn't seem to impact cursive in any way. With calt on or off or not used at all cursive stays the same with just 'ss01'

@aaronbell
Copy link
Collaborator

It's the font that provides stylistic sets, VSCode can only enable them. I'd say it's all about the font. You say it has nothing to do with the font. Care to explain why is that?

Your inherent misunderstanding is that the coding ligatures are present in ss01. They are not. All coding ligatures are in the calt feature which should be enabled at all times and ss01 only handles the italic cursive variant. However, it is up to a particular environment to actually do the work to enable it, be it via the inbuilt OS text rendering engine, or a custom one.

The actual impact of each stylistic set is documented in this image, from the README
stylistic_set

Looks like calt actually does something... when it's turned off, so it must be enabled by defualt

It appears to me as well that it is enabled by default (it wasn't previously). But that may also be OS-related. I'll need to check VSCode on other systems to confirm the behavior. The fact that @kenmcd and @Ionaru need calt to be included to get the ligatures to function gives me pause.

@SharakPL
Copy link
Contributor Author

SharakPL commented Nov 14, 2021

It's the font that provides stylistic sets, VSCode can only enable them. I'd say it's all about the font. You say it has nothing to do with the font. Care to explain why is that?

Your inherent misunderstanding is that the coding ligatures are present in ss01.

Not at all. It was my understaning from the start that ss01 handles only cursive alternate style. It's requirement for calt that was unclear in this part, especially with current description for the example which says nothing about ligatures. Only that calt is required for cursive:

To enable the Cursive form of the italic, here's the code you should use:

"editor.fontLigatures": "'calt', 'ss01'",

I understand now that calt (ligatures) may be enabled by default on Windows (or maybe it's Windows Terminal or VSCode that enables it...), but it's still better to include it in the settings.

The actual impact of each stylistic set is documented in this image, from the README stylistic_set

That's also clear from the begining. What's unclear is the use of FiraCode example with sets that clearly are not available in Cascadia Code so imho using such example is pointless. Unless of course CC does have 'ss04','ss05',ss06','onum' hidden somewhere, but for now I can't see it:

obraz

Fira Code on the other hand is quite clear with their examples. Everything mentioned in the docs is there on the font:

obraz

@aaronbell
Copy link
Collaborator

'ss04','ss05',ss06','onum'

That code was provided as an example of how to request font features. That's it.

@SharakPL
Copy link
Contributor Author

I think examples valid for Cascadia Code would be much more appreciated.
I assure you, if I ever decide to go back to FiraCode i'll definitely not look for settings examples on Cascadia Code repo 😉

@Krysl
Copy link

Krysl commented Jun 29, 2022

"editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'zero', 'onum'"

Setting this didn't work until I deleted all items from the registry(HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts) that were related to Windows Terminal's old fonts.

Deleted registry items

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Microsoft.WindowsTerminalPreview_1.9.1445.0_x64__8wekyb3d8bbwe]
"Cascadia.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.9.1445.0_x64__8wekyb3d8bbwe\Cascadia.ttf"
"CascadiaMono.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.9.1445.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf"
"CascadiaCodeItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.9.1445.0_x64__8wekyb3d8bbwe\CascadiaCodeItalic.ttf"
"CascadiaMonoItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.9.1445.0_x64__8wekyb3d8bbwe\CascadiaMonoItalic.ttf"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe]
"CascadiaCode.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\CascadiaCode.ttf"
"CascadiaCodeItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\CascadiaCodeItalic.ttf"
"CascadiaMono.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf"
"CascadiaMonoItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe\CascadiaMonoItalic.ttf"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe]
"CascadiaCode.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\CascadiaCode.ttf"
"CascadiaCodeItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\CascadiaCodeItalic.ttf"
"CascadiaMono.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf"
"CascadiaMonoItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\CascadiaMonoItalic.ttf"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe]
"CascadiaCode.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe\CascadiaCode.ttf"
"CascadiaCodeItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe\CascadiaCodeItalic.ttf"
"CascadiaMono.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf"
"CascadiaMonoItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.13.11431.0_x64__8wekyb3d8bbwe\CascadiaMonoItalic.ttf"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe]
"CascadiaCode.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe\CascadiaCode.ttf"
"CascadiaCodeItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe\CascadiaCodeItalic.ttf"
"CascadiaMono.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf"
"CascadiaMonoItalic.ttf"="C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.9.1942.0_x64__8wekyb3d8bbwe\CascadiaMonoItalic.ttf"

delete registry ss01 ss02
before before, ss01 before, ss02 ss01 not working
after after, ss01 after, ss02

@SharakPL
Copy link
Contributor Author

SharakPL commented Jun 29, 2022

@Krysl that's probably because Windows Terminal uses font embeded within the installation as you can see in the paths. It's not Cascadia font installed on your system and most likely not even the same version.

Besides this issue is all about this settings being invalid for Cascadia Code as it was simply copy/pasted from Fira Code repository. I can see readme has been updated already with valid description, but it still contains this invalid example. Why? 🤦‍♂️ It's pretty obvious most users will simply take this invalid example and then wonder why is it not working or what these seetings not mentioned in the description even mean.

@mitsukuri
Copy link

'ss04','ss05',ss06','onum'

That code was provided as an example of how to request font features. That's it.

But what does that example, relevant only to Fira Code, have to do with Cascadia documentation, where it is irrelevant, other than puzzling and baffling people?

@mitsukuri
Copy link

mitsukuri commented Oct 26, 2022

For me, "editor.fontLigatures": "'ss01'" enables both cursive and ligatures in VSCode 1.72.2. Cascadia Code variable 2111.01.

I came here to find out what does that mysterious calt mean but alas, no solid understanding even after reading through the issue, let alone the readme.md aka official documentation.

@Kunal25Das
Copy link

Is it possible to only enable cursive without the symbol ?

@warhodes-dev
Copy link

warhodes-dev commented Oct 2, 2023

To summarize this thread, the README contains the following:

For example, in VS Code, you can enable stylistic sets (and other OpenType features) via settings.json:
"editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'zero', 'onum'"

However many of these stylistic sets do not exist for Cascadia Code (chiefly ss04, ss05, ss06, and onum) making the example invalid. A user (me) may try to enable/disable some of these options which will have no effect, and will erroneously assume something is wrong. We should only provide examples of valid configurations for this font in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants