[ooo-build-commit] patches/dev300
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Wed Oct 14 00:28:18 PDT 2009
patches/dev300/vcl-kerning-fix.diff | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
New commits:
commit 2db98f031540e6191778d55b4e8ebca6faeba791
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Wed Oct 14 09:28:42 2009 +0200
Fixed loops & Crash on kerning fix n#464436
* patches/dev300/vcl-kerning-fix.diff:
diff --git a/patches/dev300/vcl-kerning-fix.diff b/patches/dev300/vcl-kerning-fix.diff
index 6f5fff9..4c63a8b 100644
--- a/patches/dev300/vcl-kerning-fix.diff
+++ b/patches/dev300/vcl-kerning-fix.diff
@@ -19,11 +19,11 @@
+ bool hasNextPos = rArgs.GetNextPos( &nCharPos, &bRightToLeft );
+ bool isAfterEnd = false;
+ bool bFoundPrintable = false;
-+ while ( hasNextPos || ( isAfterEnd && ( !bFoundPrintable || nCharPos < rArgs.mnLength ) ) )
++ while ( hasNextPos || isAfterEnd && !bFoundPrintable && nCharPos < rArgs.mnLength )
{
sal_UCS4 cChar = rArgs.mpStr[ nCharPos ];
if( (cChar >= 0xD800) && (cChar <= 0xDFFF) )
-@@ -123,33 +130,68 @@
+@@ -123,33 +130,69 @@
if( bRightToLeft )
cChar = GetMirroredChar( cChar );
@@ -37,15 +37,16 @@
- // apply pair kerning to prev glyph if requested
- if( SAL_LAYOUT_KERNING_PAIRS & rArgs.mnFlags )
++ int nGlyphIndex = rFont.GetGlyphIndex( cChar );
++
+ // Only handle the printable characters
+ if ( u_isprint( UChar32( cChar ) ) )
{
- int nKernValue = rFont.GetGlyphKernValue( nOldGlyphId, nGlyphIndex );
- nGlyphWidth += nKernValue;
- aPrevItem.mnNewWidth = nGlyphWidth;
-+ int nGlyphIndex = rFont.GetGlyphIndex( cChar );
+ // when glyph fallback is needed update LayoutArgs
-+ if( !nGlyphIndex )
++ if( !nGlyphIndex && !isAfterEnd )
+ {
+ rArgs.NeedFallback( nCharPos, bRightToLeft );
+ if( cChar >= 0x10000 ) // handle surrogate pairs
@@ -68,20 +69,20 @@
+
+ aNewPos.X() += nGlyphWidth;
+
-+ // prepare GlyphItem for appending it in next round
-+ if ( !isAfterEnd )
-+ {
-+ nOldGlyphId = nGlyphIndex;
-+ const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex );
-+ nGlyphWidth = rGM.GetCharWidth();
-+ int nGlyphFlags = bRightToLeft ? GlyphItem::IS_RTL_GLYPH : 0;
-+
-+ aPrevItem = GlyphItem( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth );
-+ }
-+
+ // No need to signal the printable chars before the end of the runs
+ bFoundPrintable = isAfterEnd;
}
++
++ // prepare GlyphItem for appending it in next round
++ if ( !isAfterEnd )
++ {
++ nOldGlyphId = nGlyphIndex;
++ const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex );
++ nGlyphWidth = rGM.GetCharWidth();
++ int nGlyphFlags = bRightToLeft ? GlyphItem::IS_RTL_GLYPH : 0;
++
++ aPrevItem = GlyphItem( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth );
++ }
- // finish previous glyph
- if( nOldGlyphId >= 0 )
More information about the ooo-build-commit
mailing list