forked from minhngoc25a/freetype2
Reverts the changes made in the structure of `TT_GlyphSlot'
This commit is contained in:
parent
479c76c867
commit
f8eae8a824
|
@ -61,11 +61,6 @@ FT_BEGIN_HEADER
|
||||||
{
|
{
|
||||||
FT_GlyphSlotRec root;
|
FT_GlyphSlotRec root;
|
||||||
|
|
||||||
/* (OT-SVG) Added these here so that CFFGlyphSlot can be cast to
|
|
||||||
TT_GlyphSlot */
|
|
||||||
FT_Byte* svg_document;
|
|
||||||
FT_ULong svg_document_length;
|
|
||||||
|
|
||||||
FT_Bool hint;
|
FT_Bool hint;
|
||||||
FT_Bool scaled;
|
FT_Bool scaled;
|
||||||
|
|
||||||
|
|
|
@ -967,8 +967,8 @@ FT_BEGIN_HEADER
|
||||||
* This structure/class is defined here because it is common to the
|
* This structure/class is defined here because it is common to the
|
||||||
* following formats: TTF, OpenType-TT, and OpenType-CFF.
|
* following formats: TTF, OpenType-TT, and OpenType-CFF.
|
||||||
*
|
*
|
||||||
* Note, however, that the class TT_Size is not shared between font driver,
|
* Note, however, that the classes TT_Size and TT_GlyphSlot are not shared
|
||||||
* and is thus defined in `ttobjs.h`.
|
* between font drivers, and are thus defined in `ttobjs.h`.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -988,42 +988,6 @@ FT_BEGIN_HEADER
|
||||||
*/
|
*/
|
||||||
typedef struct TT_FaceRec_* TT_Face;
|
typedef struct TT_FaceRec_* TT_Face;
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* @type:
|
|
||||||
* TT_GlyphSlotRec_
|
|
||||||
*
|
|
||||||
* @description:
|
|
||||||
* A glyph slot that inherits from FT_GlyphSlotRec_ but adds more fields
|
|
||||||
*
|
|
||||||
* @fields:
|
|
||||||
* root ::
|
|
||||||
* Inherits this structure from FT_GlyphSlotRec. See note below.
|
|
||||||
*
|
|
||||||
* svg_document ::
|
|
||||||
* A pointer to the SVG Document stream under interest. The stream
|
|
||||||
* will be in plain text.
|
|
||||||
*
|
|
||||||
* svg_document_length ::
|
|
||||||
* The length of the `svg_document' stream.
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* This structure has been created to accomodate the needs of OT-SVG
|
|
||||||
* rendering. It inherits from FT_GlyphSlotRect. So that `TT_GlyphSlot'
|
|
||||||
* can be casted to `FT_GlyphSlot' and behave that way too. It's defined
|
|
||||||
* here because it is common to OpenType-TTF and OpenType-CFF.
|
|
||||||
*/
|
|
||||||
typedef struct TT_GlyphSlotRec_
|
|
||||||
{
|
|
||||||
FT_GlyphSlotRec root;
|
|
||||||
FT_Byte* svg_document;
|
|
||||||
FT_ULong svg_document_length;
|
|
||||||
} TT_GlyphSlotRec;
|
|
||||||
|
|
||||||
|
|
||||||
/* A handle to a TrueType glyph slot object. */
|
|
||||||
typedef struct TT_GlyphSlotRec_* TT_GlyphSlot;
|
|
||||||
|
|
||||||
|
|
||||||
/* a function type used for the truetype bytecode interpreter hooks */
|
/* a function type used for the truetype bytecode interpreter hooks */
|
||||||
typedef FT_Error
|
typedef FT_Error
|
||||||
|
|
|
@ -347,21 +347,6 @@
|
||||||
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
||||||
return FT_THROW( Invalid_Argument );
|
return FT_THROW( Invalid_Argument );
|
||||||
|
|
||||||
/* check for OT-SVG */
|
|
||||||
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) */
|
||||||
|
|
||||||
|
|
|
@ -2219,12 +2219,7 @@
|
||||||
|
|
||||||
FT_BBox bbox;
|
FT_BBox bbox;
|
||||||
FT_Fixed y_scale;
|
FT_Fixed y_scale;
|
||||||
|
TT_GlyphSlot glyph = loader->glyph;
|
||||||
/* TODO: (OT-SVG) Temporary hack to accomodate the change
|
|
||||||
* in the `TT_GlyphSlot' made. Rewrite properly
|
|
||||||
*/
|
|
||||||
TT_GlyphSlot glyph_ = (TT_GlyphSlot)loader->glyph;
|
|
||||||
FT_GlyphSlot glyph = (FT_GlyphSlot)glyph_;
|
|
||||||
TT_Size size = loader->size;
|
TT_Size size = loader->size;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2411,10 +2406,8 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
TT_SBit_MetricsRec sbit_metrics;
|
TT_SBit_MetricsRec sbit_metrics;
|
||||||
|
|
||||||
/* (OT-SVG) face assignment changed to accomodate the change in
|
|
||||||
* the structure of TT_GlyphSlot
|
face = (TT_Face)glyph->face;
|
||||||
*/
|
|
||||||
face = (TT_Face)(glyph->root.face);
|
|
||||||
sfnt = (SFNT_Service)face->sfnt;
|
sfnt = (SFNT_Service)face->sfnt;
|
||||||
stream = face->root.stream;
|
stream = face->root.stream;
|
||||||
|
|
||||||
|
@ -2423,39 +2416,35 @@
|
||||||
glyph_index,
|
glyph_index,
|
||||||
(FT_UInt)load_flags,
|
(FT_UInt)load_flags,
|
||||||
stream,
|
stream,
|
||||||
&(glyph->root.bitmap),
|
&glyph->bitmap,
|
||||||
&sbit_metrics );
|
&sbit_metrics );
|
||||||
/* TODO: (OT-SVG) So many `glyph->root' look ugly. Maybe create a new variable
|
|
||||||
* to make this look good.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( !error )
|
if ( !error )
|
||||||
{
|
{
|
||||||
(glyph->root).outline.n_points = 0;
|
glyph->outline.n_points = 0;
|
||||||
(glyph->root).outline.n_contours = 0;
|
glyph->outline.n_contours = 0;
|
||||||
|
|
||||||
(glyph->root).metrics.width = (FT_Pos)sbit_metrics.width * 64;
|
glyph->metrics.width = (FT_Pos)sbit_metrics.width * 64;
|
||||||
(glyph->root).metrics.height = (FT_Pos)sbit_metrics.height * 64;
|
glyph->metrics.height = (FT_Pos)sbit_metrics.height * 64;
|
||||||
|
|
||||||
(glyph->root).metrics.horiBearingX = (FT_Pos)sbit_metrics.horiBearingX * 64;
|
glyph->metrics.horiBearingX = (FT_Pos)sbit_metrics.horiBearingX * 64;
|
||||||
(glyph->root).metrics.horiBearingY = (FT_Pos)sbit_metrics.horiBearingY * 64;
|
glyph->metrics.horiBearingY = (FT_Pos)sbit_metrics.horiBearingY * 64;
|
||||||
(glyph->root).metrics.horiAdvance = (FT_Pos)sbit_metrics.horiAdvance * 64;
|
glyph->metrics.horiAdvance = (FT_Pos)sbit_metrics.horiAdvance * 64;
|
||||||
|
|
||||||
(glyph->root).metrics.vertBearingX = (FT_Pos)sbit_metrics.vertBearingX * 64;
|
glyph->metrics.vertBearingX = (FT_Pos)sbit_metrics.vertBearingX * 64;
|
||||||
(glyph->root).metrics.vertBearingY = (FT_Pos)sbit_metrics.vertBearingY * 64;
|
glyph->metrics.vertBearingY = (FT_Pos)sbit_metrics.vertBearingY * 64;
|
||||||
(glyph->root).metrics.vertAdvance = (FT_Pos)sbit_metrics.vertAdvance * 64;
|
glyph->metrics.vertAdvance = (FT_Pos)sbit_metrics.vertAdvance * 64;
|
||||||
|
|
||||||
(glyph->root).format = FT_GLYPH_FORMAT_BITMAP;
|
glyph->format = FT_GLYPH_FORMAT_BITMAP;
|
||||||
|
|
||||||
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
|
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
|
||||||
{
|
{
|
||||||
(glyph->root).bitmap_left = sbit_metrics.vertBearingX;
|
glyph->bitmap_left = sbit_metrics.vertBearingX;
|
||||||
(glyph->root).bitmap_top = sbit_metrics.vertBearingY;
|
glyph->bitmap_top = sbit_metrics.vertBearingY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(glyph->root).bitmap_left = sbit_metrics.horiBearingX;
|
glyph->bitmap_left = sbit_metrics.horiBearingX;
|
||||||
(glyph->root).bitmap_top = sbit_metrics.horiBearingY;
|
glyph->bitmap_top = sbit_metrics.horiBearingY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2464,6 +2453,7 @@
|
||||||
|
|
||||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_loader_init( TT_Loader loader,
|
tt_loader_init( TT_Loader loader,
|
||||||
TT_Size size,
|
TT_Size size,
|
||||||
|
@ -2479,12 +2469,12 @@
|
||||||
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
||||||
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
|
||||||
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
|
||||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)(glyph->root).face );
|
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( (TT_Face)glyph->face );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
face = (TT_Face)(glyph->root.face);
|
face = (TT_Face)glyph->face;
|
||||||
stream = face->root.stream;
|
stream = face->root.stream;
|
||||||
|
|
||||||
FT_ZERO( loader );
|
FT_ZERO( loader );
|
||||||
|
@ -2736,7 +2726,7 @@
|
||||||
/* get face's glyph loader */
|
/* get face's glyph loader */
|
||||||
if ( !glyf_table_only )
|
if ( !glyf_table_only )
|
||||||
{
|
{
|
||||||
FT_GlyphLoader gloader = (glyph->root).internal->loader;
|
FT_GlyphLoader gloader = glyph->internal->loader;
|
||||||
|
|
||||||
|
|
||||||
FT_GlyphLoader_Rewind( gloader );
|
FT_GlyphLoader_Rewind( gloader );
|
||||||
|
@ -2800,7 +2790,7 @@
|
||||||
*/
|
*/
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
TT_Load_Glyph( TT_Size size,
|
TT_Load_Glyph( TT_Size size,
|
||||||
TT_GlyphSlot glyph_,
|
TT_GlyphSlot glyph,
|
||||||
FT_UInt glyph_index,
|
FT_UInt glyph_index,
|
||||||
FT_Int32 load_flags )
|
FT_Int32 load_flags )
|
||||||
{
|
{
|
||||||
|
@ -2808,9 +2798,6 @@
|
||||||
TT_LoaderRec loader;
|
TT_LoaderRec loader;
|
||||||
SFNT_Service sfnt;
|
SFNT_Service sfnt;
|
||||||
|
|
||||||
/* TODO: (OT-SVG) maybe find a proper way to do this */
|
|
||||||
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 ));
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||||
|
@ -2824,7 +2811,7 @@
|
||||||
FT_Fixed y_scale = size->root.metrics.y_scale;
|
FT_Fixed y_scale = size->root.metrics.y_scale;
|
||||||
|
|
||||||
|
|
||||||
error = load_sbit_image( size, glyph_, glyph_index, load_flags );
|
error = load_sbit_image( size, glyph, glyph_index, load_flags );
|
||||||
if ( FT_ERR_EQ( error, Missing_Bitmap ) )
|
if ( FT_ERR_EQ( error, Missing_Bitmap ) )
|
||||||
{
|
{
|
||||||
/* the bitmap strike is incomplete and misses the requested glyph; */
|
/* the bitmap strike is incomplete and misses the requested glyph; */
|
||||||
|
@ -2891,7 +2878,7 @@
|
||||||
if ( FT_IS_SCALABLE( glyph->face ) )
|
if ( FT_IS_SCALABLE( glyph->face ) )
|
||||||
{
|
{
|
||||||
/* for the bbox we need the header only */
|
/* for the bbox we need the header only */
|
||||||
(void)tt_loader_init( &loader, size, glyph_, load_flags, TRUE );
|
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
|
||||||
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
|
(void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
|
||||||
tt_loader_done( &loader );
|
tt_loader_done( &loader );
|
||||||
glyph->linearHoriAdvance = loader.linear;
|
glyph->linearHoriAdvance = loader.linear;
|
||||||
|
@ -2913,6 +2900,13 @@
|
||||||
|
|
||||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||||
|
|
||||||
|
/* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
|
||||||
|
if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid )
|
||||||
|
{
|
||||||
|
error = FT_THROW( Invalid_Size_Handle );
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
/* check for OT-SVG */
|
/* check for OT-SVG */
|
||||||
if ( ( load_flags & FT_LOAD_COLOR ) && ( ((TT_Face)glyph->face)->svg ) )
|
if ( ( load_flags & FT_LOAD_COLOR ) && ( ((TT_Face)glyph->face)->svg ) )
|
||||||
{
|
{
|
||||||
|
@ -2931,7 +2925,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = tt_loader_init( &loader, size, glyph_, load_flags, FALSE );
|
error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,21 @@ FT_BEGIN_HEADER
|
||||||
typedef struct TT_DriverRec_* TT_Driver;
|
typedef struct TT_DriverRec_* TT_Driver;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @Type:
|
||||||
|
* TT_GlyphSlot
|
||||||
|
*
|
||||||
|
* @Description:
|
||||||
|
* A handle to a TrueType glyph slot object.
|
||||||
|
*
|
||||||
|
* @Note:
|
||||||
|
* This is a direct typedef of FT_GlyphSlot, as there is nothing
|
||||||
|
* specific about the TrueType glyph slot.
|
||||||
|
*/
|
||||||
|
typedef FT_GlyphSlot TT_GlyphSlot;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* @Struct:
|
* @Struct:
|
||||||
|
|
Loading…
Reference in New Issue