Bug 478549 - Nerd fonts are not rendered on plasma 6 when using detached font
Summary: Nerd fonts are not rendered on plasma 6 when using detached font
Status: RESOLVED UPSTREAM
Alias: None
Product: konsole
Classification: Applications
Component: font (show other bugs)
Version: 24.01.80
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords: qt6, regression
: 481683 483021 485149 486553 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-15 11:54 UTC by HE7086
Modified: 2024-09-16 23:02 UTC (History)
20 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot-1 (35.78 KB, image/png)
2024-04-15 13:42 UTC, Andrea Ippolito
Details
screenshot-2 (955.93 KB, image/png)
2024-04-15 13:50 UTC, Andrea Ippolito
Details
screenshot-3 (589.02 KB, image/png)
2024-04-15 13:55 UTC, Andrea Ippolito
Details
Penguin works for me (43.32 KB, image/png)
2024-04-29 00:31 UTC, pallaswept
Details
icon glyphs are more readable with patched font (46.35 KB, image/png)
2024-07-08 12:59 UTC, Andrea Ippolito
Details

Note You need to log in before you can comment on or make changes to this bug.
Description HE7086 2023-12-15 11:54:23 UTC
On plasma 6, kde applications cannot render nerd fonts (PUA), if:
* font is set to monospace
* Nerd font is installed separately instead of a patched font, i.e. ttf-nerd-fonts-symbols-mono on arch
* "Symbols Nerd Font Mono" is preferred in fontconfig, e.g. 
```
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Symbols Nerd Font Mono</family>
      <family>hack</family>
    </prefer>
  </alias>
</fontconfig>
```

The exact same configuration works on plasma5, but not on plasma6.
This applies to both konsole and kate, haven't tested other kde applications but I'd assume the same result.
Non-kde applications like foot, wezterm works as expected (fonts rendered).
When using a patched nerd font instead of detached nerd font symbols (e.g. ttf-hack-nerd), fonts are rendered correctly.

related package:
ttf-nerd-fonts-symbols-mono  3.1.1-1
kde-unstable/konsole 24.01.80-1
kde-unstable/kate 24.01.80-1

STEPS TO REPRODUCE
1. install said package
2. set konsole font to monospace
3. echo '\xEF\x90\xBA'

OBSERVED RESULT
tofu

EXPECTED RESULT


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.7-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Comment 1 HE7086 2023-12-15 12:21:12 UTC
Additional information:
fc-match --all monospace | nl | head
     1  Hack-Regular.ttf: "Hack" "Regular"
     2  SymbolsNerdFontMono-Regular.ttf: "Symbols Nerd Font Mono" "Regular"
     3  NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
     4  Hack-Bold.ttf: "Hack" "Bold"
     5  Hack-Italic.ttf: "Hack" "Italic"
     6  Hack-BoldItalic.ttf: "Hack" "Bold Italic"
     7  NotoSansCJK-Regular.ttc: "Noto Sans Mono CJK SC" "Regular"
     8  NotoSansCJK-Bold.ttc: "Noto Sans Mono CJK SC" "Bold"
     9  NotoSansCJK-Regular.ttc: "Noto Sans Mono CJK TC" "Regular"
    10  NotoSansCJK-Bold.ttc: "Noto Sans Mono CJK TC" "Bold"
Comment 2 Luis Bocanegra 2024-02-02 18:25:26 UTC
Found this qt bug report https://bugreports.qt.io/browse/QTBUG-121816 reporter linked this other bug https://bugreports.qt.io/browse/QTBUG-110502 which was fixed by https://code.qt.io/cgit/qt/qtbase.git/commit/?id=a44b6950268214d802bc7ce7df09975261263e31 is that the reason this no longer works? It looks like it is to me
Comment 3 BryanLiang 2024-03-07 02:15:03 UTC
Any updates on this? I meet the same problem after upgrading to Plasma 6 with Konsole 24.02.0 this morning. All the nerd icon become tofu.

