[Libreoffice-commits] .: 2 commits - i18npool/source vcl/generic vcl/inc

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 5 02:05:21 PDT 2012


 i18npool/source/ordinalsuffix/ordinalsuffix.cxx |    2 
 vcl/generic/glyphs/gcach_layout.cxx             |   83 ++----------------------
 vcl/inc/generic/glyphcache.hxx                  |    2 
 3 files changed, 10 insertions(+), 77 deletions(-)

New commits:
commit defe079d455ccc958fd0128e8a8cf0e4aeb5cd9c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 5 10:00:37 2012 +0100

    Make autocorrect of 1st to 1 + superscripted st work again
    
    It surely doesn't matter if the result of normalization is unchanged
    
    Change-Id: I87dfd0dadee33897f5df4b0dc532166a8bd9d7e5

diff --git a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx
index 596c6ff..4d75b0f 100644
--- a/i18npool/source/ordinalsuffix/ordinalsuffix.cxx
+++ b/i18npool/source/ordinalsuffix/ordinalsuffix.cxx
@@ -80,7 +80,7 @@ uno::Sequence< OUString > SAL_CALL OrdinalSuffix::getOrdinalSuffix( sal_Int32 nN
                 icu::UnicodeString normalized;
                 nCode = U_ZERO_ERROR;
                 icu::Normalizer::normalize( icuRet, UNORM_NFKC, 0, normalized, nCode );
-                if ( U_SUCCESS( nCode ) && ( normalized != icuRet ) )
+                if ( U_SUCCESS( nCode ) )
                 {
                     // Convert the normalized UnicodeString to OUString
                     OUString sValue( reinterpret_cast<const sal_Unicode *>( normalized.getBuffer( ) ), normalized.length() );
commit 5c3dc6791c8737b24d5b8211bf7330caff47b62b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 5 09:06:55 2012 +0100

    should be able to remove SimpleLayoutEngine now
    
    Change-Id: I74d2cb7c47ec04f4276755fa1bd74779842c7832

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index cd6b96c..774f0f8 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -42,8 +42,6 @@
 #include <unicode/uscript.h>
 #include <unicode/ubidi.h>
 
-namespace { struct SimpleLayoutEngine : public rtl::Static< ServerFontLayoutEngine, SimpleLayoutEngine > {}; }
-
 // =======================================================================
 // layout implementation for ServerFont
 // =======================================================================
@@ -62,10 +60,8 @@ void ServerFontLayout::DrawText( SalGraphics& rSalGraphics ) const
 bool ServerFontLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
     ServerFontLayoutEngine* pLE = mrServerFont.GetLayoutEngine();
-    if( !pLE )
-        pLE = &SimpleLayoutEngine::get();
-
-    bool bRet = (*pLE)( *this, rArgs );
+    assert(pLE);
+    bool bRet = pLE ? pLE->layout(*this, rArgs) : false;
     return bRet;
 }
 
@@ -95,68 +91,6 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 }
 
 // =======================================================================
-
-bool ServerFontLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rArgs )
-{
-    ServerFont& rFont = rLayout.GetServerFont();
-
-    Point aNewPos( 0, 0 );
-    int nOldGlyphId = -1;
-    int nGlyphWidth = 0;
-    GlyphItem aPrevItem;
-    bool bRightToLeft;
-
-    rLayout.Reserve(rArgs.mnLength);
-    for( int nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); )
-    {
-        sal_UCS4 cChar = rArgs.mpStr[ nCharPos ];
-        if( (cChar >= 0xD800) && (cChar <= 0xDFFF) )
-        {
-            if( cChar >= 0xDC00 ) // this part of a surrogate pair was already processed
-                continue;
-            cChar = 0x10000 + ((cChar - 0xD800) << 10)
-                  + (rArgs.mpStr[ nCharPos+1 ] - 0xDC00);
-        }
-
-        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 )
-        {
-            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
-        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 );
-    }
-
-    // append last glyph item if any
-    if( nOldGlyphId >= 0 )
-        rLayout.AppendGlyph( aPrevItem );
-
-    return true;
-}
-
-// =======================================================================
 // bridge to ICU LayoutEngine
 // =======================================================================
 
@@ -215,7 +149,7 @@ const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
         "vcl",
         "font( h=" << mrServerFont.GetFontSelData().mnHeight << ", \""
         << mrServerFont.GetFontFileName()->getStr() << "\" )");
-    return (const void*)pBuffer;
+    return pBuffer;
 }
 
 // -----------------------------------------------------------------------
@@ -347,7 +281,7 @@ public:
                             IcuLayoutEngine( ServerFont& );
     virtual                 ~IcuLayoutEngine();
 
-    virtual bool            operator()( ServerFontLayout&, ImplLayoutArgs& );
+    virtual bool            layout( ServerFontLayout&, ImplLayoutArgs& );
 };
 
 // -----------------------------------------------------------------------
@@ -362,8 +296,7 @@ IcuLayoutEngine::IcuLayoutEngine( ServerFont& rServerFont )
 
 IcuLayoutEngine::~IcuLayoutEngine()
 {
-    if( mpIcuLE )
-        delete mpIcuLE;
+    delete mpIcuLE;
 }
 
 // -----------------------------------------------------------------------
@@ -376,7 +309,7 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar)
 //See https://bugs.freedesktop.org/show_bug.cgi?id=31016
 #define ARABIC_BANDAID
 
-bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rArgs )
+bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
 {
     LEUnicode* pIcuChars;
     if( sizeof(LEUnicode) == sizeof(*rArgs.mpStr) )
@@ -643,8 +576,8 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
 ServerFontLayoutEngine* ServerFont::GetLayoutEngine()
 {
     // find best layout engine for font, platform, script and language
-    if( !mpLayoutEngine && FT_IS_SFNT( maFaceFT ) )
-        mpLayoutEngine = new IcuLayoutEngine( *this );
+    if (!mpLayoutEngine)
+        mpLayoutEngine = new IcuLayoutEngine(*this);
     return mpLayoutEngine;
 }
 
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 4318979..6c6ca43 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -340,7 +340,7 @@ class ServerFontLayoutEngine
 {
 public:
     virtual         ~ServerFontLayoutEngine() {}
-    virtual bool    operator()( ServerFontLayout&, ImplLayoutArgs& );
+    virtual bool    layout(ServerFontLayout&, ImplLayoutArgs&) = 0;
 };
 
 // =======================================================================


More information about the Libreoffice-commits mailing list