]> git.lyx.org Git - features.git/blobdiff - src/rowpainter.cpp
Merge remote-tracking branch 'features/str-metrics'
[features.git] / src / rowpainter.cpp
index 8c8ac4c25f6fcbf8d3b989b18593fef62c47b5f2..bb2535f66c810dedaa4a7600ca962012e0b7a08f 100644 (file)
@@ -166,24 +166,9 @@ void RowPainter::paintChars(pos_type & vpos, Font const & font)
        pos_type pos = bidi_.vis2log(vpos);
        pos_type start_pos = pos;
        // first character
-       char_type c = par_.getChar(pos);
        docstring str;
        str.reserve(100);
-
-       // special case for arabic
-       string const & lang = font.language()->lang();
-       bool const swap_paren = lang == "arabic_arabtex"
-               || lang == "arabic_arabi"
-               || lang == "farsi";
-
-       // FIXME: Why only round brackets and why the difference to
-       // Hebrew? See also Paragraph::getUChar
-       if (swap_paren) {
-               if (c == '(')
-                       c = ')';
-               else if (c == ')')
-                       c = '(';
-       }
+       char_type const c = par_.getChar(pos);
        str.push_back(c);
 
        FontSpan const font_span = par_.fontSpan(pos);
@@ -212,7 +197,7 @@ void RowPainter::paintChars(pos_type & vpos, Font const & font)
                        // Track change type or author has changed.
                        break;
 
-               char_type c = par_.getChar(pos);
+               char_type const c = par_.getChar(pos);
 
                if (c == '\t')
                        break;
@@ -220,15 +205,6 @@ void RowPainter::paintChars(pos_type & vpos, Font const & font)
                if (!isPrintableNonspace(c))
                        break;
 
-               // FIXME: Why only round brackets and why the difference to
-               // Hebrew? See also Paragraph::getUChar
-               if (swap_paren) {
-                       if (c == '(')
-                               c = ')';
-                       else if (c == ')')
-                               c = '(';
-               }
-
                str.push_back(c);
        }
 
@@ -760,19 +736,19 @@ void RowPainter::paintText()
                }
 
                // Use font span to speed things up, see above
-               if (vpos < font_span.first || vpos > font_span.last) {
-                       font_span = par_.fontSpan(vpos);
-                       font = text_metrics_.displayFont(pit_, vpos);
+               if (!font_span.inside(pos)) {
+                       font_span = par_.fontSpan(pos);
+                       font = text_metrics_.displayFont(pit_, pos);
 
                        // split font span if inline completion is inside
-                       if (font_span.first <= inlineCompletionVPos
-                           && font_span.last > inlineCompletionVPos)
-                               font_span.last = inlineCompletionVPos;
+                       if (inlineCompletionVPos != -1
+                           && font_span.inside(inlineCompletionPos.pos()))
+                               font_span.last = inlineCompletionPos.pos();
                }
 
                // Note that this value will only be used in
                // situations where no ligature of composition of
-               // characters is needed. (see comments alginuses of width_pos).
+               // characters is needed. (see comments in uses of width_pos).
                const int width_pos = pm_.singleWidth(pos, font);
 
                Change const & change = par_.lookupChange(pos);