]> git.lyx.org Git - features.git/commitdiff
Fix display of perenthesis in Hebrew documents
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Oct 2015 14:16:13 +0000 (16:16 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 9 Oct 2015 14:16:13 +0000 (16:16 +0200)
This was a regression from 2.1.x. I failed to copy the horrible hack that was present for the special case of () in Hebrew.

There is a real need for someone who understands RTL language stuff to fix this. Currently () are wrong in .lyx files IMO. We should not have to swap them for display.

src/TextMetrics.cpp

index d62dae76d4a3864b2ad75d831dc06e9441e07b3c..902c62d7e3ed404e468530d01452e16ea8905335 100644 (file)
@@ -28,6 +28,7 @@
 #include "CutAndPaste.h"
 #include "HSpace.h"
 #include "InsetList.h"
+#include "Language.h"
 #include "Layout.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
@@ -819,8 +820,17 @@ void TextMetrics::breakRow(Row & row, int const right_margin, pit_type const pit
                } else if (c == '\t')
                        row.addSpace(i, theFontMetrics(*fi).width(from_ascii("    ")),
                                     *fi, par.lookupChange(i));
-               else
+               else {
+                       // FIXME: please someone fix the Hebrew/Arabic parenthesis mess!
+                       // see also Paragraph::getUChar.
+                       if (fi->language()->lang() == "hebrew") {
+                               if (c == '(')
+                                       c = ')';
+                               else if (c == ')')
+                                       c = '(';
+                       }
                        row.add(i, c, *fi, par.lookupChange(i));
+               }
 
                // add inline completion width
                // draw logically behind the previous character