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: REPORTED
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
: 481683 485149 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-15 11:54 UTC by HE7086
Modified: 2024-04-29 10:52 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In:


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

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 luisbocanegra 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