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

Caskaydia Cove introduces ligature issue not in Cascadia Code #1291

Closed
3 tasks done
Kissaki opened this issue Jun 6, 2023 · 30 comments · Fixed by #1613
Closed
3 tasks done

Caskaydia Cove introduces ligature issue not in Cascadia Code #1291

Kissaki opened this issue Jun 6, 2023 · 30 comments · Fixed by #1613

Comments

@Kissaki
Copy link

Kissaki commented Jun 6, 2023

Testing in Windows Terminal - font size 12, Windows 11, NF v3.0.2

I would expect the ligature for => to be the same and without visual artifacts.

Cascadia Code:

image

CaskaydiaCove Nerd Font Mono:

image

🗹 Requirements

  • I have searched the issues for my issue and found nothing related and/or helpful
  • I have searched the FAQ for help
  • I have searched the Wiki for help
@Finii
Copy link
Collaborator

Finii commented Jun 7, 2023

Oh, sorry to hear that. Lets find the reason.

Works in Writer

image

@phjordan
Copy link

phjordan commented Jun 8, 2023

I see the same, in Windows Terminal as well as in VS Code, Nerd Fonts 3.0.2

image

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

Can not reproduce on Win10, VS Code 1.71.0, NF 3.0.2:

image

My settings:

image

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

The problem with Windows Terminal is that they bundle Cascadia Cove (VF) with it and one can not uninstall it, which I hate.

Installing that thing now, hold tight.

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

@phjordan Btw, please share a picture of your config.json and maybe a view of the font settings dialog with 'cas' as search term:

image

You see I have no Cascadia Code installed. I unpacked the Caskaydia zip file, select all, right click, install (for user) (is how I installed the fonts).

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

Can see it with Windows Terminal:

image

(:thought_balloon: Now I can not restart VS Code, great)

@Finii Finii added the confirmed label Jun 8, 2023
@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

  • Could not start VS Code
  • Revert changes in config.js - still not opening
  • Remove VS Code via 'apps'
  • Reinstall VS Code via MS Store - problem: can not install
  • Reboot
  • Reinstall VS Code via MS Store - problem: can not install
  • Download VS Code msi
  • Install - can not overwrite old files?
  • Reboot / manual deletion of old files
  • Install ok
  • Start ... still not opening

Windows is so easy, everything works out of the box!

@phjordan
Copy link

phjordan commented Jun 8, 2023

Here are my font settings, Both 'Cascadia Code' and 'CaskaydiaCove...' are installed for all users.

image

I noticed that the editor.fontSize-setting does have an effect. I don't know anything about font rendering and scaling, but maybe this observation is of help. With 'Cascadia Code' set as font, the arrows seem fine for all font sizes.

My original VS code settings.json:
image

It looks fine with editor.fontSize commented out:
image

It looks fine with font size 14:
image

Font size 12:
image

Font size 22:
image

Edit: This is on Windows 10

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

Thanks for the input! There are indeed size-limits where the font switches rendering, I will check that.
And maybe I can get VS Code repaired on that one machine, all other machines I have are Win11...

Edit: Ah, report was for Win 11 🤦‍♀️

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

Ah, I have another hunch...
Which concrete Cascadia Code did you compare with? (Best would be a details screenshot of the font settings thing, when opened Cascadia Code)?

I fear that it might be the hints 🙄

@Finii
Copy link
Collaborator

Finii commented Jun 8, 2023

Which concrete Cascadia Code did you compare with?

This is the reason why I hate the bundling of Windows Terminal with Cascadia Cove, because they bundle the VF and one has to go through a lengthy operation to remove that if you want the otf or pure ttf ones instead.

The font-patcher can not work with VF, so we use some static ttf variant (see the readme)

@phjordan
Copy link

phjordan commented Jun 8, 2023

Which concrete Cascadia Code did you compare with? (Best would be a details screenshot of the font settings thing, when opened Cascadia Code)?

Yes, it seems to be the bundled version of Cascadia Code that I have installed.
image

@FrancescoLuzzi
Copy link

Thanks for the input! There are indeed size-limits where the font switches rendering, I will check that. And maybe I can get VS Code repaired on that one machine, all other machines I have are Win11...

Edit: Ah, report was for Win 11 🤦‍♀️

Also reproducible on windows 10 👍🏼

@azdanov
Copy link

azdanov commented Jun 28, 2023

