Kaydet (Commit) 9a8f125f authored tarafından Khaled Hosny's avatar Khaled Hosny

[harfbuzz] Support Unicode variation selectors

Change-Id: I8c56f45505327857613c39b28da3ae7cc3ad201c
üst 26ec39fc
...@@ -1177,7 +1177,7 @@ int ServerFont::ApplyGlyphTransform( int nGlyphFlags, ...@@ -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() ) if( mpFontInfo->IsSymbolFont() )
{ {
...@@ -1216,18 +1216,27 @@ int ServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const ...@@ -1216,18 +1216,27 @@ int ServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const
aChar = aChar*256 + (aTempArray[i] & 0xFF); aChar = aChar*256 + (aTempArray[i] & 0xFF);
} }
// cache glyph indexes in font info to share between different sizes int nGlyphIndex = 0;
int nGlyphIndex = mpFontInfo->GetGlyphIndex( aChar ); // If asked, check first for variant glyph with the given Unicode variation
if( nGlyphIndex < 0 ) // 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 ); // cache glyph indexes in font info to share between different sizes
if( !nGlyphIndex) nGlyphIndex = mpFontInfo->GetGlyphIndex( aChar );
if( nGlyphIndex < 0 )
{ {
// check if symbol aliasing helps nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar );
if( (aChar <= 0x00FF) && mpFontInfo->IsSymbolFont() ) if( !nGlyphIndex)
nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar | 0xF000 ); {
// 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; return nGlyphIndex;
......
...@@ -246,13 +246,7 @@ static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData, ...@@ -246,13 +246,7 @@ static hb_bool_t getFontGlyph(hb_font_t* /*font*/, void* pFontData,
void* /*pUserData*/) void* /*pUserData*/)
{ {
ServerFont* pFont = (ServerFont*) pFontData; ServerFont* pFont = (ServerFont*) pFontData;
*nGlyphIndex = 0; *nGlyphIndex = pFont->GetRawGlyphIndex(ch, vs);
if (vs)
*nGlyphIndex = pFont->GetRawGlyphIndex(ch /*, vs*/); // XXX handle variation selectors
if (*nGlyphIndex == 0)
*nGlyphIndex = pFont->GetRawGlyphIndex(ch);
return *nGlyphIndex != 0; return *nGlyphIndex != 0;
} }
......
...@@ -211,7 +211,7 @@ public: ...@@ -211,7 +211,7 @@ public:
#endif #endif
int GetGlyphIndex( sal_UCS4 ) const; 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; int FixupGlyphIndex( int nGlyphIndex, sal_UCS4 ) const;
bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const; bool GetGlyphOutline( int nGlyphIndex, ::basegfx::B2DPolyPolygon& ) const;
bool GetAntialiasAdvice( void ) const; bool GetAntialiasAdvice( void ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment