You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/08/06 15:14:20 UTC

svn commit: r1510954 - in /openoffice/trunk/main/vcl: source/gdi/sallayout.cxx win/source/gdi/winlayout.cxx

Author: hdu
Date: Tue Aug  6 13:14:19 2013
New Revision: 1510954

URL: http://svn.apache.org/r1510954
Log:
#i122948# fill gaps in glyphs->chars mapping for usp10-layouts

using a heuristic that assumes a glyph with unknown char mapping
is the continuation of the preceding glyph. If there is no known
preceding mapping use the run bounds.

Modified:
    openoffice/trunk/main/vcl/source/gdi/sallayout.cxx
    openoffice/trunk/main/vcl/win/source/gdi/winlayout.cxx

Modified: openoffice/trunk/main/vcl/source/gdi/sallayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/sallayout.cxx?rev=1510954&r1=1510953&r2=1510954&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/sallayout.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/sallayout.cxx Tue Aug  6 13:14:19 2013
@@ -1869,12 +1869,7 @@ void MultiSalLayout::AdjustLayout( ImplL
     for( n = 0; n < nLevel; ++n )
         maFallbackRuns[n].ResetPos();
     // get the next codepoint index that needs fallback
-    // and limit it to the minindex..endindex bounds
     int nActiveCharPos = nCharPos[0];
-    if( nActiveCharPos < mnMinCharPos)
-        nActiveCharPos = mnMinCharPos;
-    else if( nActiveCharPos >= rArgs.mnEndCharPos )
-        nActiveCharPos = rArgs.mnEndCharPos - 1;
     // get the end index of the active run
     int nLastRunEndChar = (vRtl[nActiveCharPos - mnMinCharPos])?
         rArgs.mnEndCharPos : rArgs.mnMinCharPos - 1;
@@ -2083,8 +2078,6 @@ void MultiSalLayout::AdjustLayout( ImplL
                 }
             }
         }
-//            if( !maFallbackRuns[i].PosIsInRun( nActiveCharPos ) )
-//                maFallbackRuns[i].NextRun();
     }
 
     mpLayouts[0]->Simplify( true );

Modified: openoffice/trunk/main/vcl/win/source/gdi/winlayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/win/source/gdi/winlayout.cxx?rev=1510954&r1=1510953&r2=1510954&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/win/source/gdi/winlayout.cxx (original)
+++ openoffice/trunk/main/vcl/win/source/gdi/winlayout.cxx Tue Aug  6 13:14:19 2013
@@ -1845,30 +1845,39 @@ int UniscribeLayout::GetNextGlyphs( int 
            nXOffset += mpJustifications[ nStart ] - mpGlyphAdvances[ nStart ];
     }
 
-    // create mpGlyphs2Chars[] if it is needed later
-    if( pCharPosAry && !mpGlyphs2Chars )
-    {
-        // create and reset the new array
-        mpGlyphs2Chars = new int[ mnGlyphCapacity ];
-        for( int i = 0; i < mnGlyphCount; ++i )
-            mpGlyphs2Chars[i] = -1;
-        // calculate the char->glyph mapping
-        for( nItem = 0; nItem < mnItemCount; ++nItem )
-        {
-            // ignore invisible visual items
-            const VisualItem& rVI = mpVisualItems[ nItem ];
-            if( rVI.IsEmpty() )
-                continue;
-            // calculate the mapping by using mpLogClusters[]
-            // mpGlyphs2Chars[] should obey the logical order
-            // => reversing the loop does this by overwriting higher logicals
-            for( c = rVI.mnEndCharPos; --c >= rVI.mnMinCharPos; )
-            {
-                int i = mpLogClusters[c] + rVI.mnMinGlyphPos;
-                mpGlyphs2Chars[i] = c;
-            }
-        }
-    }
+	// create mpGlyphs2Chars[] if it is needed later
+	if( pCharPosAry && !mpGlyphs2Chars )
+	{
+		// create and reset the new array
+		mpGlyphs2Chars = new int[ mnGlyphCapacity ];
+		static const int CHARPOS_NONE = -1;
+		for( int i = 0; i < mnGlyphCount; ++i )
+			mpGlyphs2Chars[i] = CHARPOS_NONE;
+		// calculate the char->glyph mapping
+		for( nItem = 0; nItem < mnItemCount; ++nItem )
+		{
+			// ignore invisible visual items
+			const VisualItem& rVI = mpVisualItems[ nItem ];
+			if( rVI.IsEmpty() )
+				continue;
+			// calculate the mapping by using mpLogClusters[]
+			// mpGlyphs2Chars[] should obey the logical order
+			// => reversing the loop does this by overwriting higher logicals
+			for( c = rVI.mnEndCharPos; --c >= rVI.mnMinCharPos; )
+			{
+				int i = mpLogClusters[c] + rVI.mnMinGlyphPos;
+				mpGlyphs2Chars[i] = c;
+			}
+			// use a heuristic to fill the gaps in the glyphs2chars array
+			c = !rVI.IsRTL() ? rVI.mnMinCharPos : rVI.mnEndCharPos - 1;
+			for( int i = rVI.mnMinGlyphPos; i < rVI.mnEndGlyphPos; ++i ) {
+				if( mpGlyphs2Chars[i] == CHARPOS_NONE )
+					mpGlyphs2Chars[i] = c;
+				else 
+					c = mpGlyphs2Chars[i];
+			}
+		}
+	}
 
     // calculate the absolute position of the first result glyph in pixel units
     const GOFFSET aGOffset = mpGlyphOffsets[ nStart ];