[Libreoffice-commits] .: Branch 'libreoffice-3-6' - vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 2 04:21:25 PST 2013


 vcl/win/source/gdi/winlayout.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 49dcb4794c838d5f1cf61060f216fc67f36c1618
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Dec 22 01:53:09 2012 +0100

    fdo#47553: UniscribeLayout: adjust mnSubStringMin
    
    ... to actual minimum so that the fix for fdo#33090 in
    UniscribeLayout::GetNextGlyphs subtracts exactly the right number.
    
    The original value of mnSubStringMin is guessed and may be up to 8
    smaller than the actual start of the first VisualItem.
    
    For the bugdoc it happens that sometimes it's too small by 8 and then
    the wrong entries in mpGlyphs2Chars are initialized and then apparently
    there are single glyphs that represent multiple characters and so
    GetNextGlyphs returns a -1 character which is invalid.
    
     ->GetNextGlyphs dir 1 36 mnSubStringMin 28
     ->GetNextGlyphs g2c #1 [8] = 36
     ->GetNextGlyphs g2c #1 [9] = 37
     ->GetNextGlyphs g2c #1 [10] = 38
     ->GetNextGlyphs g2c #1 [11] = 39
     ->GetNextGlyphs g2c #1 [12] = 40
     ->GetNextGlyphs g2c #2 [4] = 40
     ->GetNextGlyphs g2c #2 [3] = 39
     ->GetNextGlyphs g2c #2 [1] = 38
     ->GetNextGlyphs g2c #2 [1] = 37
     ->GetNextGlyphs g2c #2 [0] = 36
    ...
     ->GetNextGlyphs init nCharPos -1
     ->GetNextGlyphs g2c [2]  nCharPos -1
     ->GetNextGlyphs set pCharPosAry -1
    layout[0]->GetNextGlyphs 768,1024 a1800 c-1 0
    
    Change-Id: Ie33ec797a412aa898bec3f4e8f97b88dcfed4d11
    (cherry picked from commit cec68bceba9aa1e984d74897fcd7bf4db702d14b)
    Reviewed-on: https://gerrit.libreoffice.org/1467
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 1df1a75..4ebdd06 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1339,6 +1339,12 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
         {
             for( int j = rVisualItem.mnMinCharPos; j < rVisualItem.mnEndCharPos; ++j )
                 mpLogClusters[j] = sal::static_int_cast<WORD>(~0U);
+            if (rArgs.mnMinCharPos >= rVisualItem.mnEndCharPos)
+            {   // fdo#47553 adjust "guessed" min (maybe up to -8 off) to
+                // actual min so it can be used properly in GetNextGlyphs
+                assert(mnSubStringMin <= rVisualItem.mnEndCharPos);
+                mnSubStringMin = rVisualItem.mnEndCharPos;
+            }
             continue;
         }
 
@@ -1793,7 +1799,10 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos,
         int nGlyphWidth = pGlyphWidths[ nStart ];
         int nCharPos = -1;    // no need to determine charpos
         if( mpGlyphs2Chars )  // unless explicitly requested+provided
+        {
             nCharPos = mpGlyphs2Chars[ nStart ];
+            assert(-1 != nCharPos);
+        }
 
         // inject kashida glyphs if needed
         if( !mbDisableGlyphInjection


More information about the Libreoffice-commits mailing list