microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.8k stars 802 forks source link

Can we get a full "Nerd Font" version? #194

Closed Jaykul closed 6 months ago

Jaykul commented 4 years ago

Description of the new feature/enhancement (with images if possible)

Basically, it should have the 3,000+ icons and glyphs that are added by the scripts over at nerd-fonts so that those of us generating or using tools like /devblackops/Terminal-Icons and /mnurzia/better-ls or /nick-bull/spaceship-prompt-nerdified can use Cascadia 😁

https://raw.githubusercontent.com/devblackops/Terminal-Icons/master/media/screenshot1.PNG

Proposed technical implementation details (optional)

Ideally, update the font with their patcher and distribute it here. Alternatively address ryanoasis/nerd-fonts/issues/373 and help everyone understand how they can make it happen without getting in trouble...

mdtauk commented 4 years ago

Adding icons to the font can add its own questions and issues.

Jaykul commented 4 years ago

Well, NerdFonts maps specific glyph sets to specific code points. As with the "PowerLine" glyphs, if we using that name, it basically has to map the same glyphs the same way so it will work as a drop-in replacement ...

Hypothetically, I suppose you could customize them, but it's probably not necessary (certainly not expected). All the glyphs come from other github repos, you can check them and their licenses on that glyph set page.

Jessidhia commented 4 years ago

