From: Stephan Witt Date: Tue, 30 Nov 2010 15:48:43 +0000 (+0000) Subject: #6920 correct the ugly workaround - now it is ugly as well but works X-Git-Tag: 2.0.0~1585 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=31c546bdfff2086b08f5a72abd5c18e9d12256cd;p=lyx.git #6920 correct the ugly workaround - now it is ugly as well but works git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36633 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index cbcee32577..6126f36025 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -211,9 +211,10 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font, // 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 str; str.reserve(100); - str.push_back(par_.getChar(pos)); + str.push_back(prev_char); if (arabic) { char_type c = str[0]; @@ -237,9 +238,19 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font, bool const spell_state = lyxrc.spellcheck_continuously && par_.isMisspelled(pos); - char_type prev_char = 0; // collect as much similar chars as we can for (++vpos ; vpos < end ; ++vpos) { + // Work-around bug #6920 + // The bug can be reproduced with DejaVu font under Linux. + // The issue is that we compute the metrics character by character + // in ParagraphMetrics::singleWidth(); but we paint word by word + // for performance reason. + // Maybe a more general fix would be draw character by character + // for some predefined fonts on some platform. In arabic and + // Hebrew we already do paint this way. + if (prev_char == 'f') + break; + pos = bidi_.vis2log(vpos); if (pos < font_span.first || pos > font_span.last) break; @@ -268,17 +279,6 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font, if (!isPrintableNonspace(c)) break; - // Work-around bug #6920 - // The bug can be reproduced with DejaVu font under Linux. - // The issue is that we compute the metrics character by character - // in ParagraphMetrics::singleWidth(); but we paint word by word - // for performance reason. - // Maybe a more general fix would be draw character by character - // for some predefined fonts on some platform. In arabic and - // Hebrew we already do paint this way. - if (prev_char == 'f') - break; - /* Because we do our own bidi, at this point the strings are * already in visual order. However, Qt also applies its own * bidi algorithm to strings that it paints to the screen.