lyx_mirror/00README_STR_METRICS_BRANCH
Jean-Marc Lasgouttes 4176795e72 Remove support for LyXRC::force_paint_single_char
This workaround is not necessary anymore, and it complicates the code.

The variable itself will be removed after the landing of the branch on
master.
2014-07-08 21:30:05 +02:00

77 lines
2.8 KiB
Plaintext

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PLEASE DO NOT DO WORK ON TOP OF THIS BRANCH.
I INTEND TO REWRITE HISTORY LATER!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
This branch is where I (jmarc) try to implement string-wise metrics
computation. The goal is to have both good metrics computation (and
font with proper kerning and ligatures) and better performance than
what we have with force_paint_single_char. Moreover there has been
some code factorization in TextMetrics, where the same row-breaking
algorithm was basically implemented 3 times.
Currently everything is supposed to work for both LTR and RTL text.
The bugs fixed and caused by this branch are tracked at ticket #9003:
http://www.lyx.org/trac/ticket/9003
What is done:
* Make TextMetrics methods operate on Row objects: breakRow and
setRowHeight instead of rowBreakPoint and rowHeight.
* Change breakRow operation to operate at strings level to compute
metrics The list of elements is stored in the row object in visual
ordering, not logical. This will eventually allow to get rid of the
Bidi class.
* rename getColumnNearX to getPosNearX (and change code accordingly).
It does not make sense to return a position relative to the start of
row, since nobody needs this.
* Re-implement cursorX and getPosNearX using row elements.
* Do not honor lyxrc.force_paint_single_char anymore. This is a
workaround that is not necessary anymore.
* Implement proper string metrics computation (with cache). Remove
useless workarounds which disable kerning and ligatures.
* Draw also RtL text string-wise. This both speeds-up drawing and
prepares for code removal, since we now rely on Qt to do things we
use to do by ourselves (see isArabic* and isHebrew* code in
Encodings.cpp).
* Do not cut strings at separators in RowPainter when text is not
justified. This speeds-up painting by reducing the number of strings
to draw.
Next steps:
* Fix bugs uncovered by testing.
* Get rid of LyXRC::force_paint_single_char, which is not used anymore
in the source.
* Maybe get rid of LyXRC::rtl_support, which does not have a real use case.
* Profile and see how performance can be improved.
Steps for later (aka out of the scope of this branch):
* Re-implement row painting using row elements. This is not difficult
in principle, but the code is intricate and needs some careful
analysis. The first thing that needs to be done is to break row
elements with the same criteria. Currently breakRow does not
consider on-the-fly spell-checking and selection changes, but it is
not clear to me that it is required. Moreover, this thing would only
work if we are sure that the Row object is up-to-date when drawing
happens. This depends on the update machinery.
This would allow to get rid of the Bidi.cpp code.