[psaux, type1] Reorganize object fields.
Make some fields more generic, so that we can access them the same way regardless of Type 1 or CFF. * include/freetype/internal/psaux.h (PS_Builder): Change TT_Face to FT_Face. Remove unused fields. * src/psaux/psft.c: Update all accesses of PS_Builder.face. Add some asserts to guard against casting T1_Face as TT_Face. * src/type1/t1objs.h (T1_GlyphSlot): Reorder fields to follow CFF_GlyphSlot, so that we can pretend they are the same in the interpreter. * src/psaux/psobjs.c: Updated with above changes.
This commit is contained in:
parent
6682b5ef54
commit
de3647c83f
|
@ -513,7 +513,7 @@ FT_BEGIN_HEADER
|
|||
struct PS_Builder_
|
||||
{
|
||||
FT_Memory memory;
|
||||
TT_Face face;
|
||||
FT_Face face;
|
||||
CFF_GlyphSlot glyph;
|
||||
FT_GlyphLoader loader;
|
||||
FT_Outline* base;
|
||||
|
@ -532,9 +532,6 @@ FT_BEGIN_HEADER
|
|||
|
||||
FT_Bool metrics_only;
|
||||
|
||||
void* hints_funcs; /* hinter-specific */
|
||||
void* hints_globals; /* hinter-specific */
|
||||
|
||||
FT_Bool is_t1;
|
||||
|
||||
PS_Builder_FuncsRec funcs;
|
||||
|
|
|
@ -293,9 +293,9 @@
|
|||
cf2_getUnitsPerEm( PS_Decoder* decoder )
|
||||
{
|
||||
FT_ASSERT( decoder && decoder->builder.face );
|
||||
FT_ASSERT( decoder->builder.face->root.units_per_EM );
|
||||
FT_ASSERT( decoder->builder.face->units_per_EM );
|
||||
|
||||
return decoder->builder.face->root.units_per_EM;
|
||||
return decoder->builder.face->units_per_EM;
|
||||
}
|
||||
|
||||
|
||||
|
@ -355,7 +355,7 @@
|
|||
FT_Bool no_stem_darkening_driver =
|
||||
driver->no_stem_darkening;
|
||||
FT_Char no_stem_darkening_font =
|
||||
builder->face->root.internal->no_stem_darkening;
|
||||
builder->face->internal->no_stem_darkening;
|
||||
|
||||
/* local error */
|
||||
FT_Error error2 = FT_Err_Ok;
|
||||
|
@ -384,9 +384,14 @@
|
|||
&hinted,
|
||||
&scaled );
|
||||
|
||||
/* copy isCFF2 boolean from TT_Face to CF2_Font */
|
||||
font->isCFF2 = builder->face->is_cff2;
|
||||
font->isT1 = is_t1;
|
||||
if ( is_t1 )
|
||||
font->isCFF2 = FALSE;
|
||||
else
|
||||
{
|
||||
/* copy isCFF2 boolean from TT_Face to CF2_Font */
|
||||
font->isCFF2 = ((TT_Face)builder->face)->is_cff2;
|
||||
}
|
||||
font->isT1 = is_t1;
|
||||
|
||||
font->renderingFlags = 0;
|
||||
if ( hinted )
|
||||
|
@ -472,10 +477,11 @@
|
|||
|
||||
FT_ASSERT( decoder && decoder->builder.face );
|
||||
FT_ASSERT( vec && len );
|
||||
|
||||
face = decoder->builder.face;
|
||||
FT_ASSERT( !decoder->builder.is_t1 );
|
||||
|
||||
face = (TT_Face)decoder->builder.face;
|
||||
mm = (FT_Service_MultiMasters)face->mm;
|
||||
|
||||
|
||||
return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL );
|
||||
}
|
||||
#endif
|
||||
|
@ -487,7 +493,7 @@
|
|||
{
|
||||
FT_ASSERT( decoder &&
|
||||
decoder->builder.face &&
|
||||
decoder->builder.face->root.size );
|
||||
decoder->builder.face->size );
|
||||
|
||||
/*
|
||||
* Note that `y_ppem' can be zero if there wasn't a call to
|
||||
|
@ -499,7 +505,7 @@
|
|||
*
|
||||
*/
|
||||
return cf2_intToFixed(
|
||||
decoder->builder.face->root.size->metrics.y_ppem );
|
||||
decoder->builder.face->size->metrics.y_ppem );
|
||||
}
|
||||
|
||||
|
||||
|
@ -650,13 +656,14 @@
|
|||
|
||||
|
||||
FT_ASSERT( decoder );
|
||||
FT_ASSERT( !decoder->builder.is_t1 );
|
||||
|
||||
FT_ZERO( buf );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||
/* Incremental fonts don't necessarily have valid charsets. */
|
||||
/* They use the character code, not the glyph index, in this case. */
|
||||
if ( decoder->builder.face->root.internal->incremental_interface )
|
||||
if ( decoder->builder.face->internal->incremental_interface )
|
||||
gid = code;
|
||||
else
|
||||
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
||||
|
@ -666,7 +673,7 @@
|
|||
return FT_THROW( Invalid_Glyph_Format );
|
||||
}
|
||||
|
||||
error = decoder->get_glyph_callback( decoder->builder.face,
|
||||
error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face,
|
||||
(CF2_UInt)gid,
|
||||
&charstring,
|
||||
&len );
|
||||
|
@ -690,8 +697,9 @@
|
|||
CF2_Buffer buf )
|
||||
{
|
||||
FT_ASSERT( decoder );
|
||||
FT_ASSERT( !decoder->builder.is_t1 );
|
||||
|
||||
decoder->free_glyph_callback( decoder->builder.face,
|
||||
decoder->free_glyph_callback( (TT_Face)decoder->builder.face,
|
||||
(FT_Byte**)&buf->start,
|
||||
(FT_ULong)( buf->end - buf->start ) );
|
||||
}
|
||||
|
|
|
@ -2062,9 +2062,9 @@
|
|||
{
|
||||
T1_Builder t1builder = (T1_Builder)builder;
|
||||
|
||||
ps_builder->face = (TT_Face)t1builder->face;
|
||||
ps_builder->glyph = t1builder->glyph;
|
||||
ps_builder->memory = t1builder->memory;
|
||||
ps_builder->face = (FT_Face)t1builder->face;
|
||||
ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
|
||||
ps_builder->loader = t1builder->loader;
|
||||
ps_builder->base = t1builder->base;
|
||||
ps_builder->current = t1builder->current;
|
||||
|
@ -2086,8 +2086,8 @@
|
|||
{
|
||||
CFF_Builder* cffbuilder = (CFF_Builder*)builder;
|
||||
|
||||
ps_builder->face = cffbuilder->face;
|
||||
ps_builder->memory = cffbuilder->memory;
|
||||
ps_builder->face = (FT_Face)cffbuilder->face;
|
||||
ps_builder->glyph = cffbuilder->glyph;
|
||||
ps_builder->loader = cffbuilder->loader;
|
||||
ps_builder->base = cffbuilder->base;
|
||||
|
@ -2172,7 +2172,7 @@
|
|||
else
|
||||
#endif
|
||||
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
|
||||
if ( builder->face->is_t1 )
|
||||
if ( builder->is_t1 )
|
||||
{
|
||||
point->x = FIXED_TO_INT( x );
|
||||
point->y = FIXED_TO_INT( y );
|
||||
|
|
|
@ -120,12 +120,12 @@ FT_BEGIN_HEADER
|
|||
FT_Bool hint;
|
||||
FT_Bool scaled;
|
||||
|
||||
FT_Int max_points;
|
||||
FT_Int max_contours;
|
||||
|
||||
FT_Fixed x_scale;
|
||||
FT_Fixed y_scale;
|
||||
|
||||
FT_Int max_points;
|
||||
FT_Int max_contours;
|
||||
|
||||
} T1_GlyphSlotRec;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue