#ifdef ENABLE_VECTOR_BASED_TEXT_RENDERING
delete mVectorFontCache;
#endif
-
+ DestroyMatchedPatterns();
FT_Done_FreeType( mFreeTypeLibrary );
}
else
#endif
{
- int error = FT_Load_Glyph( ftFace, glyph.index, FT_LOAD_DEFAULT );
+ int error = FT_Load_Glyph( ftFace, glyph.index, FT_LOAD_NO_AUTOHINT );
if( FT_Err_Ok == error )
{
else
#endif
{
- error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_DEFAULT );
+ error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_NO_AUTOHINT );
}
if( FT_Err_Ok == error )
{
// a pattern holds a set of names, each name refers to a property of the font
FcPattern* pattern = FcPatternCreate();
+ FcFontSet* fontset = NULL;
+
// create an object set used to define which properties are to be returned in the patterns from FcFontList.
FcObjectSet* objectSet = FcObjectSetCreate();
- // build an object set from a list of property names
- FcObjectSetAdd( objectSet, FC_FILE );
- FcObjectSetAdd( objectSet, FC_FAMILY );
- FcObjectSetAdd( objectSet, FC_WIDTH );
- FcObjectSetAdd( objectSet, FC_WEIGHT );
- FcObjectSetAdd( objectSet, FC_SLANT );
-
- // get a list of fonts
- // creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
- FcFontSet* fontset = FcFontList( NULL /* the default configuration is checked to be up to date, and used */, pattern, objectSet );
-
- // clear up the object set
if( objectSet )
{
+ // build an object set from a list of property names
+ FcObjectSetAdd( objectSet, FC_FILE );
+ FcObjectSetAdd( objectSet, FC_FAMILY );
+ FcObjectSetAdd( objectSet, FC_WIDTH );
+ FcObjectSetAdd( objectSet, FC_WEIGHT );
+ FcObjectSetAdd( objectSet, FC_SLANT );
+
+ // get a list of fonts
+ // creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
+ fontset = FcFontList( NULL /* the default configuration is checked to be up to date, and used */, pattern, objectSet );
+
+ // clear up the object set
FcObjectSetDestroy( objectSet );
}
// clear up the pattern
FcCharSet* characterSet = NULL;
FcPatternGetCharSet( match, FC_CHARSET, 0u, &characterSet );
- FcPatternDestroy( match );
FcPatternDestroy( pattern );
+ mMatchedFcPatternCache.PushBack( match );
mFontCache[id-1u].mCharacterSet = characterSet;
// Add the path to the cache.
}
}
-FcCharSet* FontClient::Plugin::CreateCharacterSetFromDescription( const FontDescription& description ) const
+FcCharSet* FontClient::Plugin::CreateCharacterSetFromDescription( const FontDescription& description )
{
FcCharSet* characterSet = NULL;
FcPattern* match = FcFontMatch( NULL, pattern, &result );
FcPatternGetCharSet( match, FC_CHARSET, 0u, &characterSet );
+ mMatchedFcPatternCache.PushBack( match );
- FcPatternDestroy( match );
FcPatternDestroy( pattern );
}
return characterSet;
}
+void FontClient::Plugin::DestroyMatchedPatterns()
+{
+ for (auto & object : mMatchedFcPatternCache) {
+ FcPatternDestroy(reinterpret_cast<FcPattern*>(object));
+ }
+ mMatchedFcPatternCache.Clear();
+}
+
} // namespace Internal
} // namespace TextAbstraction