* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,

cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.

* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
This commit is contained in:
Werner Lemberg 2004-05-07 07:08:14 +00:00
parent 3bcad43998
commit 2b54eba36b
6 changed files with 188 additions and 126 deletions

View File

@ -1,3 +1,29 @@
2004-05-06 Werner Lemberg <wl@gnu.org>
* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-04 Steve Hartwell <shspamsink@comcast.net> 2004-05-04 Steve Hartwell <shspamsink@comcast.net>
* src/truetype/ttobjs.c (tt_driver_done): Fix typo. * src/truetype/ttobjs.c (tt_driver_done): Fix typo.

View File

@ -203,8 +203,8 @@
/* reset the size object if necessary */ /* reset the size object if necessary */
if ( size ) if ( size )
{ {
/* these two object must have the same parent */ /* these two objects must have the same parent */
if ( size->root.face != slot->root.face ) if ( cffsize->face != cffslot->face )
return CFF_Err_Invalid_Face_Handle; return CFF_Err_Invalid_Face_Handle;
} }

View File

@ -46,7 +46,7 @@
/* */ /* */
/* SIZE FUNCTIONS */ /* SIZE FUNCTIONS */
/* */ /* */
/* Note that we store the global hints in the size's "internal" root */ /* Note that we store the global hints in the size's `internal' root */
/* field. */ /* field. */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
@ -140,16 +140,16 @@
CFF_Size size = (CFF_Size)cffsize; CFF_Size size = (CFF_Size)cffsize;
if ( size->root.internal ) if ( cffsize->internal )
{ {
PSH_Globals_Funcs funcs; PSH_Globals_Funcs funcs;
funcs = cff_size_get_globals_funcs( size ); funcs = cff_size_get_globals_funcs( size );
if ( funcs ) if ( funcs )
funcs->destroy( (PSH_Globals)size->root.internal ); funcs->destroy( (PSH_Globals)cffsize->internal );
size->root.internal = 0; cffsize->internal = 0;
} }
} }
@ -165,7 +165,7 @@
if ( funcs ) if ( funcs )
{ {
PSH_Globals globals; PSH_Globals globals;
CFF_Face face = (CFF_Face)size->root.face; CFF_Face face = (CFF_Face)cffsize->face;
CFF_Font font = (CFF_FontRec *)face->extra.data; CFF_Font font = (CFF_FontRec *)face->extra.data;
CFF_SubFont subfont = &font->top_font; CFF_SubFont subfont = &font->top_font;
@ -219,9 +219,9 @@
priv.lenIV = cpriv->lenIV; priv.lenIV = cpriv->lenIV;
} }
error = funcs->create( size->root.face->memory, &priv, &globals ); error = funcs->create( cffsize->face->memory, &priv, &globals );
if ( !error ) if ( !error )
size->root.internal = (FT_Size_Internal)(void*)globals; cffsize->internal = (FT_Size_Internal)(void*)globals;
} }
return error; return error;
@ -236,16 +236,16 @@
CFF_Size size = (CFF_Size)cffsize; CFF_Size size = (CFF_Size)cffsize;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
FT_Error error = CFF_Err_Ok; FT_Error error = CFF_Err_Ok;
FT_Face face = size->root.face; FT_Face face = cffsize->face;
FT_UNUSED( char_width ); FT_UNUSED( char_width );
FT_UNUSED( char_height ); FT_UNUSED( char_height );
if ( funcs ) if ( funcs )
error = funcs->set_scale( (PSH_Globals)size->root.internal, error = funcs->set_scale( (PSH_Globals)cffsize->internal,
size->root.metrics.x_scale, cffsize->metrics.x_scale,
size->root.metrics.y_scale, cffsize->metrics.y_scale,
0, 0 ); 0, 0 );
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@ -255,7 +255,7 @@
error = sbit_size_reset( size ); error = sbit_size_reset( size );
if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) ) if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
size->root.metrics = size->strike_metrics; cffsize->metrics = size->strike_metrics;
} }
#endif #endif
@ -290,19 +290,16 @@
/*************************************************************************/ /*************************************************************************/
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
cff_slot_done( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */ cff_slot_done( FT_GlyphSlot slot )
{ {
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; slot->internal->glyph_hints = 0;
slot->root.internal->glyph_hints = 0;
} }
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
cff_slot_init( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */ cff_slot_init( FT_GlyphSlot slot )
{ {
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; CFF_Face face = (CFF_Face)slot->face;
CFF_Face face = (CFF_Face)slot->root.face;
CFF_Font font = (CFF_FontRec *)face->extra.data; CFF_Font font = (CFF_FontRec *)face->extra.data;
PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; PSHinter_Service pshinter = (PSHinter_Service)font->pshinter;
@ -312,7 +309,7 @@
FT_Module module; FT_Module module;
module = FT_Get_Module( slot->root.face->driver->root.library, module = FT_Get_Module( slot->face->driver->root.library,
"pshinter" ); "pshinter" );
if ( module ) if ( module )
{ {
@ -320,7 +317,7 @@
funcs = pshinter->get_t2_funcs( module ); funcs = pshinter->get_t2_funcs( module );
slot->root.internal->glyph_hints = (void*)funcs; slot->internal->glyph_hints = (void*)funcs;
} }
} }
@ -379,14 +376,14 @@
goto Bad_Format; goto Bad_Format;
#else #else
sfnt = (SFNT_Service)FT_Get_Module_Interface( sfnt = (SFNT_Service)FT_Get_Module_Interface(
face->root.driver->root.library, "sfnt" ); cffface->driver->root.library, "sfnt" );
if ( !sfnt ) if ( !sfnt )
goto Bad_Format; goto Bad_Format;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
pshinter = (PSHinter_Service)FT_Get_Module_Interface( pshinter = (PSHinter_Service)FT_Get_Module_Interface(
face->root.driver->root.library, "pshinter" ); cffface->driver->root.library, "pshinter" );
#endif #endif
/* create input stream from resource */ /* create input stream from resource */
@ -451,8 +448,7 @@
{ {
CFF_Font cff; CFF_Font cff;
CFF_FontRecDict dict; CFF_FontRecDict dict;
FT_Memory memory = face->root.memory; FT_Memory memory = cffface->memory;
FT_Face root;
FT_Int32 flags; FT_Int32 flags;
@ -470,8 +466,7 @@
/* Complement the root flags with some interesting information. */ /* Complement the root flags with some interesting information. */
/* Note that this is only necessary for pure CFF and CEF fonts. */ /* Note that this is only necessary for pure CFF and CEF fonts. */
root = &face->root; cffface->num_glyphs = cff->num_glyphs;
root->num_glyphs = cff->num_glyphs;
dict = &cff->top_font.font_dict; dict = &cff->top_font.font_dict;
@ -492,46 +487,46 @@
/* Set up num_faces. */ /* Set up num_faces. */
root->num_faces = cff->num_faces; cffface->num_faces = cff->num_faces;
/* compute number of glyphs */ /* compute number of glyphs */
if ( dict->cid_registry != 0xFFFFU ) if ( dict->cid_registry != 0xFFFFU )
root->num_glyphs = dict->cid_count; cffface->num_glyphs = dict->cid_count;
else else
root->num_glyphs = cff->charstrings_index.count; cffface->num_glyphs = cff->charstrings_index.count;
/* set global bbox, as well as EM size */ /* set global bbox, as well as EM size */
root->bbox.xMin = dict->font_bbox.xMin >> 16; cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
root->bbox.yMin = dict->font_bbox.yMin >> 16; cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
root->ascender = (FT_Short)( root->bbox.yMax ); cffface->ascender = (FT_Short)( cffface->bbox.yMax );
root->descender = (FT_Short)( root->bbox.yMin ); cffface->descender = (FT_Short)( cffface->bbox.yMin );
root->height = (FT_Short)( cffface->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 ); ( ( cffface->ascender - cffface->descender ) * 12 ) / 10 );
if ( dict->units_per_em ) if ( dict->units_per_em )
root->units_per_EM = dict->units_per_em; cffface->units_per_EM = dict->units_per_em;
else else
root->units_per_EM = 1000; cffface->units_per_EM = 1000;
root->underline_position = cffface->underline_position =
(FT_Short)( dict->underline_position >> 16 ); (FT_Short)( dict->underline_position >> 16 );
root->underline_thickness = cffface->underline_thickness =
(FT_Short)( dict->underline_thickness >> 16 ); (FT_Short)( dict->underline_thickness >> 16 );
/* retrieve font family & style name */ /* retrieve font family & style name */
root->family_name = cff_index_get_name( &cff->name_index, cffface->family_name = cff_index_get_name( &cff->name_index,
face_index ); face_index );
if ( root->family_name ) if ( cffface->family_name )
{ {
char* full = cff_index_get_sid_string( &cff->string_index, char* full = cff_index_get_sid_string( &cff->string_index,
dict->full_name, dict->full_name,
psnames ); psnames );
char* fullp = full; char* fullp = full;
char* family = root->family_name; char* family = cffface->family_name;
/* We try to extract the style name from the full name. */ /* We try to extract the style name from the full name. */
/* We need to ignore spaces and dashes during the search. */ /* We need to ignore spaces and dashes during the search. */
@ -584,14 +579,14 @@
/* do we have a `/FontName' for a CID-keyed font? */ /* do we have a `/FontName' for a CID-keyed font? */
if ( cid_font_name ) if ( cid_font_name )
root->family_name = cid_font_name; cffface->family_name = cid_font_name;
} }
if ( style_name ) if ( style_name )
root->style_name = style_name; cffface->style_name = style_name;
else else
/* assume "Regular" style if we don't know better */ /* assume "Regular" style if we don't know better */
root->style_name = cff_strcpy( memory, (char *)"Regular" ); cffface->style_name = cff_strcpy( memory, (char *)"Regular" );
/*******************************************************************/ /*******************************************************************/
/* */ /* */
@ -614,7 +609,7 @@
flags |= FT_FACE_FLAG_KERNING; flags |= FT_FACE_FLAG_KERNING;
#endif #endif
root->face_flags = flags; cffface->face_flags = flags;
/*******************************************************************/ /*******************************************************************/
/* */ /* */
@ -638,14 +633,14 @@
FT_FREE( weight ); FT_FREE( weight );
} }
root->style_flags = flags; cffface->style_flags = flags;
} }
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
/* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
/* has unset this flag because of the 3.0 `post' table */ /* has unset this flag because of the 3.0 `post' table */
if ( dict->cid_registry == 0xFFFFU ) if ( dict->cid_registry == 0xFFFFU )
root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
#endif #endif
/*******************************************************************/ /*******************************************************************/
@ -663,9 +658,9 @@
CFF_Encoding encoding = &cff->encoding; CFF_Encoding encoding = &cff->encoding;
for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ ) for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )
{ {
cmap = root->charmaps[nn]; cmap = cffface->charmaps[nn];
/* Windows Unicode (3,1)? */ /* Windows Unicode (3,1)? */
if ( cmap->platform_id == 3 && cmap->encoding_id == 1 ) if ( cmap->platform_id == 3 && cmap->encoding_id == 1 )
@ -682,18 +677,18 @@
goto Exit; goto Exit;
/* we didn't find a Unicode charmap -- synthetize one */ /* we didn't find a Unicode charmap -- synthetize one */
cmaprec.face = root; cmaprec.face = cffface;
cmaprec.platform_id = 3; cmaprec.platform_id = 3;
cmaprec.encoding_id = 1; cmaprec.encoding_id = 1;
cmaprec.encoding = FT_ENCODING_UNICODE; cmaprec.encoding = FT_ENCODING_UNICODE;
nn = (FT_UInt)root->num_charmaps; nn = (FT_UInt)cffface->num_charmaps;
FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL ); FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
/* if no Unicode charmap was previously selected, select this one */ /* if no Unicode charmap was previously selected, select this one */
if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps ) if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
root->charmap = root->charmaps[nn]; cffface->charmap = cffface->charmaps[nn];
Skip_Unicode: Skip_Unicode:
if ( encoding->count > 0 ) if ( encoding->count > 0 )
@ -701,7 +696,7 @@
FT_CMap_Class clazz; FT_CMap_Class clazz;
cmaprec.face = root; cmaprec.face = cffface;
cmaprec.platform_id = 7; /* Adobe platform id */ cmaprec.platform_id = 7; /* Adobe platform id */
if ( encoding->offset == 0 ) if ( encoding->offset == 0 )
@ -741,7 +736,7 @@
cff_face_done( FT_Face cffface ) /* CFF_Face */ cff_face_done( FT_Face cffface ) /* CFF_Face */
{ {
CFF_Face face = (CFF_Face)cffface; CFF_Face face = (CFF_Face)cffface;
FT_Memory memory = face->root.memory; FT_Memory memory = cffface->memory;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; SFNT_Service sfnt = (SFNT_Service)face->sfnt;

View File

@ -131,10 +131,10 @@ FT_BEGIN_HEADER
FT_UInt vert_resolution ); FT_UInt vert_resolution );
FT_LOCAL( void ) FT_LOCAL( void )
cff_slot_done( FT_GlyphSlot slot ); /* CFF_GlyphSlot */ cff_slot_done( FT_GlyphSlot slot );
FT_LOCAL( FT_Error ) FT_LOCAL( FT_Error )
cff_slot_init( FT_GlyphSlot slot ); /* CFF_GlyphSlot */ cff_slot_init( FT_GlyphSlot slot );
/*************************************************************************/ /*************************************************************************/

