Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font selection issue #2567

Closed
DarthGandalf opened this issue Nov 20, 2023 · 6 comments · Fixed by #2574
Closed

Font selection issue #2567

DarthGandalf opened this issue Nov 20, 2023 · 6 comments · Fixed by #2574

Comments

@DarthGandalf
Copy link
Member

Gentoo Linux amd64, version 4a51c0e
Qt 5.15.11

Выделение_488

I was trying to report for #2566 which font I'm using , and clicked the Verdana button on the screenshot. The button has the same font as what I'm actually using. However, the font selection window claims that I have different font settings - the window claims Bold, while I'm using Italic.

@DarthGandalf
Copy link
Member Author

In main.kvc this looks like fontApplication=Verdana,10,0,50,i for almost all fonts. fontNotifierTitle=Verdana,10,0,75,bi has the other value

@ctrlaltca
Copy link
Contributor

I think the configuration part of the code is fine, since the font is correctly shown in the "Verdana" button.
You can check the value of fontInput for that specific value.
The "select font" dialog is a plain QFontDialog loading the font currently being used by the "Verdana" button:

QFont tmp = QFontDialog::getFont(&bOk, m_pButton->font());

I'm not sure what is causing this issue.

@DarthGandalf
Copy link
Member Author

This looks similar to https://forum.qt.io/topic/69152/qfontdialog-getfont-doesn-t-use-correct-font-style/11

Before clicking the button font.toString() returns "Verdana,10,-1,0,50,1,0,0,0,0", but after selecting the correct style in the dialog and clicking Ok the font becomes "Verdana,10,-1,0,50,1,0,0,0,0,Курсив" - and from now clicking the button selects the correct style. The only difference between the two strings is the localized name of the style in the last element.

@DarthGandalf
Copy link
Member Author

It works correctly when I run with LC_ALL=C

@ctrlaltca
Copy link
Contributor

Added a possible fix in #2568
Seems like some fonts like Verdana includes localized version of the "style name", and is confusing QFontDialog.

@ctrlaltca
Copy link
Contributor

The fix introduced a new bug.
KviCString tokenizer skips empty elements, so if one field in the option string is empty it will get the next one.

"Courier 10 Pitch,10,5,50,,"
family=Courier 10 Pitch pointSize=10 styleHint=5 weight=50 options=  stylename= 

"Courier 10 Pitch,10,5,50,,Regular"
family=Courier 10 Pitch pointSize=10 styleHint=5 weight=50 options=Regular stylename= 

As you can see "Regular" ended up in the options instead of stylename.
As a result, the font will be underlined (since Regular contains "u")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants