[PATCH] Change in core[libreoffice-4-0]: Resolves: fdo#58324 keep both halves of surrogate pairs if g...

Caolán McNamara (via_Code_Review) gerrit at gerrit.libreoffice.org
Mon Jan 14 08:06:23 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1676

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/76/1676/1

Resolves: fdo#58324 keep both halves of surrogate pairs if glyph isn't found

Change-Id: I8fda443bb224a7a99b992611221a65e9869da8b9
---
M vcl/generic/glyphs/gcach_layout.cxx
1 file changed, 12 insertions(+), 2 deletions(-)



diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index a8ddc49..a9f373e 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -299,6 +299,16 @@
     return ((cChar == 0x200C) || (cChar == 0x200D));
 }
 
+static bool needPreviousCode(sal_Unicode cChar)
+{
+    return lcl_CharIsJoiner(cChar) || U16_IS_LEAD(cChar);
+}
+
+static bool needNextCode(sal_Unicode cChar)
+{
+    return lcl_CharIsJoiner(cChar) || U16_IS_TRAIL(cChar);
+}
+
 //See https://bugs.freedesktop.org/show_bug.cgi?id=31016
 #define ARABIC_BANDAID
 
@@ -439,9 +449,9 @@
                 if( nCharPos >= 0 )
                 {
                     rArgs.NeedFallback( nCharPos, bRightToLeft );
-                    if ( (nCharPos > 0) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos-1]) )
+                    if ( (nCharPos > 0) && needPreviousCode(rArgs.mpStr[nCharPos-1]) )
                         rArgs.NeedFallback( nCharPos-1, bRightToLeft );
-                    else if ( (nCharPos + 1 < nEndRunPos) && lcl_CharIsJoiner(rArgs.mpStr[nCharPos+1]) )
+                    else if ( (nCharPos + 1 < nEndRunPos) && needNextCode(rArgs.mpStr[nCharPos+1]) )
                         rArgs.NeedFallback( nCharPos+1, bRightToLeft );
                 }
 

-- 
To view, visit https://gerrit.libreoffice.org/1676
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fda443bb224a7a99b992611221a65e9869da8b9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Caolán McNamara <caolanm at redhat.com>



More information about the LibreOffice mailing list