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

Add font Zed Mono #1504

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Add font Zed Mono #1504

merged 3 commits into from
Apr 2, 2024

Conversation

cabrinha
Copy link
Contributor

@cabrinha cabrinha commented Feb 1, 2024

Description

Added a new font: "Zed Mono"

Requirements / Checklist

What does this Pull Request (PR) do?

Adds a new font

How should this be manually tested?

Any background context you can provide?

https://zed.dev/

zed-industries/zed-fonts#10

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

Screenshot 2024-02-01 at 6 38 35 PM

@cabrinha
Copy link
Contributor Author

cabrinha commented Feb 1, 2024

I will add some screenshots once I get this working, right now the script is giving me an error:

❯ NERDFONTS='--debug 2 --makegroups 4 --dry' ./gotta-patch-em-all-font-patcher\!.sh -j "/ZedMono"
# [Nerd Fonts]  Filter given, limiting search and patch to pathname pattern '/ZedMono'
# [Nerd Fonts]  Total source fonts found: 0
# [Nerd Fonts]  Invalid release timestamp SOURCE_DATE_EPOCH: 1706817961

Anything wrong with my PR? I did add many subdirectories under src/unpatched-fonts/ZedMono, including Bold, Light, etc... There is just nothing in them because the script hasn't run.

Edit: Seems like this is the issue: #1505

Using the docker method now:

docker run --rm -v "${PWD}/src/unpatched-fonts/ZedMono:/in:Z" -v "${PWD}/patched-fonts/ZedMono:/out:Z" nerdfonts/patcher --complete --makegroups 4

I'm not sure of the correct way to arrange these subfolders, so let me know if anything needs to change.

@cabrinha
Copy link
Contributor Author

cabrinha commented Feb 7, 2024

@Finii let me know if there are any changes I need to make here.

@rafa-hover
Copy link

@cabrinha Thanks for working on this!

@Blankeos
Copy link

@cabrinha Thanks for working on this! Still waiting for this to be released haha. Zed Mono has become my favorite font. I'm planning to just use this PR and install the fonts from there. Do I need to run anything (run a build or something) or will the patched .ttf work out-of-the-box?

@arlyon
Copy link

arlyon commented Mar 15, 2024

I downloaded this and don't see any difference between iosevka.

Screenshot 2024-03-15 at 16 24 28 Screenshot 2024-03-15 at 16 24 34 Screenshot 2024-03-15 at 16 24 42

Notice how the bundled font in zed looks wider

@Blankeos
Copy link

@arlyon So it works. Even works for the native MacOS Terminal (It has no fallback fonts unlike VSCode). Also got it to work on VSCode.

By the way, "Zed Mono" by itself does look 'weird' in my opinion because it looks too thin. I prefer the "Extended" version because it makes it have almost the character spacing as JetBrains.

image

Steps I did to get this:

  1. I clicked on @cabrinha's remote forked repo.
  2. I went to nerd-fonts/patched-fonts/ZedMono/Extended (I only download the Extended)
  3. I copied the URL and went to a third-party app to download the directory.
  4. Installed the fonts.
  5. And just put them on VSCode and my Terminal.
  6. Notice how on VSCode, I'm only using "ZedMono Nerd Font" and not "ZedMono Nerd Font Extended". A little weird yeah but I guess it helps that I didn't really install the regular, thinner patched Zed Mono font? If I would have, it might have the same result as yours @arlyon.

@Finii
Copy link
Collaborator

Finii commented Mar 15, 2024

@Finii let me know if there are any changes I need to make here.

Thanks for the PR!

Well, what is special with this font, as we have some Iosevkas already?

image

arlyon commented:

I downloaded this and don't see any difference between iosevka.

And

So it works. Even works for the native MacOS Terminal (It has no fallback fonts unlike VSCode). Also got it to work on VSCode.

Better be! If the patch would not work that would be a bug in the Nerd Font patcher that needs fixing :->

This font seems to have some interest, but to consider it someone should point out the advantages/differences to a regular Iosevka.

Btw 'extended', iirc there is a feature request to include some Iosevka extended for the same reason as Blankeos'.

@arlyon
Copy link

arlyon commented Mar 15, 2024

The font bundled in zed does look nicer (imo) than iosevka. It's a little wider but I have not managed to get them to look the same in my editor.

For a comparison compare the first screenshot in my first comment with the others.

@Blankeos
Copy link

Blankeos commented Mar 23, 2024

@cabrinha I'm getting this issue with the font currently. Italic variant of ZedMonoNF-Extended doesn't seem to use ZedMonoNF-ExtendedItalic.

It seems to use ZedMonoNF-Italic instead.

⚠️ The issue:

image

🤔 Ideally italics should look like this when using ZedMonoNF-Extended

image

🥳 EDIT (FIXED!): If you're running into this issue too and wondering how to fix it:

JUST USE ZedMono NF Extended. I was freaking wondering why it wasn't working for VSCode but it worked fine on my terminal lmfao.

❌ My mistake: When I was opening the font on Font Book, I just saw ZedMonoNF-Extended on PostScript Name and used that. But actually it should be Unique Name that I'd use. (The MacOS terminal also uses that)
image

✅ Here's the final VSCode setting I have for this:
image

@cabrinha
Copy link
Contributor Author

Resolved conflicts. Let me know if there is anything else I need to do to get this merged @Finii

@Finii
Copy link
Collaborator

Finii commented Mar 28, 2024

Zed seems to be a bit more roundish, at least compared to our regular Iosevka:

image

@Finii
Copy link
Collaborator

Finii commented Mar 28, 2024

Rebase on master, force push.

There are some errors in the font database file fonts.json, fixed en passant.

Are really all these versions needed?

  • Maybe drop Oblique?
  • Maybe drop some weights (see image below)
    • Thin (who can use that in a terminal?)
    • ExtraLight
    • SemiBold
    • Heavy

image

Edit:

I must admit I'm not very convinced that this font should be included.
It is 'just another' Iosevka clone. It has a commercial background. It is not on programmingfonts (albeit in the initial PR it said it is, but that false information obviously).

@Finii
Copy link
Collaborator

Finii commented Mar 28, 2024

@Blankeos

But actually it should be Unique Name that I'd use

Well, you need to specify the Family Name of the font, as it says in the option.

@Finii
Copy link
Collaborator

Finii commented Mar 28, 2024

Upstream has not even the version right in the font file 😭
This is supposed to be 1.2.0?

One times, work with professionals...

image
image

@Finii Finii changed the title feat(font): New font Zed Mono Add font Zed Mono Mar 28, 2024
bin/scripts/lib/fonts.json Outdated Show resolved Hide resolved
@Finii Finii added this to the v3.2.0 milestone Mar 30, 2024
@Finii Finii added the Ready ⛱ Ready to merge but waiting to be merged near a release label Mar 30, 2024
@Finii
Copy link
Collaborator

Finii commented Mar 30, 2024

Unfortunately we got a Cask clash...

My mistake, there is no problem

This squashes also these commits:

* ds-store
* ZedMono: Clean up files
  Remove files that should not be in the PR, because they are autocreated
  or belong somewhere else.
* Also divide Extended and non-Extended versions.
* ZedMono: Fix metadata
* ZedMono: Fix some metadata
* ZedMono: Drop some more exotic weights and restructure dirs

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

Finii commented Mar 31, 2024

Hmm, I don't get it

before the commit above:

here the order is ok

./Noto/Serif/NotoSerifNerdFont-ExtraCondensedExtraBoldItalic.ttf

and here it is not

DEBUG: =====> Filename 'ZedMonoNerdFont-ExtraBoldExtendedOblique.ttf'

Need to investigate that more...

@Finii
Copy link
Collaborator

Finii commented Mar 31, 2024

======== NotoSansMono_Condensed-ExtraBold.ttf ========
SFNT Fullname      ID 4     Noto Sans Mono Condensed ExtraBold
SFNT Family        ID 1     Noto Sans Mono Condensed ExtraBold
SFNT SubFamily     ID 2     Regular
SFNT Pref Family   ID 16    Noto Sans Mono Condensed
SFNT Pref Styles   ID 17    ExtraBold
SFNT PS Name       ID 6     NotoSansMonoCondensed-ExtraBold
======== zed-mono-extendedextrabolditalic.ttf ========
SFNT Fullname      ID 4     Zed Mono Extrabold Extended Italic
SFNT Family        ID 1     Zed Mono Extrabold Extended
SFNT SubFamily     ID 2     Italic
SFNT Pref Family   ID 16    Zed Mono
SFNT Pref Styles   ID 17    Extrabold Extended Italic
SFNT PS Name       ID 6     Zed-Mono-Extrabold-Extended-Italic

Hmm.

    known_widths = { # can take modifiers
        'Compressed': ('Cm', 'Comp'),
        'Extended': ('Ex', 'Extd'),
        'Condensed': ('Cn', 'Cond'),
        'Narrow': ('Nr', 'Narrow'),
        'Compact': ('Ct', 'Compact'),
    }

All other fonts we patch that have a width specifier have that width first in their name.
Only Zed has not.
Adding the sorting changes the name for Zed and nor for any other. 👍

Examples

  • ../src/unpatched-fonts/Noto/Serif/NotoSerif_ExtraCondensed-LightItalic.ttf
    SFNT Fullname ID 4 Noto Serif ExtraCondensed Light Italic
    SFNT PS Name ID 6 NotoSerifExtraCondensed-LightItalic
  • ../src/unpatched-fonts/Noto/Sans-Mono/NotoSansMono_SemiCondensed-ExtraLight.ttf
    SFNT Fullname ID 4 Noto Sans Mono SemiCondensed ExtraLight
    SFNT PS Name ID 6 NotoSansMonoSemiCondensed-ExtraLight
  • ../src/unpatched-fonts/3270/Condensed/3270Condensed-Regular.ttf
    SFNT Fullname ID 4 IBM 3270 Condensed
    SFNT PS Name ID 6 3270Condensed
  • ../src/unpatched-fonts/MartianMono/Cn/MartianMono-CondensedRegular.ttf
    SFNT Fullname ID 4 Martian Mono Cn Rg
    SFNT PS Name ID 6 MartianMono-CnRg
  • ../src/unpatched-fonts/Ubuntu/Condensed/Ubuntu-C_modified.ttf
    SFNT Fullname ID 4 Ubuntu Condensed
    SFNT PS Name ID 6 UbuntuCondensed-Regular

Counterexample

  • ../src/unpatched-fonts/ZedMono/Extended/zed-mono-extendedextraboldoblique.ttf
    SFNT Fullname ID 4 Zed Mono Extrabold Extended Italic
    SFNT PS Name ID 6 Zed-Mono-Extrabold-Extended-Italic

@Finii
Copy link
Collaborator

Finii commented Mar 31, 2024

image

😭

[why]
When we add a dummy we need to remove that later on.

Originally that has been introduces to avoid a wrong code duplication
warning.

See how the blank leaks into the name:

ERROR: ====-< Family (ID 1)      too long (38 > 31): ZedMono Nerd Font Extended ExtraBold
DEBUG: =====> SubFamily (ID 2)   ok       ( 6 <=31): Italic
DEBUG: =====> Fullname (ID 4)    ok       (45 <=63): ZedMono Nerd Font Extended ExtraBold   Italic
DEBUG: =====> PSN (ID 6)         ok       (33 <=63): ZedMonoNF-ExtendedExtraBoldItalic
DEBUG: =====> PrefFamily (ID 16) ok       (17 <=31): ZedMono Nerd Font
DEBUG: =====> PrefStyles (ID 17) ok       (27 <=31): Extended ExtraBold   Italic
DEBUG: =====> PrefStyles (ID 17) ok       (27 <=31): Extended ExtraBold   Italic
DEBUG: =====> Filename 'ZedMonoNerdFont-ExtendedExtraBoldItalic.ttf'

(Note trailing blanks even in ID 1.)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Usually we want the width before the weight:

ZedMono Nerd Font Extended ExtraBold Italic

but we get:

ZedMono Nerd Font ExtraBold Extended Italic

The reason is that we do not sort widths and weights and handle them as
one list, keeping the original order.

All fonts but Zed have the width before the weight and it never turned
up

[how]
Handle widths and weights on their own and only afterwards concattenate
width (first) to weights (second).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii merged commit 8bf4989 into ryanoasis:master Apr 2, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❲Aa❳ new font Ready ⛱ Ready to merge but waiting to be merged near a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants