mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
059de2d04c
The horizontal position of the inset was not taken in account. The rounding is not always the same as with the old code, but this is not really important. Additional changes: * improve debug output of rows * remove Bidi& argument of the RowPainter constructor, since it is always an empty Bifi that is passed. This means that the Bidi class is not used at all any more in TextMetrics.cpp. The only remaining user is RowPainter.
60 lines
2.0 KiB
Plaintext
60 lines
2.0 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 needed:
|
|
|
|
* 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.
|
|
|
|
Next possible steps:
|
|
|
|
* 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.
|
|
|
|
* Re-implement row painting using row elements. This is not difficult
|
|
in principle, but the code is intricate and needs some careful
|
|
analysis.
|
|
|
|
* 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
|
|
extremity.
|