Commit Graph

10 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
b68f391232 Re-implement text justification
* 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).
2015-07-20 23:43:05 +02:00
Jean-Marc Lasgouttes
f750d9b5cf Remove old cruft
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.
2015-07-16 23:56:24 +02:00
Jean-Marc Lasgouttes
83afe2e547 Rely on Row elements to draw rows.
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.
2015-07-16 23:24:45 +02:00
Jean-Marc Lasgouttes
1de0d2a19b Code cleanup in RowPainter
* move some code that handle selection to paintInset()

* change the arguments of paintSeparator()
2015-07-16 23:24:28 +02:00
Jean-Marc Lasgouttes
6c8520f100 Rename paintTextAndSel to paintStringAndSel 2015-07-15 22:47:47 +02:00
Jean-Marc Lasgouttes
4796e6b337 Avoid breaking kerning with continuous spell checking
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.
2015-07-15 12:13:24 +02:00
Jean-Marc Lasgouttes
463bd17d75 Use integer line thickness in painter
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.
2015-07-14 17:42:45 +02:00
Jean-Marc Lasgouttes
c8c1ee72bc Constify RowPainter (no intended change) 2015-06-29 16:12:11 +02:00
Jean-Marc Lasgouttes
52236503d3 Add marks to indicate when a row is too large
A dotted line is shown on the left or on the right to indicate that a part of the row is not visible.

Add a color code for the scroll indicator
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
b54deb3683 Rename rowpainter.* to RowPainter.*
This is the convention for files that define classes.
2014-07-25 21:55:08 +02:00