]> git.lyx.org Git - features.git/blobdiff - src/rowpainter.cpp
Merge remote-tracking branch 'features/str-metrics'
[features.git] / src / rowpainter.cpp
index ee4cd18c8a72da9f71ee7787805912eb7e8060cf..bb2535f66c810dedaa4a7600ca962012e0b7a08f 100644 (file)
@@ -166,36 +166,20 @@ 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);
 
-       pos_type const end = row_.endpos();
        FontSpan const font_span = par_.fontSpan(pos);
        // Track-change status.
        Change const & change_running = par_.lookupChange(pos);
-
        // spelling correct?
        bool const spell_state =
                lyxrc.spellcheck_continuously && par_.isMisspelled(pos);
 
        // collect as much similar chars as we can
+       pos_type const end = row_.endpos();
        for (++vpos ; vpos < end ; ++vpos) {
                pos = bidi_.vis2log(vpos);
 
@@ -213,27 +197,14 @@ 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;
 
-               // When row_.separator == 0, it is possible to print a
-               // string longer than a word in one fell swoop.
-               // Therefore there is no need to break at spaces.
-               if (!isPrintableNonspace(c)
-                   && (c != ' ' || row_.separator > 0))
+               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);
        }
 
@@ -707,6 +678,7 @@ void RowPainter::paintOnlyInsets()
 
 void RowPainter::paintText()
 {
+       //LYXERR0("-------------------------------------------------------");
        pos_type const end = row_.endpos();
        // Spaces at logical line breaks in bidi text must be skipped during
        // painting. However, they may appear visually in the middle
@@ -764,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);