]> git.lyx.org Git - features.git/blob - 00README_STR_METRICS_BRANCH
Change getColumnNearX to getPosNearX
[features.git] / 00README_STR_METRICS_BRANCH
1 This branch is where I (jmarc) try to implement string_wise metrics
2 computation. This is done through a series of cleanups. The goal is to
3 have both good metrics computation (and font with proper kerning and
4 ligatures) and better performance than what we have with
5 force_paint_single_char.
6
7 Currently everything is supposed to work for LTR text, and RTL text
8 should work too except possibly metrics with Arabic and Hebrew fonts.
9 We'll see what to do after some feedback.
10
11 What is done:
12
13 * Make TextMetrics methods operate on Row objects: breakRow and
14   setRowHeight instead of rowBreakPoint and rowHeight.
15
16 * Change breakRow operation to operate on text strings on which
17   metrics are computed. The list of elements is stored in the row
18   object in visual ordering, not logical.
19
20 * rename getColumnNearX to getPosNearX (and change code accordingly).
21   It does not make sense to return a position relative to the start of
22   row, since nobody needs this.
23
24 * Re-implement cursorX and getPosNearX using row elements.
25
26 * Implement proper string metrics computation (with cache), when
27   lyxrc.force_paint_single_char is false. In this case, remove also
28   useless workarounds which disable kerning and ligatures.
29
30
31 Next steps:
32
33 * check what happens with arabic and/or hebrew text. There may be some
34   problems related to compose characters. I suspect that some code is
35   needed in FontMetrics::width.
36
37 * Get rid of old code in cursorX and getColumnNearX; it has been
38   kept for comparison purpose, guarded with KEEP_OLD_METRICS_CODE in
39   order to check computations.
40
41 * Re-implement row painting using row elements. This is not difficult
42   in principle, but the code is intricate and needs some careful
43   analysis. First thing that needs to be done is to break row elements
44   with the same criterions. Currently TextMetrics::breakRow does not
45   consider on-the-fly spellchecking and selection changes, but it is
46   not clear to me that it is required.
47
48 * Profile and see how performance can be improved.
49
50
51 Difference in behavior (aka bug fixes)
52
53 * end of paragraph markers metrics are computed with the font of the
54   actual text, not default font.
55
56 * When cursor is after a LTR separator just before a RTL chunk, the
57   cursor position is computed better with the new code.
58
59
60 Other differences (aka real bugs)
61
62 * there are still difference in what breaks words. In particular,
63   RowPainter breaks strings at: selection end, spellchecking
64   extremities.
65
66 * when clicking in the right margin, GetColumnNearX does not return
67   the same value as before.