incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1173685 - /incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx
Date Wed, 21 Sep 2011 14:43:49 GMT
Author: hdu
Date: Wed Sep 21 14:43:49 2011
New Revision: 1173685

URL: http://svn.apache.org/viewvc?rev=1173685&view=rev
Log:
#i89286# fix kerning on UNX for RTL-scripts /w diacritics (author=Khaled Hosny, thanks iorsh)

Modified:
    incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx

Modified: incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx?rev=1173685&r1=1173684&r2=1173685&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/glyphs/gcach_layout.cxx Wed Sep 21 14:43:49 2011
@@ -544,13 +544,40 @@ bool IcuLayoutEngine::operator()( Server
             aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) );
             const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex );
             int nGlyphWidth = rGM.GetCharWidth();
-            int nNewWidth = pPos[1].fX - pPos[0].fX;
+            int nNewWidth = nGlyphWidth;
             if( nGlyphWidth <= 0 )
                 bDiacritic |= true;
             // #i99367# force all diacritics to zero width
             // TODO: we need mnOrigWidth/mnLogicWidth/mnNewWidth
-		    else if( bDiacritic )
-                nGlyphWidth = 0;
+            else if( bDiacritic )
+                nGlyphWidth = nNewWidth = 0;
+            else
+            {
+                // Hack, find next +ve width glyph and calculate current
+                // glyph width by substracting the two posituons
+                const IcuPosition* pNextPos = pPos+1;
+                for ( int j = i + 1; j <= nRawRunGlyphCount; ++j, ++pNextPos )
+                {
+                    if ( j == nRawRunGlyphCount )
+                    {
+                        nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX);
+                        break;
+                    }
+
+                    LEGlyphID nNextGlyphIndex = pIcuGlyphs[j];
+                    if( (nNextGlyphIndex == ICU_MARKED_GLYPH)
+                    ||  (nNextGlyphIndex == ICU_DELETED_GLYPH) )
+                        continue;
+
+                    const GlyphMetric& rNextGM = rFont.GetGlyphMetric( nNextGlyphIndex
);
+                    int nNextGlyphWidth = rNextGM.GetCharWidth();
+                    if ( nNextGlyphWidth > 0 )
+                    {
+                        nNewWidth = static_cast<int>(pNextPos->fX - pPos->fX);
+                        break;
+                    }
+                }
+            }
 
             // heuristic to detect glyph clusters
 			bool bInCluster = true;



Mime
View raw message