lyx_mirror/00README_STR_METRICS_BRANCH
Jean-Marc Lasgouttes 8649ac7fe6 Some fixes related to RTL text
* fix handling of boundary situations in Row::Elements::x2pos;

 * fix handling of boundary situations in TextMetrics::getColumnNearX;

 * make sure to always use Font::isVisibleRightToLeft instead of Font::isRightToLeft;

 * Improve debug messages.
2014-06-25 17:55:30 +02:00

68 lines
2.5 KiB
Plaintext

This branch is where I (jmarc) try to implement string_wise metrics
computation. This is done through a series of cleanups. 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.
Currently everything is supposed to work for LTR text, and RTL text
should work too except possibly metrics with Arabic and Hebrew fonts.
We'll see what to do after some feedback.
What is done:
* Make TextMetrics methods operate on Row objects: breakRow and
setRowHeight instead of rowBreakPoint and rowHeight.
* Change breakRow operation to operate on text strings on which
metrics are computed. The list of elements is stored in the row
object in visual ordering, not logical.
* Re-implement cursorX and getColumnNearX using row elements.
* Implement proper string metrics computation (with cache), when
lyxrc.force_paint_single_char is false. In this case, remove also
useless workarounds which disable kerning and ligatures.
Next steps:
* check what happens with arabic and/or hebrew text. There may be some
problems related to compose characters. I suspect that some code is
needed in FontMetrics::width.
* Get rid of old code in cursorX and getColumnNearX; it has been
kept for comparison purpose, guarded with KEEP_OLD_METRICS_CODE in
order to check computations.
* rename getColumnNearX to getPosNearX or x2pos (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 row painting using row elements. This is not difficult
in principle, but the code is intricate and needs some careful
analysis. First thing that needs to be done is to break row elements
with the same criterions. Currently TextMetrics::breakRow does not
consider on-the-fly spellchecking and selection changes, but it is
not clear to me that it is required.
* Profile and see how performance can be improved.
Difference in behavior (aka bug fixes)
* end of paragraph markers metrics are computed with the font of the
actual text, not default font.
* When cursor is after a LTR separator just before a RTL chunk, the
cursor position is computed better with the new code.
Other differences (aka real bugs)
* there are still difference in what breaks words. In particular,
RowPainter breaks strings at: selection end, spellchecking
extremities.
* when clicking in the right margin, GetColumnNearX does not return
the same value as before.