Fix for some fonts not rendering in bold/italic
Needs ReviewPublic

Authored by jackkiefer on Nov 2 2017, 12:05 AM.

Details

Reviewers
None
Group Reviewers
Konsole
Summary

BUG: 378523

Fixes bug 378523.

Without the patch, fonts specified to be bold/italic as well as fonts drawn in intense colors with the "Draw intense colors as bold" box selected would not render as such.

Test Plan

Without patch under bug conditions:
echo -e "text \033[1mbold\033[0m text" -> "bold text" is not bold

With patch under bug conditions:
"echo -e "text \033[1mbold\033[0m text" -> "bold text" is now bold!

Diff Detail

Repository
R319 Konsole
Lint
Lint Skipped
Unit
Unit Tests Skipped
jackkiefer created this revision.Nov 2 2017, 12:05 AM

Thank you for the patch! Can you put the following on its own line in the Summary section?

BUG: 378523

This is a special keyword that will cause that bug to get closed once this patch lands.

jackkiefer edited the summary of this revision. (Show Details)Nov 2 2017, 12:32 AM

Thank you for the patch! Can you put the following on its own line in the Summary section?

BUG: 378523

This is a special keyword that will cause that bug to get closed once this patch lands.

Ah, of course. It is done. :)

cfeck added a subscriber: cfeck.Nov 2 2017, 1:52 AM

It does not fix the mentioned bug, but only works around it in a single application.

This does seem like a work around - is this really the best way to handle this?

This does seem like a work around - is this really the best way to handle this?

I honestly haven't any idea. This bug has been troubling me for months, and this fix finally brought my bold fonts back, so I'm personally quite happy! Even if it is just a temporary hack, perhaps it may give some insight as to the actual source of the bug.

cfeck added a comment.Nov 6 2017, 10:59 AM

The actual source of the bug is explained in comment #3 of the linked bug report.

ngraham added a subscriber: rjvbb.Dec 16 2017, 6:24 PM

This does seem like a work around - is this really the best way to handle this?

I honestly haven't any idea. This bug has been troubling me for months, and this fix finally brought my bold fonts back, so I'm personally quite happy!

Konsole uses the QFontDialog font selector dialog. Starting with Qt 5.8 (I think) this always sets the style name on the returned QFont instance. There is some disagreement among Qt devs whether this is a bug or a necessary feature so the safe thing to assume here is that the style name will continue to be set. AFAICS that's the only safe way forward which will give the intended/expected behaviour with all supported Qt versions.

That leaves 3 options:
1 use KFontRequester instead (which will supposedly be fixed)
2 use the current workaround
3 use a more elegant workaround that takes the QFont returned by the QFontDialog, constructs the equivalent QFont *without* stylename and uses that font instead.

Solution 1) would be the best if it weren't for the fact that it'll still need option 2 or 3 to give the expected behaviour with all supported KF5 and Qt5 versions.

The bug has since been fixed, so this patch can be abandoned now.