[Libreoffice-commits] core.git: vcl/win

Mark Hung marklh9 at gmail.com
Thu Nov 17 07:08:45 UTC 2016


 vcl/win/gdi/winlayout.cxx |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 53778372a269da7c51958a7e234df4d41027fb77
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Oct 8 22:08:28 2016 +0800

    tdf#43740 SimpleWinLayout::LayoutText only advance position for actual glyphs.
    
    Unicode variance selectors selects glyph of previous base character and
    do not have character width itself.
    
    Change-Id: Id0a0d9fcd40794b6db8ff89f84ad42a842472916
    Reviewed-on: https://gerrit.libreoffice.org/29618
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 671fa3f..e5b891d 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -411,8 +411,25 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
             }
         }
 
-        // get the advance width for the current UTF-32 code point
-        int nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
+        int nGlyphWidth = 0;
+        // Unicode variance selectors selects glyph of previous base character, do not have width itself.
+        if ( nCharCode >= 0xFE00 && nCharCode <= 0xFE0F || nCharCode >= 0xE0100 && nCharCode <= 0xE01EF )
+        {
+            mpOutGlyphs[ i ] = DROPPED_OUTGLYPH;
+            mpGlyphAdvances[ i ] = 0;
+            if ( bSurrogate &&  ( i+1 ) < mnGlyphCount )
+            {
+                mpOutGlyphs[ ++i ] = DROPPED_OUTGLYPH;
+                mpGlyphAdvances[ i ] = 0;
+            }
+            continue;
+        }
+        else
+        {
+            // get the advance width for the current UTF-32 code point
+             nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
+        }
+
         if( nGlyphWidth == -1 )
         {
             ABC aABC;


More information about the Libreoffice-commits mailing list