I also encountered this issue. Windows 11, Windows Terminal 1.17

image
Can see that -- near git are of different sizes

image
And it gets better with font size increase.

@harshv5094
Copy link

harshv5094 commented Jun 29, 2023

I've Installed the latest version of Caskaydia Cove NF on my windows 10, and now I'm seeing this box icons, I need help regarding this issue

image

image

@Finii
Copy link
Collaborator

Finii commented Jun 29, 2023

@harshv1741 This is no ligature Issue.

Please check out

Finii added a commit that referenced this issue Apr 18, 2024
[why]
Some Caskaydia Cove glyphs that are used in ligatures (to create endless
arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next
to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static
Cascadia Code instances, which upstream just have ttfautohint hints that
are different from the hints in the variable fonts and people complained
that the look is different.

[how]
Add a new field to the config.json file that holds regexes of glyph
names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that
needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting
is not ideal - the global tables are kept and probably less compatible
to fontforge's own hinting... But the results are good.

Fixes: #1291
Fixes: #1609

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator

Finii commented Apr 18, 2024

I would need someone who can test the potential fix, good would be a thorough test like @phjordan with all the arrows.

Finii added a commit that referenced this issue Apr 18, 2024
[why]
Some Caskaydia Cove glyphs that are used in ligatures (to create endless
arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next
to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static
Cascadia Code instances, which upstream just have ttfautohint hints that
are different from the hints in the variable fonts and people complained
that the look is different.

[how]
Add a new field to the config.json file that holds regexes of glyph
names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that
needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting
is not ideal - the global tables are kept and probably less compatible
to fontforge's own hinting... But the results are good.

Fixes: #1291
Fixes: #1609

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this issue Apr 20, 2024
[why]
Some Caskaydia Cove glyphs that are used in ligatures (to create endless
arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next
to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static
Cascadia Code instances, which upstream just have ttfautohint hints that
are different from the hints in the variable fonts and people complained
that the look is different.

[how]
Add a new field to the config.cfg file that holds regexes of glyph
names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that
needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting
is not ideal - the global tables are kept and probably less compatible
to fontforge's own hinting... But the results are good.

Fixes: #1291
Fixes: #1609

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator

Finii commented Apr 20, 2024

It would be great if someone who sees the arrows problem can check this font:

CaskaydiaCove_arrows.zip Version 3.2.1-10

(Probably you need to uninstall the old Caskaydia first, then reboot, then install the font given in this comment.)

Without reports it is hard to see if this will fix it or not... Help needed.

@FrancescoLuzzi
Copy link

Thanks for the update, i'll give it a try as soon as I can!

@FrancescoLuzzi
Copy link

FrancescoLuzzi commented Apr 21, 2024

It seems to be 99.9% resolved!

In some font sizes the "=>" ligature has a really small defect (there is a really small gap between the "equal" sign and the "greater than" sign
image

This is the "correct" arrow on a different size:
image

Same thing with:
image

@Finii
Copy link
Collaborator

Finii commented Apr 21, 2024

Hmm, this is maybe also a hinting problem, this is most visible at 12 pt / 96 dpi.

image

The advance width is 9.4 pixel, and so the last pixel is only filled less than half, so it is rendered half-grey.
Of course this will vary with the number of characters in front of it.

The situation is comparable with FiraCode unpatched:

image

Just here other sizes show that same problem.

Are you sure Cascadia Code unpatched does not have the same problem at some sizes? Maybe you can try.
I need to fire up Glyphs3 to examine it. Or was there not a tool on Linux to show the subpixel rendering of variable fonts on Linux 🤔

I can check, but I believe this is a principle problem that can not be solved without 'massive' manual intervention.

Affected are a high number of glyphs (the font-patcher reports it auto-adjusts 88 glyphs), so that would be quite some work to do, manually edit the hints to extend more to the outside.
Well, and famous FiraCode has the same, so why should we be better ;-)

@FrancescoLuzzi
Copy link

FrancescoLuzzi commented Apr 21, 2024

Are you sure Cascadia Code unpatched does not have the same problem at some sizes? Maybe you can try.

Just uninstalled Caskaydia Cove, rebooted and tried using Cascadia Code, the issue is still there
image

Well... your patch worked just fine, it seems that Cascadia Code is the problem now.
Thanks!

@Finii
Copy link
Collaborator

Finii commented Apr 21, 2024

Thank you for testing all that stuff!
I will do some final tests with the PR (because it completely changes how the configuration works), and then merge the fix.

@Finii
Copy link
Collaborator

Finii commented Apr 21, 2024

@allcontributors please add @FrancescoLuzzi for bug

Copy link
Contributor

@Finii

I've put up a pull request to add @FrancescoLuzzi! 🎉

Finii added a commit that referenced this issue Apr 22, 2024
[why]
Some Caskaydia Cove glyphs that are used in ligatures (to create endless
arrows for example) show uneven line thickness on some platforms.

The reason is the not-matching hinting of glyphs that are places next
to each other and so minuscule differences are quite visible.

Note that the 'original' hinting is generated by VTT on the static
Cascadia Code instances, which upstream just have ttfautohint hints that
are different from the hints in the variable fonts and people complained
that the look is different.

[how]
Add a new field to the config.cfg file that holds regexes of glyph
names for glyphs that should be re-hinted by fontforge on patching time.

In principle we could also implement that as an additional pre-step that
needs to be manually done after running VTT on the static font files.

I'm not sure which is better.

Note that fontforge generates a lot of debug output because the hinting
is not ideal - the global tables are kept and probably less compatible
to fontforge's own hinting... But the results are good.

Fixes: #1291
Fixes: #1609

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@nguyenlephuc2108
Copy link

Oh! == is don't work, or my computer have problem?

@Phoenix-
Copy link

Phoenix- commented Sep 3, 2024

Hi,
I've got exactly the same problem with -> and => ligatures. Actual on all font sizes and font weights, but severity differs from size to size.
image

Win11 22631.4037
NF 3.2.1
Screenshot is from Windows Fonts Manager, but actual for any text editor. Tried VS Code and Windows Terminal

@feliperomero3
Copy link

Hi, first, thank you for this nerd font, I've been using for four years now.

I'm experiencing the same ligature 'tearing' issue as @Phoenix-

(screen capture below)

image

In the --> ligature the 'tearing' is barely noticiable

In the ==> ligature, the 'tearing' is much more noticiable

These are the fonts shown in the screen capture (screen capture below)

image

My versions

CaskaydiaCove NF: Version 2111.001; VTT 6.35;Nerd Fonts 3.2.1

@Finii
Copy link
Collaborator

Finii commented Sep 8, 2024

The problem is the hinting.

  • Cascadia Code comes hand-hinted as VF (variable font).
  • Nerd Fonts can not (for the foreseeable future) patch VF.
  • Cascadia Code also comes as static variants but they are autohinted by ttfautohint.
  • Thus Cascadia Code VF and Cascadia Code static differs 'a lot' visible in the lettershapes
  • People complain that (especially) the small letters of Caskaydia Cove look different from Cascadia Code
    • Which they do and dont. They look different from Cascadia Cove VF because Caskaydia Cove is based on Cascadia Code static
  • For most people the expected look is the one of Cascadia Code VF because it is preinstalled on Win (often)
  • Instead of ttfautohint we push the Cascadia Code static fonts through VTT which is also an autohinter, but with a look more closely to the hand hinted original
  • Except that VTT does not hint all glyphs the same
  • We patch that font; Caskaydia Cove is Cascadia Code static rehinted by VTT to have a look similar to Cascadia Code VF
  • Well, except what you noticed above, the special lig glyphs are not/differently hinted compared to each other, resulting in sub-pixel differences in the line positions, which are then rendered "on pixel off"

The possibilities here are:

  1. Use Cascadia Code static with ttfautohint (which I assume do not have this problem, but not checked)
  2. Hand-hint the problematic ligature glyphs
  3. Rewrite font-patcher to patch VFs 😁

Then I obviously did something here with commit b2cf801 font-patcher: Allow to rehint some Cascadia glyphs
Ah, this is

That has been merged mid April 2024, just after the v3.2.1 release:

Screenshot 2024-09-08 at 13 37 34

So probably your problems will (mostly) go away after the next release, which is v3.3.0, which is scheduled to happen this month (#1705). So please be patient a bit more. The fix is not 100% perfect but at least better (see notes / feedback above).

@Finii Finii added this to the v3.3.0 milestone Sep 8, 2024
@Phoenix-
Copy link

Phoenix- commented Sep 9, 2024

Thanks for the explanation and for your work. Great fonts :)

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

Successfully merging a pull request may close this issue.

9 participants