diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2014-08-25 12:46:11 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2014-09-02 09:49:42 +0200 |
commit | b0783c21fb54b939f07ddf5658cc51113b8014e6 (patch) | |
tree | b23ead89a4ab0dab88727b5f3086840f1511bb74 /src/quick/quick.pro | |
parent | 64d844ff6e5c007f44747a5a7a3c3646ca95a632 (diff) |
Fix selection of text with negative right bearing
Selecting text with a negative right bearing (like italic text)
would cause clipping to occur at the edges of the characters.
The algorithm for drawing text and text selection tried to
divide the text into two: 1. Selected text, and 2. Unselected text.
However, the selected text might be drawn outside the selection
rect when it has a negative right bearing. Similarly, unselected
text before the selection might overlap with the selection rect
when it has a negative right bearing, or unselected text after
the selection might overlap if it has a negative left bearing.
See added test textinput_italic_selected.qml for an example.
To rectify this, we do drawing of selected text like this:
1. Draw all text with unselected color
2. Draw selection rects
3. Draw the following in the selection text color and clipped
to the selection rect:
A. The selected text
B. The unselected text right before the selection
C. The unselected text right after the selection
To avoid drawing the same text twice for extra boldness,
we check if 3B or 3C actually contain 3A, in which case we skip
3A.
[ChangeLog][Text] Fixed clipping when selecting text with negative
right bearing.
Task-number: QTBUG-34233
Change-Id: I3506b3a72a2d963c5f24c5b819bbb92769b9aee1
Reviewed-by: Samuel Nevala <samuel.nevala@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/quick.pro')
0 files changed, 0 insertions, 0 deletions