[type1] Remove casts.

* src/type1/t1driver.c (t1_driver_class): Remove all casts and
update affected functions.

* src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c:
Updated for t1driver changes.
src/type1/t1objs.h (T1_Driver): Remove unused typedef.
Updated for t1driver changes.
This commit is contained in:
Werner Lemberg 2011-11-30 13:08:28 +01:00
parent c52f44d4fd
commit 910b544aaf
6 changed files with 111 additions and 95 deletions

View File

@ -1,3 +1,15 @@
2011-11-30 Werner Lemberg <wl@gnu.org>
[type1] Remove casts.
* src/type1/t1driver.c (t1_driver_class): Remove all casts and
update affected functions.
* src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c:
Updated for t1driver changes.
src/type1/t1objs.h (T1_Driver): Remove unused typedef.
Updated for t1driver changes.
2011-11-27 Werner Lemberg <wl@gnu.org>
[bdf] Fix Savannah bug #34896.

View File

@ -607,11 +607,11 @@
};
static FT_Module_Interface
Get_Interface( FT_Driver driver,
FT_CALLBACK_DEF( FT_Module_Interface )
Get_Interface( FT_Module module,
const FT_String* t1_interface )
{
FT_UNUSED( driver );
FT_UNUSED( module );
return ft_service_list_lookup( t1_services, t1_interface );
}
@ -652,11 +652,14 @@
/* They can be implemented by format-specific interfaces. */
/* */
static FT_Error
Get_Kerning( T1_Face face,
Get_Kerning( FT_Face t1face, /* T1_Face */
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning )
{
T1_Face face = (T1_Face)t1face;
kerning->x = 0;
kerning->y = 0;
@ -689,38 +692,38 @@
0, /* format interface */
(FT_Module_Constructor)T1_Driver_Init,
(FT_Module_Destructor) T1_Driver_Done,
(FT_Module_Requester) Get_Interface,
T1_Driver_Init,
T1_Driver_Done,
Get_Interface,
},
sizeof ( T1_FaceRec ),
sizeof ( T1_SizeRec ),
sizeof ( T1_GlyphSlotRec ),
(FT_Face_InitFunc) T1_Face_Init,
(FT_Face_DoneFunc) T1_Face_Done,
(FT_Size_InitFunc) T1_Size_Init,
(FT_Size_DoneFunc) T1_Size_Done,
(FT_Slot_InitFunc) T1_GlyphSlot_Init,
(FT_Slot_DoneFunc) T1_GlyphSlot_Done,
T1_Face_Init,
T1_Face_Done,
T1_Size_Init,
T1_Size_Done,
T1_GlyphSlot_Init,
T1_GlyphSlot_Done,
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
ft_stub_set_char_sizes,
ft_stub_set_pixel_sizes,
#endif
(FT_Slot_LoadFunc) T1_Load_Glyph,
T1_Load_Glyph,
#ifdef T1_CONFIG_OPTION_NO_AFM
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
0, /* FT_Face_GetKerningFunc */
0, /* FT_Face_AttachFunc */
#else
(FT_Face_GetKerningFunc) Get_Kerning,
(FT_Face_AttachFunc) T1_Read_Metrics,
Get_Kerning,
T1_Read_Metrics,
#endif
(FT_Face_GetAdvancesFunc) T1_Get_Advances,
(FT_Size_RequestFunc) T1_Size_Request,
(FT_Size_SelectFunc) 0
T1_Get_Advances,
T1_Size_Request,
0 /* FT_Size_SelectFunc */
};

View File

@ -208,12 +208,13 @@
FT_LOCAL_DEF( FT_Error )
T1_Get_Advances( T1_Face face,
T1_Get_Advances( FT_Face t1face, /* T1_Face */
FT_UInt first,
FT_UInt count,
FT_ULong load_flags,
FT_Int32 load_flags,
FT_Fixed* advances )
{
T1_Face face = (T1_Face)t1face;
T1_DecoderRec decoder;
T1_Font type1 = &face->type1;
PSAux_Service psaux = (PSAux_Service)face->psaux;
@ -265,14 +266,15 @@
FT_LOCAL_DEF( FT_Error )
T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
T1_Load_Glyph( FT_GlyphSlot t1glyph, /* T1_GlyphSlot */
FT_Size t1size, /* T1_Size */
FT_UInt glyph_index,
FT_Int32 load_flags )
{
T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph;
FT_Error error;
T1_DecoderRec decoder;
T1_Face face = (T1_Face)glyph->root.face;
T1_Face face = (T1_Face)t1glyph->face;
FT_Bool hinting;
T1_Font type1 = &face->type1;
PSAux_Service psaux = (PSAux_Service)face->psaux;
@ -303,10 +305,10 @@
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
if ( size )
if ( t1size )
{
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
glyph->x_scale = t1size->metrics.x_scale;
glyph->y_scale = t1size->metrics.y_scale;
}
else
{
@ -314,18 +316,18 @@
glyph->y_scale = 0x10000L;
}
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
t1glyph->outline.n_points = 0;
t1glyph->outline.n_contours = 0;
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
error = decoder_funcs->init( &decoder,
(FT_Face)face,
(FT_Size)size,
(FT_GlyphSlot)glyph,
t1glyph->face,
t1size,
t1glyph,
(FT_Byte**)type1->glyph_names,
face->blend,
FT_BOOL( hinting ),
@ -368,19 +370,19 @@
/* bearing the yMax */
if ( !error )
{
glyph->root.outline.flags &= FT_OUTLINE_OWNER;
glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
t1glyph->outline.flags &= FT_OUTLINE_OWNER;
t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
/* for composite glyphs, return only left side bearing and */
/* advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
FT_Slot_Internal internal = glyph->root.internal;
FT_Slot_Internal internal = t1glyph->internal;
glyph->root.metrics.horiBearingX =
t1glyph->metrics.horiBearingX =
FIXED_TO_INT( decoder.builder.left_bearing.x );
glyph->root.metrics.horiAdvance =
t1glyph->metrics.horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
internal->glyph_matrix = font_matrix;
@ -390,45 +392,45 @@
else
{
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
FT_Glyph_Metrics* metrics = &t1glyph->metrics;
FT_Vector advance;
/* copy the _unscaled_ advance width */
metrics->horiAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.linearHoriAdvance =
t1glyph->linearHoriAdvance =
FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.internal->glyph_transformed = 0;
t1glyph->internal->glyph_transformed = 0;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
/* make up vertical ones */
metrics->vertAdvance = ( face->type1.font_bbox.yMax -
face->type1.font_bbox.yMin ) >> 16;
glyph->root.linearVertAdvance = metrics->vertAdvance;
t1glyph->linearVertAdvance = metrics->vertAdvance;
}
else
{
metrics->vertAdvance =
FIXED_TO_INT( decoder.builder.advance.y );
glyph->root.linearVertAdvance =
t1glyph->linearVertAdvance =
FIXED_TO_INT( decoder.builder.advance.y );
}
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
if ( t1size && t1size->metrics.y_ppem < 24 )
t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
#if 1
/* apply the font matrix, if any */
if ( font_matrix.xx != 0x10000L || font_matrix.yy != font_matrix.xx ||
font_matrix.xy != 0 || font_matrix.yx != 0 )
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
FT_Outline_Transform( &t1glyph->outline, &font_matrix );
if ( font_offset.x || font_offset.y )
FT_Outline_Translate( &glyph->root.outline,
FT_Outline_Translate( &t1glyph->outline,
font_offset.x,
font_offset.y );
@ -466,7 +468,7 @@
}
/* compute the other metrics */
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
FT_Outline_Get_CBox( &t1glyph->outline, &cbox );
metrics->width = cbox.xMax - cbox.xMin;
metrics->height = cbox.yMax - cbox.yMin;
@ -484,8 +486,8 @@
/* Set control data to the glyph charstrings. Note that this is */
/* _not_ zero-terminated. */
glyph->root.control_data = (FT_Byte*)glyph_data.pointer;
glyph->root.control_len = glyph_data.length;
t1glyph->control_data = (FT_Byte*)glyph_data.pointer;
t1glyph->control_len = glyph_data.length;
}
@ -500,8 +502,8 @@
/* Set the control data to null - it is no longer available if */
/* loaded incrementally. */
glyph->root.control_data = 0;
glyph->root.control_len = 0;
t1glyph->control_data = 0;
t1glyph->control_len = 0;
}
#endif

View File

@ -4,7 +4,7 @@
/* */
/* Type 1 Glyph Loader (specification). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2008 by */
/* Copyright 1996-2001, 2002, 2003, 2008, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -32,15 +32,15 @@ FT_BEGIN_HEADER
FT_Pos* max_advance );
FT_LOCAL( FT_Error )
T1_Get_Advances( T1_Face face,
T1_Get_Advances( FT_Face face,
FT_UInt first,
FT_UInt count,
FT_ULong load_flags,
FT_Int32 load_flags,
FT_Fixed* advances );
FT_LOCAL( FT_Error )
T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
T1_Load_Glyph( FT_GlyphSlot glyph,
FT_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags );

View File

@ -72,8 +72,11 @@
FT_LOCAL_DEF( void )
T1_Size_Done( T1_Size size )
T1_Size_Done( FT_Size t1size ) /* T1_Size */
{
T1_Size size = (T1_Size)t1size;
if ( size->root.internal )
{
PSH_Globals_Funcs funcs;
@ -89,8 +92,9 @@
FT_LOCAL_DEF( FT_Error )
T1_Size_Init( T1_Size size )
T1_Size_Init( FT_Size t1size ) /* T1_Size */
{
T1_Size size = (T1_Size)t1size;
FT_Error error = T1_Err_Ok;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
@ -112,9 +116,10 @@
FT_LOCAL_DEF( FT_Error )
T1_Size_Request( T1_Size size,
T1_Size_Request( FT_Size t1size, /* T1_Size */
FT_Size_Request req )
{
T1_Size size = (T1_Size)t1size;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
@ -137,20 +142,20 @@
/*************************************************************************/
FT_LOCAL_DEF( void )
T1_GlyphSlot_Done( T1_GlyphSlot slot )
T1_GlyphSlot_Done( FT_GlyphSlot slot )
{
slot->root.internal->glyph_hints = 0;
slot->internal->glyph_hints = 0;
}
FT_LOCAL_DEF( FT_Error )
T1_GlyphSlot_Init( T1_GlyphSlot slot )
T1_GlyphSlot_Init( FT_GlyphSlot slot )
{
T1_Face face;
PSHinter_Service pshinter;
face = (T1_Face)slot->root.face;
face = (T1_Face)slot->face;
pshinter = (PSHinter_Service)face->pshinter;
if ( pshinter )
@ -158,15 +163,18 @@
FT_Module module;
module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
if (module)
module = FT_Get_Module( slot->face->driver->root.library,
"pshinter" );
if ( module )
{
T1_Hints_Funcs funcs;
funcs = pshinter->get_t1_funcs( module );
slot->root.internal->glyph_hints = (void*)funcs;
slot->internal->glyph_hints = (void*)funcs;
}
}
return 0;
}
@ -190,8 +198,9 @@
/* face :: A typeless pointer to the face object to destroy. */
/* */
FT_LOCAL_DEF( void )
T1_Face_Done( T1_Face face )
T1_Face_Done( FT_Face t1face ) /* T1_Face */
{
T1_Face face = (T1_Face)t1face;
FT_Memory memory;
T1_Font type1;
@ -289,11 +298,12 @@
/* */
FT_LOCAL_DEF( FT_Error )
T1_Face_Init( FT_Stream stream,
T1_Face face,
FT_Face t1face, /* T1_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
T1_Face face = (T1_Face)t1face;
FT_Error error;
FT_Service_PsCMaps psnames;
PSAux_Service psaux;
@ -576,7 +586,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
T1_Driver_Init( T1_Driver driver )
T1_Driver_Init( FT_Module driver )
{
FT_UNUSED( driver );
@ -596,7 +606,7 @@
/* driver :: A handle to the target Type 1 driver. */
/* */
FT_LOCAL_DEF( void )
T1_Driver_Done( T1_Driver driver )
T1_Driver_Done( FT_Module driver )
{
FT_UNUSED( driver );
}

View File

@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (specification). */
/* */
/* Copyright 1996-2001, 2002, 2006 by */
/* Copyright 1996-2001, 2002, 2006, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -34,17 +34,6 @@ FT_BEGIN_HEADER
typedef struct T1_Glyph_Hints_ T1_Glyph_Hints;
/*************************************************************************/
/* */
/* <Type> */
/* T1_Driver */
/* */
/* <Description> */
/* A handle to a Type 1 driver object. */
/* */
typedef struct T1_DriverRec_ *T1_Driver;
/*************************************************************************/
/* */
/* <Type> */
@ -106,14 +95,14 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
T1_Size_Done( T1_Size size );
T1_Size_Done( FT_Size size );
FT_LOCAL( FT_Error )
T1_Size_Request( T1_Size size,
T1_Size_Request( FT_Size size,
FT_Size_Request req );
FT_LOCAL( FT_Error )
T1_Size_Init( T1_Size size );
T1_Size_Init( FT_Size size );
/*************************************************************************/
@ -142,25 +131,25 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
T1_Face_Init( FT_Stream stream,
T1_Face face,
FT_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
FT_LOCAL( void )
T1_Face_Done( T1_Face face );
T1_Face_Done( FT_Face face );
FT_LOCAL( FT_Error )
T1_GlyphSlot_Init( T1_GlyphSlot slot );
T1_GlyphSlot_Init( FT_GlyphSlot slot );
FT_LOCAL( void )
T1_GlyphSlot_Done( T1_GlyphSlot slot );
T1_GlyphSlot_Done( FT_GlyphSlot slot );
FT_LOCAL( FT_Error )
T1_Driver_Init( T1_Driver driver );
T1_Driver_Init( FT_Module driver );
FT_LOCAL( void )
T1_Driver_Done( T1_Driver driver );
T1_Driver_Done( FT_Module driver );
FT_END_HEADER