From 3599285019a0809c5cea3b899da0e08a54bb0a29 Mon Sep 17 00:00:00 2001 From: Jean-Marc Date: Mon, 21 Jul 2014 23:57:10 +0200 Subject: [PATCH] Fix display of parenthesis in arabic Actually the workaround that is used to show parenthesis in the right direction is not needed any more, since this is part of the unicode bidi writing algorithm. This fixes at the same time the use of [] or as delimiters in arabic, which was wrong on screen. Note that there is a problem with hebrew, but this will require a fileformat change. --- 00README_STR_METRICS_BRANCH | 2 ++ src/rowpainter.cpp | 28 ++-------------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/00README_STR_METRICS_BRANCH b/00README_STR_METRICS_BRANCH index 342d2f6583..0416ed48dd 100644 --- a/00README_STR_METRICS_BRANCH +++ b/00README_STR_METRICS_BRANCH @@ -47,3 +47,5 @@ What is done: rely on Qt to do handle complex scripts. * Get rid of LyXRC::rtl_support, which does not have a real use case. + +* Fix display of [] and {} delimiters in Arabic scripts. diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 8c8ac4c25f..5bd3209439 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -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); } -- 2.39.2