[ooo-build-commit] 2 commits - patches/dev300

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Aug 13 08:13:32 PDT 2009


 patches/dev300/apply                |    3 
 patches/dev300/vcl-kerning-fix.diff |  117 ++++++++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+)

New commits:
commit ca1200032af05ebf484de3a280e8220036d4d0e8
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Thu Aug 13 16:10:41 2009 +0200

    Added the kerning fix to the apply file
    
    * patches/dev300/apply:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index c23ede3..d03d532 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -431,6 +431,9 @@ libxmlsec-findcerts.diff, i#76870, pmladek
 # avoid error messages about missing directories with templates
 sfx2-check-existing-template-dirs.diff, i#100518, pmladek
 
+# Use the characters after the string to get a better kerning
+vcl-kerning-fix.diff, n#464436, i#26519, cbosdo
+
 [ LinuxOnly ]
 # fix that allows OOo to work with a standard (unpatched) libjpeg,
 jpegc.c.diff, i#80674, n#272574, flr
commit 4e8329f978543f40209094f5fadaf9dba7d458f4
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Thu Aug 13 16:00:11 2009 +0200

    Fixed wrong kerning on linux
    
    * patches/dev300/vcl-kerning-fix.diff:
    Non-printable characters are skipped and the next printable
    character after the end of the string is used to handle the kerning
    correctly between different runs of text.
    
    Related issues: n#464436, i#26519

diff --git a/patches/dev300/vcl-kerning-fix.diff b/patches/dev300/vcl-kerning-fix.diff
new file mode 100644
index 0000000..6f5fff9
--- /dev/null
+++ b/patches/dev300/vcl-kerning-fix.diff
@@ -0,0 +1,117 @@
+--- vcl/source/glyphs/gcach_layout.cxx	2009-08-11 12:51:42.000000000 +0200
++++ vcl/source/glyphs/gcach_layout.cxx	2009-08-13 15:51:34.000000000 +0200
+@@ -36,6 +36,8 @@
+ #include <vcl/sallayout.hxx>
+ #include <vcl/salgdi.hxx>
+ 
++#include <unicode/uchar.h>
++
+ #include <vcl/svapp.hxx>
+ 
+ #include <sal/alloca.h>
+@@ -110,7 +112,12 @@
+     int nGlyphWidth = 0;
+     GlyphItem aPrevItem;
+     bool bRightToLeft;
+-    for( int nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); )
++
++    int nCharPos = -1;
++    bool hasNextPos = rArgs.GetNextPos( &nCharPos, &bRightToLeft );
++    bool isAfterEnd = false;
++    bool bFoundPrintable = false;
++    while ( hasNextPos || ( isAfterEnd && ( !bFoundPrintable || nCharPos < rArgs.mnLength ) ) )
+     {
+         sal_UCS4 cChar = rArgs.mpStr[ nCharPos ];
+         if( (cChar >= 0xD800) && (cChar <= 0xDFFF) )
+@@ -123,33 +130,68 @@
+ 
+         if( bRightToLeft )
+             cChar = GetMirroredChar( cChar );
+-        int nGlyphIndex = rFont.GetGlyphIndex( cChar );
+-        // when glyph fallback is needed update LayoutArgs
+-        if( !nGlyphIndex ) {
+-            rArgs.NeedFallback( nCharPos, bRightToLeft );
+-        if( cChar >= 0x10000 ) // handle surrogate pairs
+-                rArgs.NeedFallback( nCharPos+1, bRightToLeft );
+-    }
+ 
+-        // apply pair kerning to prev glyph if requested
+-        if( SAL_LAYOUT_KERNING_PAIRS & rArgs.mnFlags )
++        // 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 ) 
++            {
++                rArgs.NeedFallback( nCharPos, bRightToLeft );
++                if( cChar >= 0x10000 ) // handle surrogate pairs
++                    rArgs.NeedFallback( nCharPos+1, bRightToLeft );
++            }
++
++            // apply pair kerning to prev glyph if requested
++            if( SAL_LAYOUT_KERNING_PAIRS & rArgs.mnFlags )
++            {
++                int nKernValue = rFont.GetGlyphKernValue( nOldGlyphId, nGlyphIndex );
++                nGlyphWidth += nKernValue;
++                aPrevItem.mnNewWidth = nGlyphWidth;
++            }
++
++            // finish previous glyph
++            if( nOldGlyphId >= 0 )
++            {
++                rLayout.AppendGlyph( aPrevItem );
++            }
++
++            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;
+         }
+ 
+-        // finish previous glyph
+-        if( nOldGlyphId >= 0 )
+-            rLayout.AppendGlyph( aPrevItem );
+-        aNewPos.X() += nGlyphWidth;
+-
+-        // prepare GlyphItem for appending it in next round
+-        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 );
++        if ( !isAfterEnd )
++        {
++            // Check if we have some more characters
++            // Get the next position
++            hasNextPos = rArgs.GetNextPos( &nCharPos, &bRightToLeft );
++
++            if ( !hasNextPos && nCharPos < rArgs.mnLength )
++                isAfterEnd = true;
++        } 
++        else 
++        {
++            nCharPos++;
++            if ( bFoundPrintable ) 
++            {
++                isAfterEnd = false;
++                nOldGlyphId = -1;
++            }
++        }
+     }
+ 
+     // append last glyph item if any


More information about the ooo-build-commit mailing list