pop-os / cosmic-term

WIP COSMIC terminal emulator
GNU General Public License v3.0
296 stars 38 forks source link

Unable to add Nerd Fonts #226

Open Coder-Vasen opened 1 week ago

Coder-Vasen commented 1 week ago

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

GrownPlanet commented 1 week ago

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