Skip to content

Draw characters in exact positions

Matan Ziv-Av requested to merge matan/konsole:icu4 into master

QT can't be made to draw monospaced text (if the font does not cooperate), so avoid combining characters, using a QPainter::drawText() call for each character.

For bidi text support this change requires konsole to reorder and reshape the characters. This is done using the ICU library (which QT also uses).

This change allows for some improvements related to text rendering:

  • More precise bidi reordering, which is no longer changed by characters' attributes and selection.
  • underlines drawn separately from the text, allowing for differing underline modes (double, curly, dashed, dotted, colored).
  • Overriding font for emoji characters.
  • Combining emojis correctly

Various underlines and bidi exampleterm-test.sh: underline-bidi-new

How it looks now: underline-bidi-orig

Note that the current bidi implementation works correctly on simple words, but fails when attributes change mid sequence.

All emoji sequences from https://unicode.org/Public/emoji/13.0/emoji-test.txt and https://unicode.org/Public/emoji/2.0/emoji-zwj-sequences.txt display correctly, with noto color emoji. Other fonts (apple, whatsapp, emoji one) all miss some sequences: emoji-au-new

Currently emoji sequences don't display correctly, and fontconfig "magic" is necessary to display emojis in specific font: emoji-au-orig

This commit fixes a few bugs and addresses a lot more:

Feature requests: More standard conforming RTL and various underlines: BUG: 403729 BUG: 387811

Using non-monospace font: BUG: 416508 BUG: 452087 BUG: 425973 BUG: 430822 BUG: 442742 BUG: 441037 BUG: 430822

Emoji: BUG: 440070 CCBUG: 450017 CCBUG: 445846 CCBUG: 453086

Regression: devanagari rendering CCBUG: 381593 CCBUG: 451716

Should also fix the issue discussed in !556 (merged) and !690 (merged).

Merge request reports

Loading