[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#858584: konsole: please backport font rendering fix for noto-sans



¡Hola Boyuan!

El 2017-03-24 a las 12:11 +0800, Boyuan Yang escribió:
Package: konsole Version: 4:16.12.0-1 Severity: normal Tags: patch

Font rendering for Noto Sans CJK in konsole has long been broken. This made users of konsole + Noto Sans CJK painful.

Noto Sans is not a monospace font, you mean Hack right?

Upstream committed a fix in git HEAD recently:

   https://git.reviewboard.kde.org/r/129281/diff/2/

It would be great if konsole in Stretch would include this fix.

A raw diff file will be sent as well as attachment.

diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 39a8b84..dc991ef 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -856,18 +856,10 @@ void TerminalDisplay::drawCharacters(QPainter& painter, // This still allows RTL characters to be rendered in the RTL way. painter.setLayoutDirection(Qt::LeftToRight);

- // the drawText(rect,flags,string) overload is used here with null flags - // instead of drawText(rect,string) because the (rect,string) overload causes - // the application's default layout direction to be used instead of - // the widget-specific layout direction, which should always be - // Qt::LeftToRight for this widget - // - // This was discussed in: http://lists.kde.org/?t=120552223600002&r=1&w=2 if (_bidiEnabled) { - painter.drawText(rect, 0, text); + painter.drawText(rect.x(), rect.y() + QFontMetrics(font).ascent(), text); } else { - // See bug 280896 for more info - painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text); + painter.drawText(rect.x(), rect.y() + QFontMetrics(font).ascent(), LTR_OVERRIDE_CHAR + text); } } }

There are two more patches that are needed in this line, this is 7e2f9d839f5af447a0fc7fd178dd5d8f58e489bb "Render text at primary font's baseline", f5016a867ae4657b3efeb2e8946b07de7217d9d1 replaces the QFontMetrics(font).ascent() by _fontAscent which is already being cached, and bb5ef879586c6a0c7739342f475e80000584d61e adds back the _lineSpacing setting (set by the user in the Advanced preferences tab).

I've uploaded 4:16.12.0-2 to experimental with this fixes and others that I'm currently testing. It would be nice to have feedback on that build, so if you can, please test it.

Happy hacking,
--
"There are two ways of constructing a software design.  One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies."
-- C.A.R. Hoare
Saludos /\/\ /\ >< `/

Attachment: signature.asc
Description: PGP signature


Reply to: