Hello community, here is the log from the commit of package konsole for openSUSE:Factory checked in at 2019-03-08 11:59:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/konsole (Old) and /work/SRC/openSUSE:Factory/.konsole.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "konsole" Fri Mar 8 11:59:44 2019 rev:107 rq:681307 version:18.12.2 Changes: -------- --- /work/SRC/openSUSE:Factory/konsole/konsole.changes 2019-02-14 14:19:11.536050655 +0100 +++ /work/SRC/openSUSE:Factory/.konsole.new.28833/konsole.changes 2019-03-08 11:59:45.767971545 +0100 @@ -1,0 +2,6 @@ +Mon Mar 4 08:07:40 UTC 2019 - wba...@tmo.at + +- Add Fix-bold-font.patch to fix problems with rendering text in + bold (boo#1095022) + +------------------------------------------------------------------- New: ---- Fix-bold-font.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ konsole.spec ++++++ --- /var/tmp/diff_new_pack.8LOlmZ/_old 2019-03-08 11:59:46.347971447 +0100 +++ /var/tmp/diff_new_pack.8LOlmZ/_new 2019-03-08 11:59:46.347971447 +0100 @@ -36,6 +36,8 @@ Source24: utilities-terminal-su-48.png Source25: utilities-terminal-su-64.png Source26: utilities-terminal-su-128.png +# PATCH-FIX-UPSTREAM +Patch0: Fix-bold-font.patch # PATCH-FIX-OPENSUSE Patch100: fix-build-with-gcc48.patch Patch101: 0001-Revert-fix-drawing-box-chars-avoid-storing-and-savin.patch ++++++ Fix-bold-font.patch ++++++ >From 41693fe9ee263f8f2281852a740ee52d55f003ef Mon Sep 17 00:00:00 2001 From: Mariusz Glebocki <m...@arccos-1.net> Date: Sat, 23 Feb 2019 22:30:18 -0500 Subject: Fix "Draw intense colors in bold font" feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Make the feature work and improve it slightly - the weight used as bold is dependent on selected font's weight. "Regular" will use "Bold", but e.g. "Thin" will use "Light". `styleName` is almost always redundant - all font properties like weight, stretch, etc, are stored separately. Source Code Pro 12pt with font weight set to: Extra Light, Light, Regular, Medium, Semibold, Bold: {F6631951} Test Plan: In every case: turn on "Draw intense colors in bold font" in Edit Profile → Appearance. **The feature:** * Use some font which has "Bold" style available and set it to "Regular" style. * Run: `printf '\033[1mBold|\033[0m|Normal\n'` * "Bold|" text should use bold font. **Different weights:** * Use some font which has multiple weights available (e.g. Thin, Bold, Heavy, ...), e.g. Source Code Pro. * Select lightest style. * Run: `printf '\033[1mBold|\033[0m|Normal\n'` * Select "regular" font style. * Bold text for "regular" style should be bolder than the text for lightest style should be. Reviewers: #konsole, #vdg, hindenburg Reviewed By: #konsole, hindenburg Subscribers: hindenburg, ngraham, konsole-devel Tags: #konsole Differential Revision: https://phabricator.kde.org/D19266 --- src/TerminalDisplay.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 140ecfb..31bbacc 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -297,6 +297,11 @@ void TerminalDisplay::setVTFont(const QFont& f) // Disabling kerning saves some computation when rendering text. newFont.setKerning(false); + // "Draw intense colors in bold font" feature needs to use different font weights. StyleName + // property, when set, doesn't allow weight changes. Since all properties (weight, stretch, + // italic, etc) are stored in QFont independently, in almost all cases styleName is not needed. + newFont.setStyleName(QString()); + QFontInfo fontInfo(newFont); // QFontInfo::fixedPitch() appears to not match QFont::fixedPitch() @@ -740,25 +745,32 @@ void TerminalDisplay::drawCharacters(QPainter& painter, return; } - // setup bold and underline - bool useBold = (((style->rendition & RE_BOLD) != 0) && _boldIntense) || font().bold(); + const int normalWeight = font().weight(); + // +26 makes "bold" from "normal", "normal" from "light", etc. It is 26 instead of not 25 to prefer + // bolder weight when 25 falls in the middle between two weights. See QFont::Weight + const int boldWeight = normalWeight + 26; + + const auto isBold = [boldWeight](const QFont &font) { return font.weight() >= boldWeight; }; + + const bool useBold = (((style->rendition & RE_BOLD) != 0) && _boldIntense); const bool useUnderline = ((style->rendition & RE_UNDERLINE) != 0) || font().underline(); const bool useItalic = ((style->rendition & RE_ITALIC) != 0) || font().italic(); const bool useStrikeOut = ((style->rendition & RE_STRIKEOUT) != 0) || font().strikeOut(); const bool useOverline = ((style->rendition & RE_OVERLINE) != 0) || font().overline(); - QFont font = painter.font(); - if (font.bold() != useBold - || font.underline() != useUnderline - || font.italic() != useItalic - || font.strikeOut() != useStrikeOut - || font.overline() != useOverline) { - font.setBold(useBold); - font.setUnderline(useUnderline); - font.setItalic(useItalic); - font.setStrikeOut(useStrikeOut); - font.setOverline(useOverline); - painter.setFont(font); + QFont currentFont = painter.font(); + + if (isBold(currentFont) != useBold + || currentFont.underline() != useUnderline + || currentFont.italic() != useItalic + || currentFont.strikeOut() != useStrikeOut + || currentFont.overline() != useOverline) { + currentFont.setWeight(useBold ? boldWeight : normalWeight); + currentFont.setUnderline(useUnderline); + currentFont.setItalic(useItalic); + currentFont.setStrikeOut(useStrikeOut); + currentFont.setOverline(useOverline); + painter.setFont(currentFont); } // setup pen -- cgit v1.1