useless workarounds which disable kerning and ligatures.
* when lyxrc.force_paint_single_char is false, draw also RtL text
- string-wise. This both speed-up drawing and prepare for code
+ 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:
-* investigate whether strings could be cut at separators in RowPainter
- only in justified text. This would speed-up painting in other cases
- by lowering the number of strings to draw.
+Next steps:
* get lots of testing.
// This method takes up 70% of time when typing
pos_type pos = bidi_.vis2log(vpos);
// first character
- char_type prev_char = par_.getChar(pos);
- vector<char_type> str;
+ char_type c = par_.getChar(pos);
+ docstring str;
str.reserve(100);
- str.push_back(prev_char);
// special case for arabic
string const & lang = font.language()->lang();
// FIXME: Why only round brackets and why the difference to
// Hebrew? See also Paragraph::getUChar
if (swap_paren) {
- char_type c = str[0];
if (c == '(')
c = ')';
else if (c == ')')
c = '(';
- str[0] = c;
}
+ str.push_back(c);
pos_type const end = row_.endpos();
FontSpan const font_span = par_.fontSpan(pos);
if (c == '\t')
break;
- if (!isPrintableNonspace(c))
+ if (!isPrintableNonspace(c)
+ && (c != ' ' || row_.separator > 0))
break;
// FIXME: Why only round brackets and why the difference to
}
str.push_back(c);
- prev_char = c;
}
- docstring s(&str[0], str.size());
-
- if (s[0] == '\t')
- s.replace(0,1,from_ascii(" "));
+ if (str[0] == '\t')
+ str.replace(0,1,from_ascii(" "));
/* Because we do our own bidi, at this point the strings are
* already in visual order. However, Qt also applies its own
// Pop directional formatting: return to previous state
char_type const PDF = 0x202C;
if (font.isVisibleRightToLeft()) {
- reverse(s.begin(), s.end());
- s = RLO + s + PDF;
+ reverse(str.begin(), str.end());
+ str = RLO + str + PDF;
} else
- s = LRO + s + PDF;
+ str = LRO + str + PDF;
if (!selection && !change_running.changed()) {
- x_ += pi_.pain.text(int(x_), yo_, s, font.fontInfo());
+ x_ += pi_.pain.text(int(x_), yo_, str, font.fontInfo());
return;
}
else if (selection)
copy.setPaintColor(Color_selectiontext);
- x_ += pi_.pain.text(int(x_), yo_, s, copy);
+ x_ += pi_.pain.text(int(x_), yo_, str, copy);
}