Here is the screenshot of the situation: https://sm.ms/image/yNxb94JcBEQfVk5
Comment 4 wgalen 2024-03-08 05:06:44 UTC
I am also encountering this after upgrading to 6.0.1 with Arch. For now, I changed the fixed width font in system settings to a nerd-font patched FiraCode, and that seems to work fine. I suspect that luisbocanegra found the cause, and it appears to be intended behavior.

Can we perhaps get a new setting to control this behavior, or choose a default fallback font? I'd prefer to not have to use patched fonts to get the nerd font symbols if there's a way to make that work without breaking the use case described in QTBUG-110502.
Comment 5 Lorenzo Bettini 2024-03-08 07:17:52 UTC
(In reply to wgalen from comment #4)
> I am also encountering this after upgrading to 6.0.1 with Arch. For now, I
> changed the fixed width font in system settings to a nerd-font patched
> FiraCode, and that seems to work fine. I suspect that luisbocanegra found
> the cause, and it appears to be intended behavior.
> 
> Can we perhaps get a new setting to control this behavior, or choose a
> default fallback font? I'd prefer to not have to use patched fonts to get
> the nerd font symbols if there's a way to make that work without breaking
> the use case described in QTBUG-110502.

Indeed, if I install `ttf-hack-nerd` and then set the "Fixed width" font in System Settings to "Hack Nerd Font 10pt" (the default is "Hack 10pt"), then Konsole shows the nerd font IF you DON'T set any specific font in the profile (it will take the default). The same holds for Kate: DON'T set any font, and it will take the default. As soon as you set a font, either you make sure you select a Nerd font, or it won't work (you experience this bug).
Comment 6 Andrea Ippolito 2024-03-18 11:17:33 UTC
(In reply to wgalen from comment #4)
> I am also encountering this after upgrading to 6.0.1 with Arch. For now, I
> changed the fixed width font in system settings to a nerd-font patched
> FiraCode, and that seems to work fine. I suspect that luisbocanegra found
> the cause, and it appears to be intended behavior.
> 
> Can we perhaps get a new setting to control this behavior, or choose a
> default fallback font? I'd prefer to not have to use patched fonts to get
> the nerd font symbols if there's a way to make that work without breaking
> the use case described in QTBUG-110502.

I agree, especially because the nerds font project only covers some of them.

I like Red Hat Mono for example, and with Plasma 5 I could use that and have KDE apps fallback on the symbols-only package to render missing glyphs without doing any font patching.
Comment 7 Guilherme Silva 2024-03-18 14:26:41 UTC
The change introduced to fix QTBUG-110502 has been reverted: https://codereview.qt-project.org/c/qt/qtbase/+/548651

If that change is actually responsible for this bug, then this should be fixed in the next minor Qt release (I think).
Comment 8 redhawk 2024-04-07 15:41:44 UTC
*** Bug 485149 has been marked as a duplicate of this bug. ***
Comment 9 pallaswept 2024-04-12 03:14:06 UTC
Adding myself to the list of people seeing this bug. Thanks to all for reporting and following up, seems like it may already be taken care of....
Comment 10 pallaswept 2024-04-12 07:23:07 UTC
(In reply to pallaswept from comment #9)
> seems like it may already be taken care of....

Afraid not. I just looked into this and I got the update to qt 6.7 a few days ago, and I still have this bug.
Comment 11 Timothy B 2024-04-14 15:42:20 UTC
*** Bug 481683 has been marked as a duplicate of this bug. ***
Comment 12 Andrea Ippolito 2024-04-15 13:42:53 UTC
Created attachment 168549 [details]
screenshot-1
Comment 13 Andrea Ippolito 2024-04-15 13:43:19 UTC
I thought I'd provide some additional info since I noticed some things lately.

First of all, I can't seem to be able to reproduce this in Konsole, or at least it's not as bad as it used to be right after updating to Plasma 6.

Now I'm using Konsole 24.02.1, KDE frameworks 6.0.0 and QT 6.7.0, and I can select Red Hat Mono as my fixed-width font, and Konsole will render my prompt penguin, home and green check icons just fine (although there is some weirdness still, refer to screenshot-1)
Comment 14 Andrea Ippolito 2024-04-15 13:49:50 UTC
Now, "second of all":

some problems are clearly still visible throughout the whole Plasma UI when it comes to rendering emojis when the variable-width font selected does not contain those glyphs. So again it looks like some existing fallback mechanism has been removed since Plasma 6.

It's simple to reproduce, just choose a font that doesn't come with the "penguin" emoji, e.g. Inter Display, and you will see that it won't render in the toast notification that appears when you copy it from the Emoji Selector. A look at KCharSelect will confirm that this font doesn't have a glyph for the unicode. Refer to screenshot-2
Comment 15 Andrea Ippolito 2024-04-15 13:50:06 UTC
Created attachment 168550 [details]
screenshot-2
Comment 16 Andrea Ippolito 2024-04-15 13:55:07 UTC
And lastly, going back to monospaced fonts, no fallback is happening in the terminal panel of Dolphin.

I don't know if it's a hidden Konsole instance, or a different app/module, but for sure it behaves differently. A glyph that is resolved just fine via fallback in Konsole remains instead unrendered in Dolpin's Terminal panel. Refer to screenshot-3.

All this being considered, I think that this bug should not be filed against Konsole, but against a different, wider-scope project.

I dunno if this logic resides in Frameworks, if someone knowledgeable enough reads this, please set the correct value.

Thanks!
Comment 17 Andrea Ippolito 2024-04-15 13:55:23 UTC
Created attachment 168551 [details]
screenshot-3
Comment 18 Andrea Ippolito 2024-04-15 13:57:39 UTC
(In reply to Andrea Ippolito from comment #14)
> Now, "second of all":
> 
> some problems are clearly still visible throughout the whole Plasma UI when
> it comes to rendering emojis when the variable-width font selected does not
> contain those glyphs. So again it looks like some existing fallback
> mechanism has been removed since Plasma 6.
> 
> It's simple to reproduce, just choose a font that doesn't come with the
> "penguin" emoji, e.g. Inter Display, and you will see that it won't render
> in the toast notification that appears when you copy it from the Emoji
> Selector. A look at KCharSelect will confirm that this font doesn't have a
> glyph for the unicode. Refer to screenshot-2

The same is clearly visible when receiving a KDE Connect + Whatsapp notification for a message containing some fancy emoji.

The plasma notification will say something like "Dude wrote: <gibberish glyph>" instead of showing the actual emoji.

The Emoji Selector copy to clipboard feature is however a much easier way to reproduce.
Comment 19 pallaswept 2024-04-29 00:31:24 UTC
Created attachment 168984 [details]
Penguin works for me
Comment 20 pallaswept 2024-04-29 00:43:07 UTC
(In reply to Andrea Ippolito from comment #13)
> First of all, I can't seem to be able to reproduce this in Konsole

interesting, what you've described is basically the opposite of OP and I. We have failure in konsole (and all apps embedding it, such as dolphin) and not elsewhere... You have it elsewhere but not konsole.... So yours probably should be filed as a separate bug, and maybe refer to this one as being possibly related to it. Perhaps a bug title which encompasses the breadth of this issue might get seen to while this one seems to have fallen though the cracks. This issue title makes the bug seem as though it's limited to one app and one font, and it's not.

I agree with your general idea, there seems to be something broken, deeper than konsole. I've been seeing various reports of failing font fallback all over KDE, ever since plasma 6 dropped - always with "this worked in KDE 5". People always seem to just install a patched font and forget about it, so I guess that helps explain why this isn't getting the attention it otherwise might deserve.
Comment 21 Andrea Ippolito 2024-04-29 06:51:49 UTC
(In reply to pallaswept from comment #19)
> Created attachment 168984 [details]
> Penguin works for me

What is your main font for the UI?

I was using Inter Display (og version, unpatched)
Comment 22 Ilya Fedin 2024-04-29 10:52:46 UTC
> It's simple to reproduce, just choose a font that doesn't come with the "penguin" emoji

Qt still has no real support for emojis, see here: https://wiki.archlinux.org/title/Fonts#Emoji_and_symbols
Comment 23 Andrea Ippolito 2024-04-30 12:41:22 UTC
(In reply to Andrea Ippolito from comment #14)
> Now, "second of all":
> 
> some problems are clearly still visible throughout the whole Plasma UI when
> it comes to rendering emojis when the variable-width font selected does not
> contain those glyphs. So again it looks like some existing fallback
> mechanism has been removed since Plasma 6.
> 
> It's simple to reproduce, just choose a font that doesn't come with the
> "penguin" emoji, e.g. Inter Display, and you will see that it won't render
> in the toast notification that appears when you copy it from the Emoji
> Selector. A look at KCharSelect will confirm that this font doesn't have a
> glyph for the unicode. Refer to screenshot-2

Please disregard this message.
This turned out to be an issue caused by one of the fonts I had installed at user level, full story here:

https://forums.opensuse.org/t/missing-glyphs-problem-with-font-fallback/174633

So it has nothing to do with KDE
Comment 24 Andrea Ippolito 2024-04-30 12:41:47 UTC
(In reply to Andrea Ippolito from comment #16)
> And lastly, going back to monospaced fonts, no fallback is happening in the
> terminal panel of Dolphin.
> 
> I don't know if it's a hidden Konsole instance, or a different app/module,
> but for sure it behaves differently. A glyph that is resolved just fine via
> fallback in Konsole remains instead unrendered in Dolpin's Terminal panel.
> Refer to screenshot-3.
> 
> All this being considered, I think that this bug should not be filed against
> Konsole, but against a different, wider-scope project.
> 
> I dunno if this logic resides in Frameworks, if someone knowledgeable enough
> reads this, please set the correct value.
> 
> Thanks!

Please disregard this message.
This turned out to be an issue caused by one of the fonts I had installed at user level, full story here:

https://forums.opensuse.org/t/missing-glyphs-problem-with-font-fallback/174633

So it has nothing to do with KDE
Comment 25 Nate Graham 2024-05-05 04:05:06 UTC
*** Bug 486553 has been marked as a duplicate of this bug. ***
Comment 26 Nate Graham 2024-05-05 04:05:44 UTC
*** Bug 483021 has been marked as a duplicate of this bug. ***
Comment 27 regunakyle 2024-05-05 11:13:05 UTC
Hi, since the bug is apparently fixed in upstream, it should also be fixed in the coming KDE 6.1 release, right?
Comment 28 Ilya Fedin 2024-05-05 15:47:47 UTC
Qt is not a part of KDE release so not right
Comment 29 postix 2024-05-05 15:53:57 UTC
(In reply to regunakyle from comment #27)
> Hi, since the bug is apparently fixed in upstream (...)

Can you please share the link to the upstream fix?
Comment 30 BryanLiang 2024-05-06 12:54:32 UTC
(In reply to postix from comment #29)
> (In reply to regunakyle from comment #27)
> > Hi, since the bug is apparently fixed in upstream (...)
> 
> Can you please share the link to the upstream fix?

Here is the link: https://codereview.qt-project.org/c/qt/qtbase/+/548651
Comment 31 Nate Graham 2024-05-06 21:04:33 UTC
If someone could figure out which exact versions of Qt it landed in, that would be amazing. I don't know how to get that information myself.
Comment 32 pallaswept 2024-05-06 21:10:42 UTC
(In reply to Nate Graham from comment #31)
> If someone could figure out which exact versions of Qt it landed in, that
> would be amazing. I don't know how to get that information myself.

I'm looking at the source for 6.7, and the above change is not in it. So, I guess it'll be in the next version.
Thanks for looking at this for us Nate!
Comment 33 HE7086 2024-05-06 21:27:19 UTC
(In reply to Nate Graham from comment #31)
> If someone could figure out which exact versions of Qt it landed in, that
> would be amazing. I don't know how to get that information myself.

The problem was introduced in commit fc33fea999365c36ed446eee0db0d59d94be306b, and is present in:
6.6.0 ~ 6.6.3; 6.7.0 ~ 6.7.1
And the commit that revert it is 4913511d3bf8ec7838f80fbfe92c0fe900b2f003, which at the moment is only present in dev branch.

P.S. you can quickly check this by `git branch --all --contains=fc33fea999365c36ed446eee0db0d59d94be306b`
Comment 34 Ilya Fedin 2024-05-06 21:31:15 UTC
Nate, it's in 6.7.1 (not in 6.7.0!) and it's easy to get that by copying the commit hash from gerrit and opening it on github (https://github.com/qt/qtbase/commit/<HASH>). It shows the branches and tags the commit is on but only tags (starting with v) are really relevant.
Comment 35 pallaswept 2024-07-07 01:37:10 UTC
Finally had a chance to test this, using Qt 6.7.2, the symbols-only nerd font is used as a fallback for all other fonts, as expected. Other font substitutions also appear to be functioning as intended. This seems fixed to me. Thanks for the help everyone.
Comment 36 Andrea Ippolito 2024-07-08 12:58:36 UTC
(In reply to pallaswept from comment #35)
> Finally had a chance to test this, using Qt 6.7.2, the symbols-only nerd
> font is used as a fallback for all other fonts, as expected. Other font
> substitutions also appear to be functioning as intended. This seems fixed to
> me. Thanks for the help everyone.

Do nerd fonts glyph look bigger on your end as well, if you are using a patched font?

On my side they are displayed again even if using an unpatched font, but they take up 1 character width, whereas with patched fonts it seems like they take up two if needed (which looks more pleasing as they are more distinguishable).

Attaching a screenshot with:
- above: Lilex Nerd Font (patched) from here: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Lilex.zip
- below: Roboto Mono (unpatched) + Symbols only Nerd font
Comment 37 Andrea Ippolito 2024-07-08 12:59:26 UTC
Created attachment 171477 [details]
icon glyphs are more readable with patched font
Comment 38 pallaswept 2024-07-08 13:28:08 UTC
(In reply to Andrea Ippolito from comment #36)
> Do nerd fonts glyph look bigger on your end as well, if you are using a patched font?

They do. This is because the Symbols Only Nerd Font release package contains both the regular `Nerd Font` which is double-width, and the `Nerd Font Mono` variant which is strictly single-width for terminal compatibility and fontconfig compliance. Fontconfig prefers the latter. 

You could likely configure it to prefer the double wide version so you can avoid the need to patch fonts, or remove the mono NF if you will never need it... I'll leave it to your imagination :) But don't worry, what you're seeing is normal.
Comment 39 pallaswept 2024-09-16 23:02:14 UTC
(In reply to Andrea Ippolito from comment #36)
> Do nerd fonts glyph look bigger on your end as well, if you are using a
> patched font?
> 
> On my side they are displayed again even if using an unpatched font, but
> they take up 1 character width, whereas with patched fonts it seems like
> they take up two if needed (which looks more pleasing as they are more
> distinguishable).

FYI I have escalated this: https://github.com/ryanoasis/nerd-fonts/issues/1713
If that FR is approved, then distros should be able to more easily ensure the two-character font is used.
I put my workaround in there if anyone needs it in the meantime.
Hope that helps