nwg-piotr / nwg-look

GTK3 settings editor adapted to work in the wlroots environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fonts are set by display name instead of font family name

Lassebq opened this issue · comments

Font displays as "None" if the specified font family is different from display name

So, let's say there's 'JetBrainsMono NF SemiBold 12', but there's also 'JetBrainsMono Nerd Font SemiBold 12'
Even though both variants properly change the displayed font in GTK, only first option works properly with Java Swing (If it's using GTK look and feel).
It seems to only fork if there's a font with exact family name in fc-list

Here are the lines where this issue originates from:

https://github.com/nwg-piotr/nwg-look/blob/main/uicomponents.go#L245
https://github.com/nwg-piotr/nwg-look/blob/main/uicomponents.go#L247

Attached screenshot with the demonstration of the issue:
Top screenshot: Swing properly changes font, but nwg-look's font selector displays it as "None"
Bottom screenshot: Swing fallsback to using another font, but the font in nwg-look is properly shown
image
image

If the fonts were set by family name (which is shown in fc-list) instead of display name, that would also fix fonts in java applications.

I'm not sure what you'd like me to change here. We use the FontChooser type, and it has only 2 functions: GetFont() and SetFont(). We have no influence on what the GetFont() function returns.

I'm not sure, I was also told "Nerd Font" is a deprecated name and should instead be "NF". Perhaps there's some font cache that FontChooser uses? Which is why it still uses old name?

And considering it gets the wrong string in the API itself, I guess this issue can be closed?

GTK3 has still its bugs and oddities. To my surprise they're still being fixed. For now I don't think I can do something about your issue.

I guess this issue can be closed?

I think so.