forked from minhngoc25a/freetype2
Support OT-SVG fonts with CFF outlines
This commit is contained in:
parent
b9734fd870
commit
db972c0568
|
@ -61,6 +61,9 @@ FT_BEGIN_HEADER
|
||||||
{
|
{
|
||||||
FT_GlyphSlotRec root;
|
FT_GlyphSlotRec root;
|
||||||
|
|
||||||
|
FT_Byte* svg_document;
|
||||||
|
FT_ULong svg_document_length;
|
||||||
|
|
||||||
FT_Bool hint;
|
FT_Bool hint;
|
||||||
FT_Bool scaled;
|
FT_Bool scaled;
|
||||||
|
|
||||||
|
|
|
@ -347,6 +347,21 @@
|
||||||
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
||||||
return FT_THROW( Invalid_Argument );
|
return FT_THROW( Invalid_Argument );
|
||||||
|
|
||||||
|
/* OpenType SVG Support Over here */
|
||||||
|
if ( ( load_flags & FT_LOAD_COLOR ) &&
|
||||||
|
( ((TT_Face)glyph->root.face)->svg ) )
|
||||||
|
{
|
||||||
|
SFNT_Service sfnt = (SFNT_Service)(((TT_Face)glyph->root.face)->sfnt);
|
||||||
|
error = sfnt->load_svg_doc( &(glyph->root), glyph_index );
|
||||||
|
if( error == FT_Err_Ok )
|
||||||
|
{
|
||||||
|
glyph->root.format = FT_GLYPH_FORMAT_SVG;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* OpenType SVG Support End */
|
||||||
|
|
||||||
/* if we have a CID subfont, use its matrix (which has already */
|
/* if we have a CID subfont, use its matrix (which has already */
|
||||||
/* been multiplied with the root matrix) */
|
/* been multiplied with the root matrix) */
|
||||||
|
|
||||||
|
|
|
@ -2454,23 +2454,6 @@
|
||||||
|
|
||||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||||
|
|
||||||
static FT_Error
|
|
||||||
load_svg_glyph( TT_GlyphSlot glyph,
|
|
||||||
FT_ULong glyph_index )
|
|
||||||
{
|
|
||||||
FT_Error error;
|
|
||||||
TT_Face face;
|
|
||||||
SFNT_Service sfnt;
|
|
||||||
FT_Byte* doc_list;
|
|
||||||
|
|
||||||
face = (TT_Face)(glyph->root).face;
|
|
||||||
sfnt = (SFNT_Service)face->sfnt;
|
|
||||||
|
|
||||||
error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_loader_init( TT_Loader loader,
|
tt_loader_init( TT_Loader loader,
|
||||||
TT_Size size,
|
TT_Size size,
|
||||||
|
@ -2813,6 +2796,7 @@
|
||||||
{
|
{
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
TT_LoaderRec loader;
|
TT_LoaderRec loader;
|
||||||
|
SFNT_Service sfnt;
|
||||||
FT_GlyphSlot glyph = (FT_GlyphSlot)glyph_;
|
FT_GlyphSlot glyph = (FT_GlyphSlot)glyph_;
|
||||||
|
|
||||||
FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
|
FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
|
||||||
|
@ -2920,7 +2904,13 @@
|
||||||
/* OT-SVG part here */
|
/* OT-SVG part here */
|
||||||
if ( ( load_flags & FT_LOAD_COLOR ) && ( ((TT_Face)glyph->face)->svg ) )
|
if ( ( load_flags & FT_LOAD_COLOR ) && ( ((TT_Face)glyph->face)->svg ) )
|
||||||
{
|
{
|
||||||
error = load_svg_glyph( glyph_, glyph_index );
|
sfnt = (SFNT_Service)((TT_Face)glyph->face)->sfnt;
|
||||||
|
error = sfnt->load_svg_doc( glyph, glyph_index );
|
||||||
|
if( error == FT_Err_Ok )
|
||||||
|
{
|
||||||
|
glyph->format = FT_GLYPH_FORMAT_SVG;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
||||||
|
|
Loading…
Reference in New Issue