5

Nerd Fonts in KDE Plasma 6

 1 month ago
source link: https://www.lorenzobettini.it/2024/03/nerd-fonts-in-kde-plasma-6/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Nerd Fonts in KDE Plasma 6

As I have written, I’m using “Oh-My-Zsh” with Nerd icons and fonts. It has always worked perfectly in KDE.

A few days ago, KDE Plasma 6 landed in Arch (and thus, EndeavourOS), and after upgrading, the Nerd fonts were not displayed in Konsole and Kate (and, I guess, in other KDE applications).

For example, before upgrading, Konsole looked like that:

konsole-plasma-5.png?resize=625%2C427&ssl=1

After upgrading all the nice Nerd fonts were gone:

konsole-plasma-6.png?resize=625%2C394&ssl=1

I reported that on the EndeavourOS forum and linked the corresponding KDE bug. It looks like it is due to an intentional change in Qt6. The Qt6 issue is https://bugreports.qt.io/browse/QTBUG-110502. The issue was fixed here: https://code.qt.io/cgit/qt/qtbase.git/commit/?id=a44b6950268214d802bc7ce7df09975261263e31, leading to this new behavior, which breaks the old behavior.

Long story short, before, when a font did not provide support for a “glyph”, that missing glyph was looked up in other fonts. After that change, that does not happen anymore.

The default monospace font in KDE is “Hack”. I have installed other Nerd fonts, but not the “Hack Nerd” version, so what worked before the upgrade no longer works.

To fix the problem, I Installed the nerd font, e.g., for Hack (the default KDE font):

sudo pacman -S ttf-hack-nerd

Then, open “System Settings” -> “Fonts”, and change the “Fixed width” font from the default “Hack 10pt” to the corresponding Nerd font:

change-to-Nerd-font-1.png?resize=625%2C472&ssl=1

change-to-Nerd-font-2.png?resize=625%2C476&ssl=1

Restart Konsole and the Nerd fonts are back:

konsole-plasma-6-fixed.png?resize=625%2C394&ssl=1

Note that this works if your Konsole profile does not have a custom font set; if you use another font, you’ll have to use the Nerd font corresponding to that font.

For example, I used JetBrains fonts in another Konsole profile, but I hadn’t installed the Nerd version:

extra/ttf-jetbrains-mono 2.304-1 [installed]
   Typeface for developers, by JetBrains
extra/ttf-jetbrains-mono-nerd 3.1.1-1 (nerd-fonts)
   Patched font JetBrains Mono from nerd fonts library

I installed the Nerd version and changed the font from simply “JetBrains” to the Nerd version, and also, this profile was fixed:

konsole-jetbrains.png?resize=625%2C425&ssl=1

The same holds for other KDE applications like Kate. If you haven’t set a custom font, then the Nerd version of Hack will be automatically used. Otherwise, you have to use the Nerd version of the specified font.

Note that other non-Qt applications will not be affected by this change. For example, for Alacritty, I have this section in its configuration:

[font]
size = 10.0
[font.bold]
family = "JetBrains Mono NL"
style = "Bold"
[font.bold_italic]
family = "JetBrains Mono NL"
style = "Bold Italic"
[font.italic]
family = "JetBrains Mono NL"
style = "Italic"
[font.normal]
family = "JetBrains Mono NL"
style = "Regular"

So, I simply specify JetBrains, not its Nerd version. Still, when icons and other glyphs are to be rendered, they are automatically taken from any Nerd font providing those glyphs:

alacritty-plasma-6.png?resize=625%2C509&ssl=1

Good-looking Nerd fonts are back! 🙂

Like this:

Loading...

Related


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK