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

Khaled Hosny khaledhosny at eglug.org
Sun May 5 16:44:56 PDT 2013


 vcl/generic/glyphs/gcach_ftyp.cxx   |   29 +++++++++++++++++++----------
 vcl/generic/glyphs/gcach_layout.cxx |    8 +-------
 vcl/inc/generic/glyphcache.hxx      |    2 +-
 vcl/source/gdi/sallayout.cxx        |    5 -----
 4 files changed, 21 insertions(+), 23 deletions(-)

New commits:
commit 9a8f125fa7e63b829471a6722dae3006bb1f57d2
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon May 6 01:40:06 2013 +0200

    [harfbuzz] Support Unicode variation selectors
    
    Change-Id: I8c56f45505327857613c39b28da3ae7cc3ad201c

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 09a00db..c1d6ddb 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -1177,7 +1177,7 @@ int ServerFont::ApplyGlyphTransform( int nGlyphFlags,
 
 // -----------------------------------------------------------------------
 
-int ServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const
+int ServerFont::GetRawGlyphIndex(sal_UCS4 aChar, sal_UCS4 aVS) const
 {
     if( mpFontInfo->IsSymbolFont() )
     {
@@ -1216,18 +1216,27 @@ int ServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const
             aChar = aChar*256 + (aTempArray[i] & 0xFF);
     }
 
-    // cache glyph indexes in font info to share between different sizes
-    int nGlyphIndex = mpFontInfo->GetGlyphIndex( aChar );
-    if( nGlyphIndex < 0 )
+    int nGlyphIndex = 0;
+    // If asked, check first for variant glyph with the given Unicode variation
+    // selector. This is quite uncommon so we don't bother with caching here.
+    if (aVS)
+        nGlyphIndex = FT_Face_GetCharVariantIndex(maFaceFT, aChar, aVS);
+
+    if (nGlyphIndex == 0)
     {
-        nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar );
-        if( !nGlyphIndex)
+        // cache glyph indexes in font info to share between different sizes
+        nGlyphIndex = mpFontInfo->GetGlyphIndex( aChar );
+        if( nGlyphIndex < 0 )
         {
-            // check if symbol aliasing helps
-            if( (aChar <= 0x00FF) && mpFontInfo->IsSymbolFont() )
-                nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar | 0xF000 );
+            nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar );
+            if( !nGlyphIndex)
+            {
+                // check if symbol aliasing helps
+                if( (aChar <= 0x00FF) && mpFontInfo->IsSymbolFont() )
+                    nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar | 0xF000 );
+            }
+            mpFontInfo->CacheGlyphIndex( aChar, nGlyphIndex );
         }
-        mpFontInfo->CacheGlyphIndex( aChar, nGlyphIndex );
     }
 
     return nGlyphIndex;
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index f7b6907..cb6c195 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -246,13 +246,7 @@ static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData,
         void* /*pUserData*/)
 {
     ServerFont* pFont = (ServerFont*) pFontData;
-    *nGlyphIndex = 0;
-
-    if (vs)
-        *nGlyphIndex = pFont->GetRawGlyphIndex(ch /*, vs*/); // XXX handle variation selectors
-
-    if (*nGlyphIndex == 0)
-        *nGlyphIndex = pFont->GetRawGlyphIndex(ch);
+    *nGlyphIndex = pFont->GetRawGlyphIndex(ch, vs);
 
     return *nGlyphIndex != 0;
 }
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index cb4ffce..a7e52d9 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -211,7 +211,7 @@ public:
 #endif
 
     int                 GetGlyphIndex( sal_UCS4 ) const;
-    int                 GetRawGlyphIndex( sal_UCS4 ) const;
+    int                 GetRawGlyphIndex( sal_UCS4, sal_UCS4 = 0 ) const;
     int                 FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const;
     bool                GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const;
     bool                GetAntialiasAdvice( void ) const;
commit 26ec39fc9f4fecd826983b08b64990ca608e48c4
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon May 6 01:29:33 2013 +0200

    Revert "#i103131# in doubt treat unicode variation selectors as invisible(cherry picked from commit 179f88dfe5a1eb2ebd051d73b50f1e0af9c12fd9)"
    
    This reverts commit 6840ba613cc46ee65d58612ecabe748d539de9f5.
    
    We don't want this since we can now support variation selectors with
    HarfBuzz.

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index d4696c7..e90f782 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -337,11 +337,6 @@ inline bool IsControlChar( sal_UCS4 cChar )
     // byte order markers and invalid unicode
     if( (cChar == 0xFEFF) || (cChar == 0xFFFE) || (cChar == 0xFFFF) )
         return true;
-    // variation selectors
-    if( (0xFE00 <= cChar) && (cChar <= 0xFE0F) )
-        return true;
-    if( (0xE0100 <= cChar) && (cChar <= 0xE01EF) )
-        return true;
     return false;
 }
 


More information about the Libreoffice-commits mailing list