Bug 445209 - fontfamily: "monospace" results in non-monospace font used in sections "Devices: CPU, Interrupts, SMART Details"
Summary: fontfamily: "monospace" results in non-monospace font used in sections "Devic...
Status: RESOLVED NOT A BUG
Alias: None
Product: kinfocenter
Classification: Applications
Component: general (show other bugs)
Version: 5.23.2
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-09 14:23 UTC by postix
Modified: 2022-06-08 08:59 UTC (History)
4 users (show)

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


Attachments
Screenshot: Left Kate, Right Info Center (935.86 KB, image/png)
2021-11-09 14:23 UTC, postix
Details
`fc-match monospace -s` (4.31 KB, text/plain)
2021-11-19 13:16 UTC, postix
Details
Screenshot: Systemsettings, fontselection Dialog (146.86 KB, image/png)
2021-11-19 13:18 UTC, postix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2021-11-09 14:23:35 UTC
Created attachment 143369 [details]
Screenshot: Left Kate, Right Info Center

STEPS TO REPRODUCE
1) Open Info Center
2) Click in section "Detailed Information" on "Devices"
3) Click on "SMART Status"
4) Pick on of your drives and click on "Detailed Information"
5) Copy the result into Kate

OBSERVED RESULT
The report is hard to read in Info Center as they indention are not correct.
However, the necessary information is there since, when you select and paste the report into Kate, it shows the indention just fine.

Please see the screenshot.

EXPECTED RESULT
Correctly indented text in Info Center.


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20211106
KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Comment 1 Nate Graham 2021-11-09 21:59:54 UTC
Looks like it's using a variable-width font when it should be using a fixed-width font.
Comment 2 Harald Sitter 2021-11-15 08:02:01 UTC
https://invent.kde.org/plasma/plasma-disks/-/blob/afc0180990f2e6f944bfa313e9b5682ea4992594/src/kcm/package/contents/ui/ReportPage.qml#L15

Surely your system has as non-monospace font configured as monospace font?
Comment 3 postix 2021-11-15 10:48:20 UTC
(In reply to Harald Sitter from comment #2)
> Surely your system has as non-monospace font configured as monospace font?

Nope, it should be fine as in Kate or Konsole: I use `Hack 9pt`, which is a monospace font, for the fixed font size.
Comment 4 postix 2021-11-15 11:17:42 UTC
Let me change this bug to the more general "kinfocenter", as I experience the same issue also for `Devices: "CPU" and "Interrupts"`.
Comment 5 postix 2021-11-15 11:32:18 UTC
It looks like it ignores the monospace font setting from Systemsettings: Whatever I choose there and restart KInfocenter, the font looks all the same in these subsections.
Comment 6 postix 2021-11-15 11:38:23 UTC
(In reply to postix from comment #3)
> (In reply to Harald Sitter from comment #2)
> > Surely your system has as non-monospace font configured as monospace font?

Sorry, one coffee more this Monday morning: Surely the setting of the Systemsettings has nothing to do with it. In
```
/usr/share/kpackage/kcms/plasma_disks/contents/ui/ReportPage.qml
```
I have manually changed `font.family: "monospace"` to `font.family: "hack"`, restarted the KInfocenter and the bug has vanished for the report page. 

Though, I have a font called `monospace` installed though (which I can choose in Systemsettings). Why doesn't it work with that default one?
Comment 7 Harald Sitter 2021-11-19 12:24:43 UTC
What's the complete output of

`fc-match monospace -s`
Comment 8 Harald Sitter 2021-11-19 12:30:40 UTC
Oh, actually, you have a font called monospace?  Why surely that gets used here.

This would break all sorts of things. 'monospace' is a well defined alias in fontconfig referring to the monospace fonts list. I'm honestly not sure we can do anything about this malfunctioning if you have a font called monospace, longer term a bit better API would help but in the end that font always conflicts with the fontconfig alias.
Comment 9 postix 2021-11-19 13:16:33 UTC
Created attachment 143728 [details]
`fc-match monospace -s`

Answer to Comment 7
Comment 10 postix 2021-11-19 13:18:13 UTC
Created attachment 143729 [details]
Screenshot: Systemsettings, fontselection Dialog

(In reply to Harald Sitter from comment #8)
> Oh, actually, you have a font called monospace?  Why surely that gets used
> here.

According to `fc-match monospace -s` no, but there's a font called "Monospace" in the font selection dialog in the Systemsettings, which can be seen in the screenshot.
Comment 11 Harald Sitter 2021-11-19 13:53:10 UTC
What I think we are seeing is that Monospace is a font and so fc-match -s gives us the fallback list. Which makes sense, since your Monospace is a sans serif font so its first fallback is the default sans font (Noto).

I would suggest that you try finding and removing the monospace ttf, logout and back in and see if that helps at all. In any even it's not really a kinfocenter bug since fc-match clearly resolves a sans fonts. So, that may be a fontconfig problem, but really the fact that you have a font called the name of a font family and then not even be member of that family is 9 types of edge case all at once. Like if Monospace was actually monospace we'd probably never have noticed.
Comment 12 postix 2021-11-19 14:25:54 UTC
> I would suggest that you try finding and removing the monospace ttf

I have searched and found the reason: When I had set up 
```
~/.config/fontconfig/fonts.conf
```
to use preferably `Noto Sans` and `Noto Color Emoji` in order to correctly display Emojis across Plasma, I had accidentally entered both too for the `monospace` font family. 

Riddle solved and sorry again for this stupid mistake!
Comment 13 postix 2021-11-19 14:33:18 UTC
And finally thank you all for your help and hints as always!