It seems this is planned, or at least the build script does support nerdfonts (it's the "NF" variant), but it doesn't support using nerdfonts' dataset as-is, it needs to be in the ufo format (?) while nerdfonts ships pre-compiled .ttf/.otf glyphs and a handful of .svg without any indication of how those sources are built or acquired.

There was a dataset committed to this repository (https://github.com/microsoft/cascadia-code/commit/8d3a90a5614761fa5675449d0c3a8a5e2c0c6753) which later got silently deleted (https://github.com/microsoft/cascadia-code/commit/6ed2bab54d8254543beefe12b11f78fa4611f48c); but the refactored build script will still try to build the "NF" variant if the dataset is restored.

Unfortunately, building with Cascadia's script using that dataset (if restored with git checkout 6ed2bab^ -- sources/nerdfonts/NerdfontsNF.ufo) produces a buggy font that has the glyphs but they render at the wrong size; the font is also not detected as monospace. This latter problem is also present on nerd-fonts' own patcher (https://github.com/ryanoasis/nerd-fonts/pull/374#issuecomment-545758315) which should be fixed by https://github.com/ryanoasis/nerd-fonts/pull/394 over there.

aaronbell commented 4 years ago

Yes, the script does support building Nerd Fonts. There's some things with the full set of characters that are still being sorted out, so only the Powerline version was released for now.

For your reference, UFO is a font source format. Rather than building from a miscellaneous collection of font files and vector formats, it made sense to coalesce the various symbols into a single source file, with everything placed where it should be. That also means less risk of font editors leaving their thumbprint on the font export (as is seen with Font Forge in the issues listed above). In the process of producing the UFO, I looked to normalize the characters within the font's advance width (so all characters fit within the 1200 funit limit). And in general, I tried to modify glyphs from the same origin in the same way. That way they'd look similar in weight and size.

In terms of the question regarding "not detected as monospace", there's a lot of discussion around this point. Under the Unicode standard, Combining marks are considered "nonspacing", which is to say, they are zero width. However, since these codepoints still contain outlines, some code frameworks may not detect the font as monospace. We have an issue posted related to this (#118). However, I have not observed contemporary applications appear to have this problem, nor has there been sufficient complaint of the font not working to justify breaking with the Unicode standard.

Hope that helps!

Gorthog commented 4 years ago

Someone patched Cascadia font and added the missing glyphs / icons. It worked for me for exa icons:

image

https://github.com/adam7/delugia-code/releases/download/v1911.21.3/Delugia.Nerd.Font.Complete.ttf

Jaykul commented 4 years ago

Yeah, NerdFonts.com forked it too, and they finally patched their monospace issue, so the version they're shipping under the name "Caskaydia Cove" works pretty well..

Gorthog commented 4 years ago

Actually I tried it first, but it didn't work for me. For this specific usage (using exa) not all icons were shown.

MN-83 commented 4 years ago

I downloaded it, looks good, the name is: CaskaydiaCove Nerd Font https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/CascadiaCode/complete/Caskaydia%20Cove%20Regular%20Nerd%20Font%20Complete.ttf

schuelermine commented 4 years ago

Adding icons to the font can add its own questions and issues.

* Does Cascadia use the icons as is, or does it develop its own iconographic language and style?

It might be a good compromise to offer a version with the icons as is while developing Cascadia's own style

phil-scott-78 commented 3 years ago

Looks like the latest version of oh-my-posh is using the full set of Nerd Font characters for all their themes. Their recommendation is just to not use Cascadia due to the missing characters.

I'm honestly not sure what the official repo can do about this, but I wanted to document for others that run into this in the future.

Right now the work arounds aren't great

felipecrs commented 3 years ago

Is there anything blocking this to happen?

trallnag commented 3 years ago

Just as a heads-up: The currently available patched Nerd Font of Cascadia doesn't just add glyphs but also somehow alters the font itself. For example some letters look thicker. I (as a total noob) patched a newer version of Cascadia, but it resulted in basically all characters becoming taller

https://github.com/ryanoasis/nerd-fonts/issues/673#issuecomment-932506936

https://github.com/ryanoasis/nerd-fonts/issues/519#issuecomment-932506584

aaronbell commented 3 years ago

@trallnag this is due to the patcher inherently needing to alter the hinting of the font. I have not spent the time (nor do I have the expertise in ttfautohint) to figure out the settings to change this.

trallnag commented 3 years ago

@aaronbell, interesting, thanks for the answer. for me fonts are more or less a total black box. So it doesn't matter what file type I patch? static vs variable, OTF vs TTF?

aaronbell commented 3 years ago

@trallnag, the static instances should work better since I believe they’re currently autohinted so it should be the same with or without the patch.

The variable font will definitely not work. But the patcher wouldn’t have worked anyway on a variable font.

aaronbell commented 3 years ago

But I should add that, per #371, the statics already don’t align well with the variable font. :(

trallnag commented 3 years ago

Ok I understand it better now, thanks again

Finii commented 3 years ago

@phil-scott-78

  • The delguia version which doesn't support the different weights, which isn't great because the light version is the obviously superior weight

Well, it does, since June 2021 (https://github.com/adam7/delugia-code/commit/c1339ee1cbca58bc18ee4dd0856a4d78600a2ee1)

phil-scott-78 commented 3 years ago

@phil-scott-78

  • The delguia version which doesn't support the different weights, which isn't great because the light version is the obviously superior weight

Well, it does, since June 2021 (https://github.com/adam7/delugia-code/commit/c1339ee1cbca58bc18ee4dd0856a4d78600a2ee1)

Oh happy days! I missed that. Thanks for the heads up!

Finii commented 3 years ago

I just wanted to note, that some codepoints used by Nerd Fonts are misused, and it is impossible to keep the 'usual nerd font codepoints' and some Arabic / Hebrew glyphs.

(for ref: https://github.com/adam7/delugia-code/issues/64#issuecomment-891168710)

Also noticed that these Arabic / Hebrew glyphs are only existing in Cascadia Code non-italic (at least when looked at the static font files).

Maybe better description of the problem here: https://github.com/adam7/delugia-code/issues/64#issuecomment-891584510

Edit: Add last paragraph

Finii commented 3 years ago

@aaronbell

The variable font will definitely not work. But the patcher wouldn’t have worked anyway on a variable font.

Well, the patcher (or rather fontforge) does work with the variable font (sort of), and Delugia used the variable fonts until people ... demanded the light weight.

aaronbell commented 3 years ago

@Finii I recalled people saying that the patcher crashes when trying to parse the variable fonts. Sounds like that has been resolved, but like you said, people also want the non Regular weights :).

And no, Arabic and Hebrew are not included in the italic as those languages do not usually employ italics.

MattBDev commented 2 years ago

I wish there was an update to if this is actually something that will happen in the future or if users should just rely on the CaskaydiaCove font as an alternative.

tristan957 commented 6 months ago

Now that Nerd Fonts support has been added, could we get a new release? Looks like neither a tag nor release has been done since 2021 in this repository.

DHowett commented 6 months ago

That would be the logical next step for us maintainers, eh?

tristan957 commented 6 months ago

Thanks Dustin! Then I can try and help package it in Fedora :smile:

DHowett commented 6 months ago

(FWIW: The release build failed last night, so I'm digging in today to see why :smile:)

There's a couple other good pull requests backed up in here, so it'll be good to finally land those too!

aaronbell commented 6 months ago

@dhowett I’m afraid that something has changed in the dependent libraries since the last build and I may need to rewrite the build system to fix it… 😂

DHowett commented 6 months ago

@aaronbell eh, I wouldn’t go that far yet. It fails even with the same version of Python (3.9) and all of the dependencies pinned to the versions from the last build. 🙂

I’ll let you know if more work is required!

aaronbell commented 6 months ago

Hmm. Interesting. Well let m know what you uncover!

DHowett commented 6 months ago

@aaronbell I think you were the killer!

  File "/home/duhowett/cascadia-code/lib/python3.11/site-packages/fontTools/feaLib/parser.py", line 134, in parse
    raise FeatureLibError(
fontTools.feaLib.error.FeatureLibError: The following glyph names are referenced but are missing from the glyph set:
 uniE0A0 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:580:5)
 uniE0A0.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:580:16)
 uniE0B0 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:581:5)
 uniE0B0.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:581:16)
 uniE0B1 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:582:5)
 uniE0B1.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:582:16)
 uniE0B2 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:583:5)
 uniE0B2.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:583:16)
 uniE0B3 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:584:5)
 uniE0B3.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:584:16)
 uniE0B4 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:585:5)
 uniE0B4.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:585:16)
 uniE0B5 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:586:5)
 uniE0B5.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:586:16)
 uniE0B6 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:587:5)
 uniE0B6.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:587:16)
 uniE0B7 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:588:5)
 uniE0B7.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:588:16)
 uniE0B8 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:589:5)
 uniE0B8.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:589:16)
 uniE0B9 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:590:5)
 uniE0B9.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:590:16)
 uniE0BA (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:591:5)
 uniE0BA.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:591:16)
 uniE0BB (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:592:5)
 uniE0BB.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:592:16)
 uniE0BC (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:593:5)
 uniE0BC.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:593:16)
 uniE0BD (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:594:5)
 uniE0BD.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:594:16)
 uniE0BE (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:595:5)
 uniE0BE.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:595:16)
 uniE0BF (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:596:5)
 uniE0BF.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:596:16)
 uniE0C0 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:597:5)
 uniE0C0.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:597:16)
 uniE0C1 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:598:5)
 uniE0C1.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:598:16)
 uniE0C2 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:599:5)
 uniE0C2.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:599:16)
 uniE0C3 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:600:5)
 uniE0C3.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:600:16)
 uniE0C4 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:601:5)
 uniE0C4.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:601:16)
 uniE0C5 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:602:5)
 uniE0C5.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:602:16)
 uniE0C6 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:603:5)
 uniE0C6.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:603:16)
 uniE0C7 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:604:5)
 uniE0C7.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:604:16)
 uniE0C8 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:605:5)
 uniE0C8.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:605:16)
 uniE0CA (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:606:5)
 uniE0CA.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:606:16)
 uniE0CC (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:607:5)
 uniE0CC.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:607:16)
 uniE0CD (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:608:5)
 uniE0CD.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:608:16)
 uniE0CE (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:609:5)
 uniE0CE.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:609:16)
 uniE0CF (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:610:5)
 uniE0CF.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:610:16)
 uniE0D1 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:611:5)
 uniE0D1.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:611:16)
 uniE0D2 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:612:5)
 uniE0D2.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:612:16)
 uniE0D4 (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:613:5)
 uniE0D4.stypo (first found at /home/duhowett/cascadia-code/sources/CascadiaCode-Regular.ufo/features.fea:613:16)
