summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoazin Khatti <moazinkhatri@gmail.com>2019-07-02 00:15:50 +0500
committerMoazin Khatti <moazinkhatri@gmail.com>2019-07-11 14:09:43 +0500
commitf9b0bb6b956e7860a286e80ea3af565dd58d25eb (patch)
tree19e1e2939390c709a8181fdfc0896dcb991408ae
parent11f3c827b84c641f1498545e09e81fa9a131c552 (diff)
downloadfreetype2-f9b0bb6b956e7860a286e80ea3af565dd58d25eb.tar.gz
Minor fixes.
-rw-r--r--include/freetype/config/ftmodule.h3
-rw-r--r--include/freetype/freetype.h1
-rw-r--r--include/freetype/ftimage.h4
-rw-r--r--include/freetype/svgrenderer.h2
-rw-r--r--src/base/ftglyph.c19
-rw-r--r--src/base/ftobjs.c6
-rw-r--r--src/sfnt/sfobjs.c6
-rw-r--r--src/sfnt/ttsvg.c11
-rw-r--r--src/sfnt/ttsvg.h2
-rw-r--r--src/svg/ftsvg.c21
-rw-r--r--src/svg/ftsvg.h2
-rw-r--r--src/svg/module.mk2
-rw-r--r--src/svg/rules.mk2
-rw-r--r--src/svg/svg.c2
-rw-r--r--src/svg/svgtypes.c2
15 files changed, 49 insertions, 36 deletions
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 0f37d07cb..7c603e532 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -22,8 +22,7 @@ FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class )
-/*FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )*/
+FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 8d28cb7f4..d715f28a3 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -141,6 +141,7 @@ FT_BEGIN_HEADER
* FT_FACE_FLAG_GLYPH_NAMES
* FT_FACE_FLAG_EXTERNAL_STREAM
* FT_FACE_FLAG_HINTER
+ * FT_FACE_FLAG_SVG
*
* FT_HAS_HORIZONTAL
* FT_HAS_VERTICAL
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index 461e3547e..b40c22858 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -734,7 +734,7 @@ FT_BEGIN_HEADER
* but FreeType isn't currently capable of rendering them correctly.
*
* FT_GLYPH_FORMAT_SVG ::
- * The glyph is inside an SVG documents in the SVG table.
+ * The glyph is represented by an SVG documents in the SVG table.
*
*/
typedef enum FT_Glyph_Format_
@@ -757,7 +757,7 @@ FT_BEGIN_HEADER
#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP
#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
-#define ft_glyph_format_svg FT_GLYPH_FROMAT_SVG
+#define ft_glyph_format_svg FT_GLYPH_FORMAT_SVG
/*************************************************************************/
diff --git a/include/freetype/svgrenderer.h b/include/freetype/svgrenderer.h
index b33e4234a..c8aad1f11 100644
--- a/include/freetype/svgrenderer.h
+++ b/include/freetype/svgrenderer.h
@@ -5,7 +5,7 @@
* Interface for SVG Renderer Module (specification).
*
* Copyright (C) 2004-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index f558476d3..ab3be179c 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -289,12 +289,12 @@
ft_svg_glyph_init( FT_Glyph svg_glyph,
FT_GlyphSlot slot )
{
- FT_SvgGlyph glyph = (FT_SvgGlyph)svg_glyph;
- FT_Error error = FT_Err_Ok;
- FT_Memory memory = FT_GLYPH( glyph )->library->memory;
- FT_ULong doc_length;
-
+ FT_ULong doc_length;
FT_SVG_Document document;
+ FT_SvgGlyph glyph = (FT_SvgGlyph)svg_glyph;
+ FT_Error error = FT_Err_Ok;
+ FT_Memory memory = FT_GLYPH( glyph )->library->memory;
+
if ( slot->format != FT_GLYPH_FORMAT_SVG )
{
@@ -316,13 +316,13 @@
goto Exit;
}
+ /* init the parent first */
slot->format = FT_GLYPH_FORMAT_OUTLINE;
- /* let's init the parent first */
ft_outline_glyph_class.glyph_init( svg_glyph, slot );
slot->format = FT_GLYPH_FORMAT_SVG;
/* allocate a new document */
- doc_length = document->svg_document_length;
+ doc_length = document->svg_document_length;
glyph->svg_document = memory->alloc( memory, doc_length );
glyph->svg_document_length = doc_length;
glyph->glyph_index = slot->glyph_index;
@@ -420,9 +420,10 @@
document->start_glyph_id = glyph->start_glyph_id;
document->end_glyph_id = glyph->end_glyph_id;
- slot->format = FT_GLYPH_FORMAT_SVG;
+ slot->format = FT_GLYPH_FORMAT_SVG;
+ slot->glyph_index = glyph->glyph_index;
+ slot->other = document;
- slot->other = document;
return error;
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 871e4beb0..e4e1532b2 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -5604,7 +5604,13 @@
FT_Module renderer;
SVG_Renderer_Interface *svg;
+ /* TODO: (OT-SVG) Handle the case if the module is not found */
renderer = FT_Get_Module( library, "ot-svg" );
+
+ /* If ot-svg module is not available return with error */
+ if ( renderer == 0 )
+ return FT_THROW( Missing_Module );
+
svg = (SVG_Renderer_Interface*)renderer->clazz->module_interface;
svg->set_hooks(renderer, init_hook, free_hook, render_hook);
return FT_Err_Ok;
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 6cd62b24a..67b1aa9bc 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -751,7 +751,7 @@
FT_Bool is_apple_sbix;
FT_Bool has_CBLC;
FT_Bool has_CBDT;
- FT_Bool has_SVG = FALSE; /* For OpenType SVG fonts */
+ FT_Bool has_SVG = FALSE; /* for OT-SVG */
FT_Bool ignore_typographic_family = FALSE;
FT_Bool ignore_typographic_subfamily = FALSE;
@@ -955,8 +955,8 @@
}
/* opentype svg colored glyph support */
- /* no If statement because the function always exists for now */
- LOAD_( svg );
+ /* no If statement because the function always exists for now */
+ LOAD_( svg );
if( face->svg )
has_SVG = TRUE;
diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c
index 41c0e16a1..96fdb37ab 100644
--- a/src/sfnt/ttsvg.c
+++ b/src/sfnt/ttsvg.c
@@ -5,7 +5,7 @@
* OpenType SVG Color (specification).
*
* Copyright (C) 2018-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
@@ -112,8 +112,9 @@
{
FT_Memory memory = face->root.memory;
FT_Stream stream = face->root.stream;
+ Svg* svg = (Svg*) face->svg;
+
- Svg* svg = (Svg*) face->svg;
if( svg )
{
FT_FRAME_RELEASE( svg->table );
@@ -246,8 +247,10 @@
svg_document->end_glyph_id = end_glyph_id;
glyph->other = svg_document;
- glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/((float)glyph->face->units_per_EM) * 64.0;
- glyph->metrics.vertAdvance *= ((float)glyph->face->size->metrics.y_ppem)/((float)glyph->face->units_per_EM) * 64.0;
+ glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/
+ ((float)glyph->face->units_per_EM) * 64.0;
+ glyph->metrics.vertAdvance *= ((float)glyph->face->size->metrics.y_ppem)/
+ ((float)glyph->face->units_per_EM) * 64.0;
return FT_Err_Ok;
}
diff --git a/src/sfnt/ttsvg.h b/src/sfnt/ttsvg.h
index 186d4c8e0..9b8541ea9 100644
--- a/src/sfnt/ttsvg.h
+++ b/src/sfnt/ttsvg.h
@@ -5,7 +5,7 @@
* OpenType SVG Color (specification).
*
* Copyright (C) 2018-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c
index 901c576c1..0bda21815 100644
--- a/src/svg/ftsvg.c
+++ b/src/svg/ftsvg.c
@@ -5,7 +5,7 @@
* The FreeType svg renderer interface (body).
*
* Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
@@ -37,7 +37,9 @@
static FT_Error
ft_svg_init( SVG_Renderer svg_module )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FT_Err_Ok;
+
+
svg_module->loaded = FALSE;
return error;
}
@@ -48,26 +50,27 @@
FT_Render_Mode mode,
const FT_Vector* origin )
{
- SVG_Renderer renderer_ = (SVG_Renderer)renderer;
+ SVG_Renderer svg_renderer = (SVG_Renderer)renderer;
+
- if( renderer_->loaded == FALSE )
+ if( svg_renderer->loaded == FALSE )
{
- renderer_->loaded = TRUE;
- renderer_->hooks.svg_lib_init();
+ svg_renderer->loaded = TRUE;
+ svg_renderer->hooks.svg_lib_init();
}
- return renderer_->hooks.svg_lib_render( slot );
+ return svg_renderer->hooks.svg_lib_render( slot );
}
static FT_Error
- ft_svg_set_hooks( FT_Module renderer_,
+ ft_svg_set_hooks( FT_Module module,
SVG_Lib_Init init_hook,
SVG_Lib_Free free_hook,
SVG_Lib_Render render_hook )
{
SVG_Renderer renderer;
- renderer = (SVG_Renderer)renderer_;
+ renderer = (SVG_Renderer)module;
renderer->hooks.svg_lib_init = init_hook;
renderer->hooks.svg_lib_free = free_hook;
renderer->hooks.svg_lib_render = render_hook;
diff --git a/src/svg/ftsvg.h b/src/svg/ftsvg.h
index 3c996775f..74cc76760 100644
--- a/src/svg/ftsvg.h
+++ b/src/svg/ftsvg.h
@@ -5,7 +5,7 @@
* The FreeType svg renderer interface (specification).
*
* Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
diff --git a/src/svg/module.mk b/src/svg/module.mk
index b6efa174e..eda4006c7 100644
--- a/src/svg/module.mk
+++ b/src/svg/module.mk
@@ -4,7 +4,7 @@
# Copyright (C) 1996-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
+# David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
diff --git a/src/svg/rules.mk b/src/svg/rules.mk
index 0f14de443..427580fc1 100644
--- a/src/svg/rules.mk
+++ b/src/svg/rules.mk
@@ -4,7 +4,7 @@
# Copyright (C) 1996-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
+# David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
diff --git a/src/svg/svg.c b/src/svg/svg.c
index 660bb1c04..baa720ce9 100644
--- a/src/svg/svg.c
+++ b/src/svg/svg.c
@@ -5,7 +5,7 @@
* FreeType svg renderer module component (body only).
*
* Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
diff --git a/src/svg/svgtypes.c b/src/svg/svgtypes.c
index 5c86469e0..57e5c013d 100644
--- a/src/svg/svgtypes.c
+++ b/src/svg/svgtypes.c
@@ -6,7 +6,7 @@
* The FreeType svg renderer internal types (specification).
*
* Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project