[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - readlicense_oo/docs vcl/win

Jürgen Schmidt jsc at apache.org
Thu Mar 27 11:08:15 PDT 2014


 readlicense_oo/docs/readme/readme.xrm |    2 +-
 vcl/win/source/gdi/winlayout.cxx      |   17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit cc82ca40b8e59299c58eaa1459ca9330d75f4b8c
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Thu Mar 27 16:37:47 2014 +0000

    #124311# merge fix from aoo410 branch, correct system requiremnts in readme, new 10.7 (Lion)

diff --git a/readlicense_oo/docs/readme/readme.xrm b/readlicense_oo/docs/readme/readme.xrm
index d2f34e8..333a2f9 100644
--- a/readlicense_oo/docs/readme/readme.xrm
+++ b/readlicense_oo/docs/readme/readme.xrm
@@ -55,7 +55,7 @@
 			<div class="MAC" id="SystemRequirements_OSX">
 				<ul>
 					<li>
-						<p id="macxiOSX" xml:lang="en-US">MacOSX 10.4 (Tiger) or higher</p>
+						<p id="macxiOSX" xml:lang="en-US">MacOSX 10.7 (Lion) or higher</p>
 					</li>
 
 					<li>
commit 913f1fc4b1362f6e91595af5ae10c4cba79fd355
Author: Herbert Dürr <hdu at apache.org>
Date:   Thu Mar 27 16:07:37 2014 +0000

    #i124516# handle bad surrogate pairs gracefully on Windows
    
    When running into invalid Unicode surrogate pairs the text layout code on
    Windows ran into massive problems like crashes. This change detects the
    situation of an invalid surrogate pair and falls back to treat it as
    a simple character instead of requesting a complex glyph fallback.

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 7fab929..51db718 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -415,12 +415,19 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
         bool bSurrogate = ((nCharCode >= 0xD800) && (nCharCode <= 0xDFFF));
         if( bSurrogate )
         {
-            if( nCharCode >= 0xDC00 ) // this part of a surrogate pair was already processed
+            // ignore high surrogates, they were already processed with their low surrogates
+            if( nCharCode >= 0xDC00 )
                 continue;
-            nCharCode = 0x10000 + ((pCodes[0] - 0xD800) << 10) + (pCodes[1] - 0xDC00);
-    }
+            // check the second half of the surrogate pair
+            bSurrogate &= (0xDC00 <= pCodes[1]) && (pCodes[1] <= 0xDFFF);
+            // calculate the UTF-32 code of valid surrogate pairs
+            if( bSurrogate )
+                nCharCode = 0x10000 + ((pCodes[0] - 0xD800) << 10) + (pCodes[1] - 0xDC00);
+            else // or fall back to a replacement character
+                nCharCode = '?';
+        }
 
-        // get the advance width for the current UCS-4 code point
+        // get the advance width for the current UTF-32 code point
         int nGlyphWidth = mrWinFontEntry.GetCachedGlyphWidth( nCharCode );
         if( nGlyphWidth == -1 )
         {
@@ -438,7 +445,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
         mpGlyphAdvances[ i ] = nGlyphWidth;
         mnWidth += nGlyphWidth;
 
-        // remaining codes of surrogate pair get a zero width
+        // the second half of surrogate pair gets a zero width
         if( bSurrogate && ((i+1) < mnGlyphCount) )
             mpGlyphAdvances[ i+1 ] = 0;
 


More information about the Libreoffice-commits mailing list