forked from minhngoc25a/freetype2
Minor fixes.
This commit is contained in:
parent
d8202166c0
commit
e028be97b8
|
@ -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, psaux_module_class )
|
||||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
||||||
FT_USE_MODULE( FT_Module_Class, pshinter_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_Module_Class, sfnt_module_class )
|
||||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
||||||
|
|
|
@ -141,6 +141,7 @@ FT_BEGIN_HEADER
|
||||||
* FT_FACE_FLAG_GLYPH_NAMES
|
* FT_FACE_FLAG_GLYPH_NAMES
|
||||||
* FT_FACE_FLAG_EXTERNAL_STREAM
|
* FT_FACE_FLAG_EXTERNAL_STREAM
|
||||||
* FT_FACE_FLAG_HINTER
|
* FT_FACE_FLAG_HINTER
|
||||||
|
* FT_FACE_FLAG_SVG
|
||||||
*
|
*
|
||||||
* FT_HAS_HORIZONTAL
|
* FT_HAS_HORIZONTAL
|
||||||
* FT_HAS_VERTICAL
|
* FT_HAS_VERTICAL
|
||||||
|
|
|
@ -734,7 +734,7 @@ FT_BEGIN_HEADER
|
||||||
* but FreeType isn't currently capable of rendering them correctly.
|
* but FreeType isn't currently capable of rendering them correctly.
|
||||||
*
|
*
|
||||||
* FT_GLYPH_FORMAT_SVG ::
|
* 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_
|
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_bitmap FT_GLYPH_FORMAT_BITMAP
|
||||||
#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
|
#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE
|
||||||
#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER
|
#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
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* Interface for SVG Renderer Module (specification).
|
* Interface for SVG Renderer Module (specification).
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
|
|
@ -289,12 +289,12 @@
|
||||||
ft_svg_glyph_init( FT_Glyph svg_glyph,
|
ft_svg_glyph_init( FT_Glyph svg_glyph,
|
||||||
FT_GlyphSlot slot )
|
FT_GlyphSlot slot )
|
||||||
{
|
{
|
||||||
FT_SvgGlyph glyph = (FT_SvgGlyph)svg_glyph;
|
FT_ULong doc_length;
|
||||||
FT_Error error = FT_Err_Ok;
|
|
||||||
FT_Memory memory = FT_GLYPH( glyph )->library->memory;
|
|
||||||
FT_ULong doc_length;
|
|
||||||
|
|
||||||
FT_SVG_Document document;
|
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 )
|
if ( slot->format != FT_GLYPH_FORMAT_SVG )
|
||||||
{
|
{
|
||||||
|
@ -316,13 +316,13 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* init the parent first */
|
||||||
slot->format = FT_GLYPH_FORMAT_OUTLINE;
|
slot->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||||
/* let's init the parent first */
|
|
||||||
ft_outline_glyph_class.glyph_init( svg_glyph, slot );
|
ft_outline_glyph_class.glyph_init( svg_glyph, slot );
|
||||||
slot->format = FT_GLYPH_FORMAT_SVG;
|
slot->format = FT_GLYPH_FORMAT_SVG;
|
||||||
|
|
||||||
/* allocate a new document */
|
/* 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 = memory->alloc( memory, doc_length );
|
||||||
glyph->svg_document_length = doc_length;
|
glyph->svg_document_length = doc_length;
|
||||||
glyph->glyph_index = slot->glyph_index;
|
glyph->glyph_index = slot->glyph_index;
|
||||||
|
@ -420,9 +420,10 @@
|
||||||
document->start_glyph_id = glyph->start_glyph_id;
|
document->start_glyph_id = glyph->start_glyph_id;
|
||||||
document->end_glyph_id = glyph->end_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;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5604,7 +5604,13 @@
|
||||||
FT_Module renderer;
|
FT_Module renderer;
|
||||||
SVG_Renderer_Interface *svg;
|
SVG_Renderer_Interface *svg;
|
||||||
|
|
||||||
|
/* TODO: (OT-SVG) Handle the case if the module is not found */
|
||||||
renderer = FT_Get_Module( library, "ot-svg" );
|
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 = (SVG_Renderer_Interface*)renderer->clazz->module_interface;
|
||||||
svg->set_hooks(renderer, init_hook, free_hook, render_hook);
|
svg->set_hooks(renderer, init_hook, free_hook, render_hook);
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
|
|
|
@ -751,7 +751,7 @@
|
||||||
FT_Bool is_apple_sbix;
|
FT_Bool is_apple_sbix;
|
||||||
FT_Bool has_CBLC;
|
FT_Bool has_CBLC;
|
||||||
FT_Bool has_CBDT;
|
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_family = FALSE;
|
||||||
FT_Bool ignore_typographic_subfamily = FALSE;
|
FT_Bool ignore_typographic_subfamily = FALSE;
|
||||||
|
|
||||||
|
@ -955,8 +955,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* opentype svg colored glyph support */
|
/* opentype svg colored glyph support */
|
||||||
/* no If statement because the function always exists for now */
|
/* no If statement because the function always exists for now */
|
||||||
LOAD_( svg );
|
LOAD_( svg );
|
||||||
|
|
||||||
if( face->svg )
|
if( face->svg )
|
||||||
has_SVG = TRUE;
|
has_SVG = TRUE;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* OpenType SVG Color (specification).
|
* OpenType SVG Color (specification).
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
@ -112,8 +112,9 @@
|
||||||
{
|
{
|
||||||
FT_Memory memory = face->root.memory;
|
FT_Memory memory = face->root.memory;
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
|
Svg* svg = (Svg*) face->svg;
|
||||||
|
|
||||||
|
|
||||||
Svg* svg = (Svg*) face->svg;
|
|
||||||
if( svg )
|
if( svg )
|
||||||
{
|
{
|
||||||
FT_FRAME_RELEASE( svg->table );
|
FT_FRAME_RELEASE( svg->table );
|
||||||
|
@ -246,8 +247,10 @@
|
||||||
svg_document->end_glyph_id = end_glyph_id;
|
svg_document->end_glyph_id = end_glyph_id;
|
||||||
|
|
||||||
glyph->other = svg_document;
|
glyph->other = svg_document;
|
||||||
glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/((float)glyph->face->units_per_EM) * 64.0;
|
glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/
|
||||||
glyph->metrics.vertAdvance *= ((float)glyph->face->size->metrics.y_ppem)/((float)glyph->face->units_per_EM) * 64.0;
|
((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;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* OpenType SVG Color (specification).
|
* OpenType SVG Color (specification).
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* The FreeType svg renderer interface (body).
|
* The FreeType svg renderer interface (body).
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
@ -37,7 +37,9 @@
|
||||||
static FT_Error
|
static FT_Error
|
||||||
ft_svg_init( SVG_Renderer svg_module )
|
ft_svg_init( SVG_Renderer svg_module )
|
||||||
{
|
{
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
svg_module->loaded = FALSE;
|
svg_module->loaded = FALSE;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -48,26 +50,27 @@
|
||||||
FT_Render_Mode mode,
|
FT_Render_Mode mode,
|
||||||
const FT_Vector* origin )
|
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;
|
svg_renderer->loaded = TRUE;
|
||||||
renderer_->hooks.svg_lib_init();
|
svg_renderer->hooks.svg_lib_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderer_->hooks.svg_lib_render( slot );
|
return svg_renderer->hooks.svg_lib_render( slot );
|
||||||
}
|
}
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
ft_svg_set_hooks( FT_Module renderer_,
|
ft_svg_set_hooks( FT_Module module,
|
||||||
SVG_Lib_Init init_hook,
|
SVG_Lib_Init init_hook,
|
||||||
SVG_Lib_Free free_hook,
|
SVG_Lib_Free free_hook,
|
||||||
SVG_Lib_Render render_hook )
|
SVG_Lib_Render render_hook )
|
||||||
{
|
{
|
||||||
SVG_Renderer renderer;
|
SVG_Renderer renderer;
|
||||||
|
|
||||||
renderer = (SVG_Renderer)renderer_;
|
renderer = (SVG_Renderer)module;
|
||||||
renderer->hooks.svg_lib_init = init_hook;
|
renderer->hooks.svg_lib_init = init_hook;
|
||||||
renderer->hooks.svg_lib_free = free_hook;
|
renderer->hooks.svg_lib_free = free_hook;
|
||||||
renderer->hooks.svg_lib_render = render_hook;
|
renderer->hooks.svg_lib_render = render_hook;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* The FreeType svg renderer interface (specification).
|
* The FreeType svg renderer interface (specification).
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
# Copyright (C) 1996-2019 by
|
# 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,
|
# This file is part of the FreeType project, and may only be used, modified,
|
||||||
# and distributed under the terms of the FreeType project license,
|
# and distributed under the terms of the FreeType project license,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
# Copyright (C) 1996-2019 by
|
# 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,
|
# This file is part of the FreeType project, and may only be used, modified,
|
||||||
# and distributed under the terms of the FreeType project license,
|
# and distributed under the terms of the FreeType project license,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* FreeType svg renderer module component (body only).
|
* FreeType svg renderer module component (body only).
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* The FreeType svg renderer internal types (specification).
|
* The FreeType svg renderer internal types (specification).
|
||||||
*
|
*
|
||||||
* Copyright (C) 1996-2019 by
|
* 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,
|
* This file is part of the FreeType project, and may only be used,
|
||||||
* modified, and distributed under the terms of the FreeType project
|
* modified, and distributed under the terms of the FreeType project
|
||||||
|
|
Loading…
Reference in New Issue