2013-06-18 08:18:32 +00:00
|
|
|
This branch is where I (jmarc) try to implement string_wise metrics
|
2013-07-23 14:24:01 +00:00
|
|
|
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.
|
2013-06-18 08:18:32 +00:00
|
|
|
|
|
|
|
What is done:
|
2013-07-23 14:24:01 +00:00
|
|
|
|
2013-06-18 08:18:32 +00:00
|
|
|
* Make TextMetrics methods operate on Row objects: breakRow and
|
2013-06-25 06:18:25 +00:00
|
|
|
setRowHeight instead of rowBreakPoint and rowHeight.
|
|
|
|
|
2013-07-23 14:24:01 +00:00
|
|
|
* Change breakRow operation to operate on text strings on which
|
2013-07-21 18:22:32 +00:00
|
|
|
metrics are computed. The list of elements is stored in the row
|
|
|
|
object in visual ordering, not logical.
|
2013-06-25 06:18:25 +00:00
|
|
|
|
2013-10-11 14:12:20 +00:00
|
|
|
* Re-implement cursorX and getColumnNearX using row elements.
|
2013-07-21 18:22:32 +00:00
|
|
|
|
2013-06-25 06:18:25 +00:00
|
|
|
* Implement proper string metrics computation (with cache), when
|
2013-07-21 18:22:32 +00:00
|
|
|
lyxrc.force_paint_single_char is false. In this case, remove also
|
|
|
|
useless workarounds which disable kerning and ligatures.
|
2013-06-18 08:18:32 +00:00
|
|
|
|
2013-06-25 06:18:25 +00:00
|
|
|
|
2014-03-19 13:44:53 +00:00
|
|
|
Next steps:
|
2013-10-11 14:12:20 +00:00
|
|
|
|
|
|
|
* 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
|
2013-07-21 18:22:32 +00:00
|
|
|
kept for comparison purpose, guarded with KEEP_OLD_METRICS_CODE in
|
2013-10-11 14:12:20 +00:00
|
|
|
order to check computations.
|
2013-06-25 06:18:25 +00:00
|
|
|
|
2014-03-19 13:44:53 +00:00
|
|
|
* 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.
|
|
|
|
|
2013-07-23 14:24:01 +00:00
|
|
|
* Re-implement row painting using row elements. This is not difficult
|
|
|
|
in principle, but the code is intricate and needs some careful
|
2014-03-19 13:44:53 +00:00
|
|
|
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.
|
2013-06-25 06:18:25 +00:00
|
|
|
|
2013-07-23 14:24:01 +00:00
|
|
|
* Profile and see how performance can be improved.
|
2013-06-18 08:18:32 +00:00
|
|
|
|
2013-07-17 22:25:08 +00:00
|
|
|
|
2013-07-21 18:22:32 +00:00
|
|
|
Difference in behavior (aka bug fixes)
|
|
|
|
|
2013-06-18 08:18:32 +00:00
|
|
|
* end of paragraph markers metrics are computed with the font of the
|
2013-07-21 18:22:32 +00:00
|
|
|
actual text, not default font.
|
2013-06-18 08:18:32 +00:00
|
|
|
|
2013-07-21 18:22:32 +00:00
|
|
|
* When cursor is after a LTR separator just before a RTL chunk, the
|
2013-10-11 14:12:20 +00:00
|
|
|
cursor position is computed better with the new code.
|
2013-07-17 22:25:08 +00:00
|
|
|
|
2013-07-23 14:24:01 +00:00
|
|
|
|
2013-07-21 18:22:32 +00:00
|
|
|
Other differences (aka real bugs)
|
2013-07-23 14:24:01 +00:00
|
|
|
|
2013-10-11 14:12:20 +00:00
|
|
|
* there are still difference in what breaks words. In particular,
|
|
|
|
RowPainter breaks strings at: selection end, spellchecking
|
2014-03-19 13:44:53 +00:00
|
|
|
extremities.
|
|
|
|
|
|
|
|
* when clicking in the right margin, GetColumnNearX does not return
|
|
|
|
the same value as before.
|