Bug 412636 - gtk-font-name with localized name saved in literal bytes.
Summary: gtk-font-name with localized name saved in literal bytes.
Status: RESOLVED FIXED
Alias: None
Product: kde-gtk-config
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: 5.12.8
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Manuel Tortosa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-05 14:48 UTC by Clementine
Modified: 2019-10-07 02:38 UTC (History)
2 users (show)

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


Attachments
The saved gtk3 config file (327 bytes, text/plain)
2019-10-05 14:48 UTC, Clementine
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clementine 2019-10-05 14:48:36 UTC
Created attachment 123036 [details]
The saved gtk3 config file

SUMMARY

Kde-gtk-config does not handle fonts with localized name or localized style. It saves the config it ~/.config/gtk-3.0/settings.ini. Though the file is a utf-8 encoded text file, it seems like the writer just treat the font name & style as bytes, and literally saves the representation of bytes as strings.

For example, I used a font whose style in in Chinese, "常规"(Regular) is saved in the file as "\xe5\xb8\xb8\xe8\xa7\x84". Following python3 terminology, b"\xe5\xb8\xb8\xe8\xa7\x84" is a bytes when "常规" is encoded with UTF-8, but the config writer somehow directly casts the byte representation "\xe5\xb8\xb8\xe8\xa7\x84" as string in the config file. Which cause GTK3 programs not to recognize the font settings.

By the way, on openSUSE 42.3 with KDE 5.8.7, it correctly saves the font style as "常规" in the config file.

for example, Typora which uses GTK theme settings.

(Typora:8195): Gtk-WARNING **: Error setting gtk-font-name in /home/username/.config/gtk-3.0/settings.ini: Key file contains key “gtk-font-name” which has a value that cannot be interpreted.

STEPS TO REPRODUCE
1. OS being OpenSUSE 15.1 or other distro using KDE 5.12.8. 
2. Set the GTK font with kde-gtk-config to a font with localized font name or font style.
3. Check the gtk3 config file in ~/.config/gtk-3.0/settings.ini.

OBSERVED RESULT

The localized font name or style is saved in literal representation of bytes.

EXPECTED RESULT

The font name and style are identical to what you see in the kde-gtk-config setting page.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.12.8
(available in About System)
KDE Plasma Version: 5.12.8
KDE Frameworks Version: 5.55.0
Qt Version: 5.9.4

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2019-10-07 02:38:59 UTC
Should be fixed in Plasma 5.17 (released in 9 days).