summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoazin Khatti <moazinkhatri@gmail.com>2019-06-10 00:18:20 +0500
committerMoazin Khatti <moazinkhatri@gmail.com>2019-07-11 14:09:42 +0500
commit1ab8251ff12103fdd1adf91b792082a4275aaba5 (patch)
tree9ac2f266d1cee6126ea1c1179f70eb976445b563
parent68d1cab0e16a1925584f5de7c5e0cd78fa811584 (diff)
downloadfreetype2-1ab8251ff12103fdd1adf91b792082a4275aaba5.tar.gz
Support OT-SVG fonts with CFF outlines
-rw-r--r--include/freetype/internal/cffotypes.h3
-rw-r--r--src/cff/cffgload.c15
-rw-r--r--src/truetype/ttgload.c26
3 files changed, 26 insertions, 18 deletions
diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h
index b26893eab..aaf06687d 100644
--- a/include/freetype/internal/cffotypes.h
+++ b/include/freetype/internal/cffotypes.h
@@ -61,6 +61,9 @@ FT_BEGIN_HEADER
{
FT_GlyphSlotRec root;
+ FT_Byte* svg_document;
+ FT_ULong svg_document_length;
+
FT_Bool hint;
FT_Bool scaled;
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 36aa7d1b9..4db77971a 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -347,6 +347,21 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
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 */
/* been multiplied with the root matrix) */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 6b2bb697a..57baf88b1 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2440,23 +2440,6 @@
#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
tt_loader_init( TT_Loader loader,
TT_Size size,
TT_GlyphSlot glyph,
@@ -2798,6 +2781,7 @@
{
FT_Error error;
TT_LoaderRec loader;
+ SFNT_Service sfnt;
FT_GlyphSlot glyph = (FT_GlyphSlot)glyph_;
FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
@@ -2905,7 +2889,13 @@
/* OT-SVG part here */
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 )