"""
aaronbell commented 6 months ago

Huh. That's weird. I didn't think I made any changes to that. I'll have to look into it.

DHowett commented 6 months ago

I suspect it might be this:

@@ -50,9 +51,16 @@ def step_set_font_name(name: str, source: ufoLib2.Font) -> None:

 def step_merge_glyphs_from_ufo(path: Path, instance: ufoLib2.Font) -> None:
+    unicodes = []
+    for glyph in instance:
+        unicodes.append(glyph.unicode)
     ufo = ufoLib2.Font.open(path)
     for glyph in ufo:
-        if glyph.name not in instance:
+        if glyph.unicode:
+            if glyph.unicode not in unicodes:
+                newName = str(hex(glyph.unicode)).upper().replace("0X","uni")
+                instance.layers.defaultLayer.insertGlyph(ufo[glyph.name],newName, overwrite=False, copy=False)
+        else:
             instance.addGlyph(ufo[glyph.name])

I imagine that we have some powerline glyphs that we convert to uniXXXX even if they're already present in the instance.

DHowett commented 6 months ago

The files on disk are named uniE_0B_0.glif -- that suggests one side is expecting lowercase glyph names and the other is expecting uppercase ones? Not sure!

aaronbell commented 6 months ago

Can you give me a requirements file with the pinned dependencies so I can do some test builds on my end?

DHowett commented 6 months ago

Oh, the one checked into the repo should be A-OK as long as you don't regenerate it with pip-compile.

DHowett commented 6 months ago

Alright, I actually think the thing I'm seeing comes from concurrent (?) modification of the designspace document. Serializing the build process (which slows it down immensely, yes) makes that a bit more obvious, and switching to deep copies of the designspace for every processing operation solves it. I'll prepare a PR after a bit more validation...