View File

@ -48,9 +48,10 @@ THE SOFTWARE.
#include FT_SERVICE_BDF_H #include FT_SERVICE_BDF_H
#include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_XFREE86_NAME_H
typedef struct PCF_CMapRec_ typedef struct PCF_CMapRec_
{ {
FT_CMapRec cmap; FT_CMapRec root;
FT_UInt num_encodings; FT_UInt num_encodings;
PCF_Encoding encodings; PCF_Encoding encodings;
@ -58,9 +59,13 @@ THE SOFTWARE.
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
pcf_cmap_init( PCF_CMap cmap ) pcf_cmap_init( FT_CMap pcfcmap, /* PCF_CMap */
FT_Pointer init_data )
{ {
PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap ); PCF_CMap cmap = (PCF_CMap)pcfcmap;
PCF_Face face = (PCF_Face)FT_CMAP_FACE( pcfcmap );
FT_UNUSED( init_data );
cmap->num_encodings = (FT_UInt)face->nencodings; cmap->num_encodings = (FT_UInt)face->nencodings;
@ -71,20 +76,24 @@ THE SOFTWARE.
FT_CALLBACK_DEF( void ) FT_CALLBACK_DEF( void )
pcf_cmap_done( PCF_CMap cmap ) pcf_cmap_done( FT_CMap pcfcmap ) /* PCF_CMap */
{ {
PCF_CMap cmap = (PCF_CMap)pcfcmap;
cmap->encodings = NULL; cmap->encodings = NULL;
cmap->num_encodings = 0; cmap->num_encodings = 0;
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt )
pcf_cmap_char_index( PCF_CMap cmap, pcf_cmap_char_index( FT_CMap pcfcmap, /* PCF_CMap */
FT_UInt32 charcode ) FT_UInt32 charcode )
{ {
PCF_CMap cmap = (PCF_CMap)pcfcmap;
PCF_Encoding encodings = cmap->encodings; PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid; FT_UInt min, max, mid;
FT_UInt result = 0; FT_UInt result = 0;
min = 0; min = 0;
@ -115,13 +124,14 @@ THE SOFTWARE.
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt )
pcf_cmap_char_next( PCF_CMap cmap, pcf_cmap_char_next( FT_CMap pcfcmap, /* PCF_CMap */
FT_UInt32 *acharcode ) FT_UInt32 *acharcode )
{ {
PCF_CMap cmap = (PCF_CMap)pcfcmap;
PCF_Encoding encodings = cmap->encodings; PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid; FT_UInt min, max, mid;
FT_UInt32 charcode = *acharcode + 1; FT_UInt32 charcode = *acharcode + 1;
FT_UInt result = 0; FT_UInt result = 0;
min = 0; min = 0;
@ -163,10 +173,10 @@ THE SOFTWARE.
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class = FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class =
{ {
sizeof( PCF_CMapRec ), sizeof( PCF_CMapRec ),
(FT_CMap_InitFunc) pcf_cmap_init, pcf_cmap_init,
(FT_CMap_DoneFunc) pcf_cmap_done, pcf_cmap_done,
(FT_CMap_CharIndexFunc)pcf_cmap_char_index, pcf_cmap_char_index,
(FT_CMap_CharNextFunc) pcf_cmap_char_next pcf_cmap_char_next
}; };
@ -180,9 +190,10 @@ THE SOFTWARE.
#define FT_COMPONENT trace_pcfdriver #define FT_COMPONENT trace_pcfdriver
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( void )
PCF_Face_Done( PCF_Face face ) PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */
{ {
PCF_Face face = (PCF_Face)pcfface;
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
@ -208,31 +219,30 @@ THE SOFTWARE.
} }
FT_FREE( face->toc.tables ); FT_FREE( face->toc.tables );
FT_FREE( face->root.family_name ); FT_FREE( pcfface->family_name );
FT_FREE( face->root.available_sizes ); FT_FREE( pcfface->available_sizes );
FT_FREE( face->charset_encoding ); FT_FREE( face->charset_encoding );
FT_FREE( face->charset_registry ); FT_FREE( face->charset_registry );
FT_TRACE4(( "PCF_Face_Done: done face\n" )); FT_TRACE4(( "PCF_Face_Done: done face\n" ));
/* close gzip/LZW stream if any */ /* close gzip/LZW stream if any */
if ( face->root.stream == &face->gzip_stream ) if ( pcfface->stream == &face->gzip_stream )
{ {
FT_Stream_Close( &face->gzip_stream ); FT_Stream_Close( &face->gzip_stream );
face->root.stream = face->gzip_source; pcfface->stream = face->gzip_source;
} }
return PCF_Err_Ok;
} }
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
PCF_Face_Init( FT_Stream stream, PCF_Face_Init( FT_Stream stream,
PCF_Face face, FT_Face pcfface, /* PCF_Face */
FT_Int face_index, FT_Int face_index,
FT_Int num_params, FT_Int num_params,
FT_Parameter* params ) FT_Parameter* params )
{ {
PCF_Face face = (PCF_Face)pcfface;
FT_Error error = PCF_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_UNUSED( num_params ); FT_UNUSED( num_params );
@ -267,9 +277,9 @@ THE SOFTWARE.
goto Fail; goto Fail;
face->gzip_source = stream; face->gzip_source = stream;
face->root.stream = &face->gzip_stream; pcfface->stream = &face->gzip_stream;
stream = face->root.stream; stream = pcfface->stream;
error = pcf_load_font( stream, face ); error = pcf_load_font( stream, face );
if ( error ) if ( error )
@ -278,9 +288,9 @@ THE SOFTWARE.
else else
{ {
face->gzip_source = stream; face->gzip_source = stream;
face->root.stream = &face->gzip_stream; pcfface->stream = &face->gzip_stream;
stream = face->root.stream; stream = pcfface->stream;
error = pcf_load_font( stream, face ); error = pcf_load_font( stream, face );
if ( error ) if ( error )
@ -337,8 +347,8 @@ THE SOFTWARE.
#if 0 #if 0
/* Select default charmap */ /* Select default charmap */
if (face->root.num_charmaps) if ( pcfface->num_charmaps )
face->root.charmap = face->root.charmaps[0]; pcfface->charmap = pcfface->charmaps[0];
#endif #endif
} }
} }
@ -353,10 +363,15 @@ THE SOFTWARE.
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
PCF_Set_Pixel_Size( FT_Size size ) PCF_Set_Pixel_Size( FT_Size size,
FT_UInt pixel_width,
FT_UInt pixel_height )
{ {
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_UNUSED( pixel_width );
FT_UNUSED( pixel_height );
FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem, FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
@ -384,7 +399,23 @@ THE SOFTWARE.
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
PCF_Set_Point_Size( FT_Size size,
FT_F26Dot6 char_width,
FT_F26Dot6 char_height,
FT_UInt horz_resolution,
FT_UInt vert_resolution )
{
FT_UNUSED( char_width );
FT_UNUSED( char_height );
FT_UNUSED( horz_resolution );
FT_UNUSED( vert_resolution );
return PCF_Set_Pixel_Size( size, 0, 0 );
}
FT_CALLBACK_DEF( FT_Error )
PCF_Glyph_Load( FT_GlyphSlot slot, PCF_Glyph_Load( FT_GlyphSlot slot,
FT_Size size, FT_Size size,
FT_UInt glyph_index, FT_UInt glyph_index,
@ -568,7 +599,7 @@ THE SOFTWARE.
}; };
static FT_Module_Interface FT_CALLBACK_DEF( FT_Module_Interface )
pcf_driver_requester( FT_Module module, pcf_driver_requester( FT_Module module,
const char* name ) const char* name )
{ {
@ -592,30 +623,30 @@ THE SOFTWARE.
0, 0,
(FT_Module_Constructor)0, 0,
(FT_Module_Destructor) 0, 0,
(FT_Module_Requester) pcf_driver_requester pcf_driver_requester
}, },
sizeof( PCF_FaceRec ), sizeof ( PCF_FaceRec ),
sizeof( FT_SizeRec ), sizeof ( FT_SizeRec ),
sizeof( FT_GlyphSlotRec ), sizeof ( FT_GlyphSlotRec ),
(FT_Face_InitFunc) PCF_Face_Init, PCF_Face_Init,
(FT_Face_DoneFunc) PCF_Face_Done, PCF_Face_Done,
(FT_Size_InitFunc) 0, 0, /* FT_Size_InitFunc */
(FT_Size_DoneFunc) 0, 0, /* FT_Size_DoneFunc */
(FT_Slot_InitFunc) 0, 0, /* FT_Slot_InitFunc */
(FT_Slot_DoneFunc) 0, 0, /* FT_Slot_DoneFunc */
(FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size, PCF_Set_Point_Size,
(FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size, PCF_Set_Pixel_Size,
(FT_Slot_LoadFunc) PCF_Glyph_Load, PCF_Glyph_Load,
(FT_Face_GetKerningFunc) 0, 0, /* FT_Face_GetKerningFunc */
(FT_Face_AttachFunc) 0, 0, /* FT_Face_AttachFunc */
(FT_Face_GetAdvancesFunc) 0 0 /* FT_Face_GetAdvancesFunc */
}; };

View File

@ -738,15 +738,25 @@
if ( ((TT_Face)load->face)->doblend ) if ( ((TT_Face)load->face)->doblend )
{ {
/* Deltas apply to the unscaled data. */ /* Deltas apply to the unscaled data. */
FT_Vector* deltas; FT_Vector* deltas;
FT_Memory memory = load->face->memory; FT_Memory memory = load->face->memory;
FT_UInt i; FT_StreamRec saved_stream = *(load->stream);
FT_UInt i;
if ( ( error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face), /* TT_Vary_Get_Glyph_Deltas uses a frame, thus we have to save */
load->glyph_index, /* (and restore) the current one */
&deltas, load->stream->cursor = 0;
n_points ) ) ) load->stream->limit = 0;
error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face),
load->glyph_index,
&deltas,
n_points );
*(load->stream) = saved_stream;
if ( error )
goto Exit; goto Exit;
for ( i = 0; i < n_points; ++i ) for ( i = 0; i < n_points; ++i )
@ -863,7 +873,7 @@
#endif #endif
FT_Error error; FT_Error error;
TT_Face face = (TT_Face)loader->face; TT_Face face = (TT_Face)loader->face;
FT_ULong offset; FT_ULong offset;
FT_Int contours_count; FT_Int contours_count;
FT_UInt num_points, count; FT_UInt num_points, count;
@ -872,9 +882,9 @@
FT_Bool opened_frame = 0; FT_Bool opened_frame = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL #ifdef FT_CONFIG_OPTION_INCREMENTAL
struct FT_StreamRec_ inc_stream; FT_StreamRec inc_stream;
FT_Data glyph_data; FT_Data glyph_data;
FT_Bool glyph_data_loaded = 0; FT_Bool glyph_data_loaded = 0;
#endif #endif
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT