cosmic-term icon indicating copy to clipboard operation
cosmic-term copied to clipboard

Unable to add Nerd Fonts

Open Coder-Vasen opened this issue 1 year ago • 9 comments

I am new to cosmic environment. The terminal in cosmic environment looks great however I use nvChad as my everyday tool. NvChad uses Nerd fonts but in cosmic terminal I couldn't able to find a way to change my terminal font to nerd font. It is showing options only with pre-loaded fonts inside the View > Settings > Font

Screenshot

Coder-Vasen avatar Jun 17 '24 08:06 Coder-Vasen

This is probably because they don't have normal and bold wights and a Stretch::Normal face. When commenting out the code in the file main lines 1348 until 1356 my nerd fonts show up in the config!

src/main.rs line 1345

// only keep fonts that have both NORMAL and BOLD weights with both having
// a `Stretch::Normal` face.
// This is important for fallbacks.
font_name_faces_map.retain(|_, v| {
    let has_normal = v
        .iter()
        .any(|face| face.weight == Weight::NORMAL && face.stretch == Stretch::Normal);
    let has_bold = v
        .iter()
        .any(|face| face.weight == Weight::BOLD && face.stretch == Stretch::Normal);
    has_normal && has_bold
});
font_name_faces_map

here you can see the fonts showing up: screenshot_fonts

Maybe you could try to install the font's bold and normal styles? edit: I tried it with a nerd font and that works :) edit 2: also make sure you have a mono-spaced font

GrownPlanet avatar Jun 18 '24 16:06 GrownPlanet

having this problem as well, it basically makes zellij look terrible haha

luccahuguet avatar Jul 31 '24 14:07 luccahuguet

Same thing here. It'd be really cool if cosmic-term supported nerd fonts.

PhoenixPhantom avatar Oct 22 '24 12:10 PhoenixPhantom

Same issue here. I want to use the 0xProto Nerd font in the Cosmic terminal and it is not an option... screenshot-2024-11-01-20-38-12

That being said, I see it as option for the system's font. screenshot-2024-11-01-20-37-07

alexlangev avatar Nov 01 '24 20:11 alexlangev

Thanks @GrownPlanet for posting the solution!

Since I hit a few snags along the way and others seem to struggle as well, I would try to add a little more guidance:

NerdFonts come in different varieties and even if their names contain Mono, as in JetBrainsMono, it does not mean that all their varieties are strictly mono-spaced, so COSMIC Term will not recognize them (see @GrownPlanet's explanation and here).

One way to pick the right varieties is using the install script.

Download install.sh and your preferred font(s).

Now you will have to imitate the directory structure. It should look like this:

nerd-fonts-or-your-preferred-name/
├─ install.sh
├─ patched-fonts/
│  ├─ CascadiaCode/
│  ├─ CascadiaMono/
│  ├─ JetBrainsMono/
│  ├─ ...

Where JetBrainsMono is just the untared folder from JetBrainsMono.tar.xz from the release page.

Now you can simply install the fonts:

# user
./install.sh -s JetBrainsMono CascadiaCode CascadiaMono

or

# system-wide
sudo ./install.sh -s -S JetBrainsMono CascadiaCode CascadiaMono

The key here is -s. This chooses the strictly mono-spaced version which will be recognized by COSMIC Terminal.

randomchars42 avatar Jan 01 '25 19:01 randomchars42

@randomchars42 For NvChad, it is a requirement to use a non-monospace version of a NerdFont. In gnome-terminal, which is used in Pop_OS 22.04, non-monospace Nerd Fonts are recognized. So I think they should be able to be recognized in cosmic-term as well.

s11s11 avatar Jan 15 '25 06:01 s11s11

I am also experiencing this issue and it's the main thing preventing me from switching to cosmic terminal fully.

jawadcode avatar Mar 28 '25 01:03 jawadcode

I am also experiencing this issue and would like more font options.

phlepper avatar Apr 08 '25 07:04 phlepper

Thanks @randomchars42 and @GrownPlanet for posting the solution! Worked for me.

Denifia avatar Apr 08 '25 12:04 Denifia

@Coder-Vasen It seems to work now on the latest version of cosmic-term. Does it work for you?

s11s11 avatar Sep 19 '25 17:09 s11s11

@Coder-Vasen It seems to work now on the latest version of cosmic-term. Does it work for you?

I use arch btw ;)

Coder-Vasen avatar Sep 20 '25 17:09 Coder-Vasen