* GuiFontMetrics::pos2x, x2pos: add support for inter-word spacing.
* GuiPainter::text: idem
* Row::Element::countSeparators:
Row::countSeparators: new methods that count spaces in strings.
Row::setSeparatorExtraWidth: new method (code lifted from TextMetrics.cpp).
* TextMetrics::computeRowMetrics: rely on the above methods.
* RowPainter::paintMispelledMarked: pass only a Row::Element object reference
RowPainter::paintStringAndSel: idem; do not rely on values returned by
Painter::text (trailing spaces do not honor wordspacing value).
There are many things that are not necessary anymore:
* remove methods paintText2, paintFromPos, leftMargin, paintInlineCompletion
* Remove use of Bidi class.
* add a Font and a Change parameter to paintInset.
Also remove a comment that describes what we have just done.
The new version of paintText is quite short. Elements are treated one
by one. They are already in the right ordering.
The other changes are:
* a new paintChange method is added (using code lifted from old version)
* in paintLast, the support for end of paragraph markers is removed
(this is already part of the Row object.
There is a mismatch between the way text is tokenized in Row objects
and the way it is shown on screen. When metrics are computed,
continuous spell checking has not been done yet. Yet, the row painter
explicitly breaks words at spell status boundaries. This creates
problem with a text like "PMP," (see bug #9649), where there is a
negative kerning before the comma.
This is solved by not taking in account spell status when drawing
text, and drawing spell underlines separately.
* replace Paragraph::isSameSpellRange with new method getSpellRange.
* merge RowPainter::paintChars into RowPainter::paintFromPos
* move the actual text painting code into the new paintTextAndSel.
* merge some code from paintFromPos to paintMisspelledMark
* in paintMisspelledMark, scan the string which needs to be annotated
and add dashed line below text marked as misspelled.
Fixes bug #9649.
There is no need for real-valued line width in painters. Actually, this even leads to uneven dashes for continuous spell checker.
The new code is supposed to be equivalent to the old one, just more readable. From this, we can try to see whether some lines need to be made thicker on HiDPI screens.