* include/freetype/internal/cfftypes.h, src/cff/*.c: updating the

type definitions of the CFF font driver

        (i.e. CFF_Font  => CFF_FontRec
              CFF_Font* => CFF_Font, etc...)
This commit is contained in:
David Turner 2002-03-14 08:57:10 +00:00
parent 9657ef0598
commit ab4fc4da58
10 changed files with 90 additions and 85 deletions

View File

@ -7,6 +7,11 @@
(i.e. FT_AutoHinter_Interface => FT_AutoHinter_ServiceRec, (i.e. FT_AutoHinter_Interface => FT_AutoHinter_ServiceRec,
FT_AutoHinter_Interface* => FT_AutoHinter_Service, etc..) FT_AutoHinter_Interface* => FT_AutoHinter_Service, etc..)
* include/freetype/internal/cfftypes.h, src/cff/*.c: updating the
type definitions of the CFF font driver
(i.e. CFF_Font => CFF_FontRec
CFF_Font* => CFF_Font, etc...)
2002-03-13 Antoine Leca <antoine@oriolnet.com> 2002-03-13 Antoine Leca <antoine@oriolnet.com>

View File

@ -74,7 +74,7 @@ FT_BEGIN_HEADER
} CFF_EncodingRec, *CFF_Encoding; } CFF_EncodingRec, *CFF_Encoding;
typedef struct CFF_Charset_ typedef struct CFF_CharsetRec_
{ {
FT_UInt format; FT_UInt format;
@ -82,10 +82,10 @@ FT_BEGIN_HEADER
FT_UShort* sids; FT_UShort* sids;
} CFF_Charset; } CFF_CharsetRec, *CFF_Charset;
typedef struct CFF_Font_Dict_ typedef struct CFF_FontRecDictRec_
{ {
FT_UInt version; FT_UInt version;
FT_UInt notice; FT_UInt notice;
@ -129,7 +129,7 @@ FT_BEGIN_HEADER
FT_ULong cid_fd_select_offset; FT_ULong cid_fd_select_offset;
FT_UInt cid_font_name; FT_UInt cid_font_name;
} CFF_Font_Dict; } CFF_FontRecDictRec, *CFF_FontRecDict;
typedef struct CFF_PrivateRec_ typedef struct CFF_PrivateRec_
@ -167,7 +167,7 @@ FT_BEGIN_HEADER
} CFF_PrivateRec, *CFF_Private; } CFF_PrivateRec, *CFF_Private;
typedef struct CFF_FD_Select_ typedef struct CFF_FDSelectRec_
{ {
FT_Byte format; FT_Byte format;
FT_UInt range_count; FT_UInt range_count;
@ -181,67 +181,67 @@ FT_BEGIN_HEADER
FT_UInt cache_count; FT_UInt cache_count;
FT_Byte cache_fd; FT_Byte cache_fd;
} CFF_FD_Select; } CFF_FDSelectRec, *CFF_FDSelect;
/* A SubFont packs a font dict and a private dict together. They are */ /* A SubFont packs a font dict and a private dict together. They are */
/* needed to support CID-keyed CFF fonts. */ /* needed to support CID-keyed CFF fonts. */
typedef struct CFF_SubFont_ typedef struct CFF_SubFontRec_
{ {
CFF_Font_Dict font_dict; CFF_FontRecDictRec font_dict;
CFF_PrivateRec private_dict; CFF_PrivateRec private_dict;
CFF_IndexRec local_subrs_index; CFF_IndexRec local_subrs_index;
FT_UInt num_local_subrs; FT_UInt num_local_subrs;
FT_Byte** local_subrs; FT_Byte** local_subrs;
} CFF_SubFont; } CFF_SubFontRec, *CFF_SubFont;
/* maximum number of sub-fonts in a CID-keyed file */ /* maximum number of sub-fonts in a CID-keyed file */
#define CFF_MAX_CID_FONTS 16 #define CFF_MAX_CID_FONTS 16
typedef struct CFF_Font_ typedef struct CFF_FontRec_
{ {
FT_Stream stream; FT_Stream stream;
FT_Memory memory; FT_Memory memory;
FT_UInt num_faces; FT_UInt num_faces;
FT_UInt num_glyphs; FT_UInt num_glyphs;
FT_Byte version_major; FT_Byte version_major;
FT_Byte version_minor; FT_Byte version_minor;
FT_Byte header_size; FT_Byte header_size;
FT_Byte absolute_offsize; FT_Byte absolute_offsize;
CFF_IndexRec name_index; CFF_IndexRec name_index;
CFF_IndexRec top_dict_index; CFF_IndexRec top_dict_index;
CFF_IndexRec string_index; CFF_IndexRec string_index;
CFF_IndexRec global_subrs_index; CFF_IndexRec global_subrs_index;
CFF_EncodingRec encoding; CFF_EncodingRec encoding;
CFF_Charset charset; CFF_CharsetRec charset;
CFF_IndexRec charstrings_index; CFF_IndexRec charstrings_index;
CFF_IndexRec font_dict_index; CFF_IndexRec font_dict_index;
CFF_IndexRec private_index; CFF_IndexRec private_index;
CFF_IndexRec local_subrs_index; CFF_IndexRec local_subrs_index;
FT_String* font_name; FT_String* font_name;
FT_UInt num_global_subrs; FT_UInt num_global_subrs;
FT_Byte** global_subrs; FT_Byte** global_subrs;
CFF_SubFont top_font; CFF_SubFontRec top_font;
FT_UInt num_subfonts; FT_UInt num_subfonts;
CFF_SubFont* subfonts[CFF_MAX_CID_FONTS]; CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
CFF_FD_Select fd_select; CFF_FDSelectRec fd_select;
/* interface to PostScript hinter */ /* interface to PostScript hinter */
void* pshinter; void* pshinter;
} CFF_Font; } CFF_FontRec, *CFF_Font;
FT_END_HEADER FT_END_HEADER

View File

@ -228,7 +228,7 @@
FT_Pointer buffer, FT_Pointer buffer,
FT_UInt buffer_max ) FT_UInt buffer_max )
{ {
CFF_Font* font = (CFF_Font*)face->extra.data; CFF_Font font = (CFF_Font)face->extra.data;
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
FT_String* gname; FT_String* gname;
FT_UShort sid; FT_UShort sid;
@ -383,8 +383,8 @@
cff_get_name_index( CFF_Face face, cff_get_name_index( CFF_Face face,
FT_String* glyph_name ) FT_String* glyph_name )
{ {
CFF_Font* cff; CFF_Font cff;
CFF_Charset* charset; CFF_Charset charset;
PSNames_Service psnames; PSNames_Service psnames;
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
FT_String* name; FT_String* name;
@ -393,7 +393,7 @@
FT_Int result; FT_Int result;
cff = (CFF_Font *)face->extra.data; cff = (CFF_FontRec *)face->extra.data;
charset = &cff->charset; charset = &cff->charset;
psnames = (PSNames_Service)FT_Get_Module_Interface( psnames = (PSNames_Service)FT_Get_Module_Interface(

View File

@ -352,7 +352,7 @@
CFF_GlyphSlot slot, CFF_GlyphSlot slot,
FT_Bool hinting ) FT_Bool hinting )
{ {
CFF_Font* cff = (CFF_Font*)face->extra.data; CFF_Font cff = (CFF_Font)face->extra.data;
/* clear everything */ /* clear everything */
@ -373,8 +373,8 @@
CFF_Prepare_Decoder( CFF_Decoder* decoder, CFF_Prepare_Decoder( CFF_Decoder* decoder,
FT_UInt glyph_index ) FT_UInt glyph_index )
{ {
CFF_Font* cff = (CFF_Font*)decoder->builder.face->extra.data; CFF_Font cff = (CFF_Font)decoder->builder.face->extra.data;
CFF_SubFont* sub = &cff->top_font; CFF_SubFont sub = &cff->top_font;
/* manage CID fonts */ /* manage CID fonts */
@ -532,7 +532,7 @@
static FT_Int static FT_Int
cff_lookup_glyph_by_stdcharcode( CFF_Font* cff, cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
FT_Int charcode ) FT_Int charcode )
{ {
FT_UInt n; FT_UInt n;
@ -567,7 +567,7 @@
FT_Int bchar_index, achar_index, n_base_points; FT_Int bchar_index, achar_index, n_base_points;
FT_Outline* base = decoder->builder.base; FT_Outline* base = decoder->builder.base;
TT_Face face = decoder->builder.face; TT_Face face = decoder->builder.face;
CFF_Font* cff = (CFF_Font*)(face->extra.data); CFF_Font cff = (CFF_Font)(face->extra.data);
FT_Vector left_bearing, advance; FT_Vector left_bearing, advance;
FT_Byte* charstring; FT_Byte* charstring;
FT_ULong charstring_len; FT_ULong charstring_len;
@ -2115,7 +2115,7 @@
FT_Error error = 0; FT_Error error = 0;
CFF_Decoder decoder; CFF_Decoder decoder;
FT_Int glyph_index; FT_Int glyph_index;
CFF_Font* cff = (CFF_Font*)face->other; CFF_Font cff = (CFF_Font)face->other;
*max_advance = 0; *max_advance = 0;
@ -2185,7 +2185,7 @@
CFF_Decoder decoder; CFF_Decoder decoder;
TT_Face face = (TT_Face)glyph->root.face; TT_Face face = (TT_Face)glyph->root.face;
FT_Bool hinting; FT_Bool hinting;
CFF_Font* cff = (CFF_Font*)face->extra.data; CFF_Font cff = (CFF_Font)face->extra.data;
FT_Matrix font_matrix; FT_Matrix font_matrix;
FT_Vector font_offset; FT_Vector font_offset;

View File

@ -132,7 +132,7 @@ FT_BEGIN_HEADER
typedef struct CFF_Decoder_ typedef struct CFF_Decoder_
{ {
CFF_Builder builder; CFF_Builder builder;
CFF_Font* cff; CFF_Font cff;
FT_Fixed stack[CFF_MAX_OPERANDS + 1]; FT_Fixed stack[CFF_MAX_OPERANDS + 1];
FT_Fixed* top; FT_Fixed* top;

View File

@ -1357,7 +1357,7 @@
static void static void
CFF_Done_FD_Select( CFF_FD_Select* select, CFF_Done_FD_Select( CFF_FDSelect select,
FT_Stream stream ) FT_Stream stream )
{ {
if ( select->data ) if ( select->data )
@ -1370,7 +1370,7 @@
static FT_Error static FT_Error
CFF_Load_FD_Select( CFF_FD_Select* select, CFF_Load_FD_Select( CFF_FDSelect select,
FT_UInt num_glyphs, FT_UInt num_glyphs,
FT_Stream stream, FT_Stream stream,
FT_ULong offset ) FT_ULong offset )
@ -1414,7 +1414,7 @@
FT_LOCAL_DEF( FT_Byte ) FT_LOCAL_DEF( FT_Byte )
CFF_Get_FD( CFF_FD_Select* select, CFF_Get_FD( CFF_FDSelect select,
FT_UInt glyph_index ) FT_UInt glyph_index )
{ {
FT_Byte fd = 0; FT_Byte fd = 0;
@ -1500,7 +1500,7 @@
static void static void
CFF_Done_Charset( CFF_Charset* charset, CFF_Done_Charset( CFF_Charset charset,
FT_Stream stream ) FT_Stream stream )
{ {
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
@ -1514,7 +1514,7 @@
static FT_Error static FT_Error
CFF_Load_Charset( CFF_Charset* charset, CFF_Load_Charset( CFF_Charset charset,
FT_UInt num_glyphs, FT_UInt num_glyphs,
FT_Stream stream, FT_Stream stream,
FT_ULong base_offset, FT_ULong base_offset,
@ -1694,7 +1694,7 @@
static FT_Error static FT_Error
CFF_Load_Encoding( CFF_Encoding encoding, CFF_Load_Encoding( CFF_Encoding encoding,
CFF_Charset* charset, CFF_Charset charset,
FT_UInt num_glyphs, FT_UInt num_glyphs,
FT_Stream stream, FT_Stream stream,
FT_ULong base_offset, FT_ULong base_offset,
@ -1957,7 +1957,7 @@
static FT_Error static FT_Error
CFF_Load_SubFont( CFF_SubFont* font, CFF_Load_SubFont( CFF_SubFont font,
CFF_Index idx, CFF_Index idx,
FT_UInt font_index, FT_UInt font_index,
FT_Stream stream, FT_Stream stream,
@ -1967,7 +1967,7 @@
CFF_Parser parser; CFF_Parser parser;
FT_Byte* dict; FT_Byte* dict;
FT_ULong dict_len; FT_ULong dict_len;
CFF_Font_Dict* top = &font->font_dict; CFF_FontRecDict top = &font->font_dict;
CFF_Private priv = &font->private_dict; CFF_Private priv = &font->private_dict;
@ -2046,7 +2046,7 @@
static void static void
CFF_Done_SubFont( FT_Memory memory, CFF_Done_SubFont( FT_Memory memory,
CFF_SubFont* subfont ) CFF_SubFont subfont )
{ {
if ( subfont ) if ( subfont )
{ {
@ -2059,12 +2059,12 @@
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
CFF_Load_Font( FT_Stream stream, CFF_Load_Font( FT_Stream stream,
FT_Int face_index, FT_Int face_index,
CFF_Font* font ) CFF_Font font )
{ {
static const FT_Frame_Field cff_header_fields[] = static const FT_Frame_Field cff_header_fields[] =
{ {
#undef FT_STRUCTURE #undef FT_STRUCTURE
#define FT_STRUCTURE CFF_Font #define FT_STRUCTURE CFF_FontRec
FT_FRAME_START( 4 ), FT_FRAME_START( 4 ),
FT_FRAME_BYTE( version_major ), FT_FRAME_BYTE( version_major ),
@ -2077,7 +2077,7 @@
FT_Error error; FT_Error error;
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FT_ULong base_offset; FT_ULong base_offset;
CFF_Font_Dict* dict; CFF_FontRecDict dict;
MEM_Set( font, 0, sizeof ( *font ) ); MEM_Set( font, 0, sizeof ( *font ) );
@ -2138,7 +2138,7 @@
if ( dict->cid_registry ) if ( dict->cid_registry )
{ {
CFF_IndexRec fd_index; CFF_IndexRec fd_index;
CFF_SubFont* sub; CFF_SubFont sub;
FT_UInt idx; FT_UInt idx;
@ -2159,7 +2159,7 @@
/* allocate & read each font dict independently */ /* allocate & read each font dict independently */
font->num_subfonts = fd_index.count; font->num_subfonts = fd_index.count;
if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFont ) ) if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFontRec ) )
goto Fail_CID; goto Fail_CID;
/* setup pointer table */ /* setup pointer table */
@ -2240,7 +2240,7 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
CFF_Done_Font( CFF_Font* font ) CFF_Done_Font( CFF_Font font )
{ {
FT_Memory memory = font->memory; FT_Memory memory = font->memory;
FT_UInt idx; FT_UInt idx;

View File

@ -55,14 +55,14 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error ) FT_LOCAL( FT_Error )
CFF_Load_Font( FT_Stream stream, CFF_Load_Font( FT_Stream stream,
FT_Int face_index, FT_Int face_index,
CFF_Font* font ); CFF_Font font );
FT_LOCAL( void ) FT_LOCAL( void )
CFF_Done_Font( CFF_Font* font ); CFF_Done_Font( CFF_Font font );
FT_LOCAL( FT_Byte ) FT_LOCAL( FT_Byte )
CFF_Get_FD( CFF_FD_Select* select, CFF_Get_FD( CFF_FDSelect select,
FT_UInt glyph_index ); FT_UInt glyph_index );

View File

@ -60,7 +60,7 @@
CFF_Size_Get_Globals_Funcs( CFF_Size size ) CFF_Size_Get_Globals_Funcs( CFF_Size size )
{ {
CFF_Face face = (CFF_Face)size->face; CFF_Face face = (CFF_Face)size->face;
CFF_Font* font = (CFF_Font *)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;
FT_Module module; FT_Module module;
@ -101,8 +101,8 @@
{ {
PSH_Globals globals; PSH_Globals globals;
CFF_Face face = (CFF_Face)size->face; CFF_Face face = (CFF_Face)size->face;
CFF_Font* font = (CFF_Font *)face->extra.data; CFF_Font font = (CFF_FontRec *)face->extra.data;
CFF_SubFont* subfont = &font->top_font; CFF_SubFont subfont = &font->top_font;
CFF_Private cpriv = &subfont->private_dict; CFF_Private cpriv = &subfont->private_dict;
PS_PrivateRec priv; PS_PrivateRec priv;
@ -196,7 +196,7 @@
CFF_GlyphSlot_Init( CFF_GlyphSlot slot ) CFF_GlyphSlot_Init( CFF_GlyphSlot slot )
{ {
CFF_Face face = (CFF_Face)slot->root.face; CFF_Face face = (CFF_Face)slot->root.face;
CFF_Font* font = (CFF_Font *)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;
@ -257,12 +257,12 @@
FT_ULong base_offset, FT_ULong base_offset,
PSNames_Service psnames ) PSNames_Service psnames )
{ {
CFF_Font* font = (CFF_Font*)face->extra.data; CFF_Font font = (CFF_Font)face->extra.data;
FT_Memory memory = FT_FACE_MEMORY(face); FT_Memory memory = FT_FACE_MEMORY(face);
FT_UInt n, num_glyphs = face->root.num_glyphs; FT_UInt n, num_glyphs = face->root.num_glyphs;
const char** glyph_names; const char** glyph_names;
FT_Error error; FT_Error error;
CFF_Font_Dict* dict = &font->top_font.font_dict; CFF_FontRecDict dict = &font->top_font.font_dict;
FT_ULong charset_offset; FT_ULong charset_offset;
FT_Byte format; FT_Byte format;
FT_Stream stream = face->root.stream; FT_Stream stream = face->root.stream;
@ -527,7 +527,7 @@
/* now load and parse the CFF table in the file */ /* now load and parse the CFF table in the file */
{ {
CFF_Font* cff; CFF_Font cff;
FT_Memory memory = face->root.memory; FT_Memory memory = face->root.memory;
FT_Face root; FT_Face root;
FT_UInt flags; FT_UInt flags;
@ -551,7 +551,7 @@
if ( pure_cff ) if ( pure_cff )
{ {
CFF_Font_Dict* dict = &cff->top_font.font_dict; CFF_FontRecDict dict = &cff->top_font.font_dict;
/* we need the `PSNames' module for pure-CFF and CEF formats */ /* we need the `PSNames' module for pure-CFF and CEF formats */
@ -716,7 +716,7 @@
sfnt->done_face( face ); sfnt->done_face( face );
{ {
CFF_Font* cff = (CFF_Font*)face->extra.data; CFF_Font cff = (CFF_Font)face->extra.data;
if ( cff ) if ( cff )

View File

@ -313,7 +313,7 @@
static FT_Error static FT_Error
cff_parse_font_matrix( CFF_Parser* parser ) cff_parse_font_matrix( CFF_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
FT_Matrix* matrix = &dict->font_matrix; FT_Matrix* matrix = &dict->font_matrix;
FT_Vector* offset = &dict->font_offset; FT_Vector* offset = &dict->font_offset;
FT_UShort* upm = &dict->units_per_em; FT_UShort* upm = &dict->units_per_em;
@ -361,7 +361,7 @@
static FT_Error static FT_Error
cff_parse_font_bbox( CFF_Parser* parser ) cff_parse_font_bbox( CFF_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
FT_BBox* bbox = &dict->font_bbox; FT_BBox* bbox = &dict->font_bbox;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
@ -385,7 +385,7 @@
static FT_Error static FT_Error
cff_parse_private_dict( CFF_Parser* parser ) cff_parse_private_dict( CFF_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;
@ -406,7 +406,7 @@
static FT_Error static FT_Error
cff_parse_cid_ros( CFF_Parser* parser ) cff_parse_cid_ros( CFF_Parser* parser )
{ {
CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object; CFF_FontRecDict dict = (CFF_FontRecDict)parser->object;
FT_Byte** data = parser->stack; FT_Byte** data = parser->stack;
FT_Error error; FT_Error error;

View File

@ -17,7 +17,7 @@
#undef FT_STRUCTURE #undef FT_STRUCTURE
#define FT_STRUCTURE CFF_Font_Dict #define FT_STRUCTURE CFF_FontRecDictRec
#undef CFFCODE #undef CFFCODE
#define CFFCODE CFFCODE_TOPDICT #define CFFCODE CFFCODE_TOPDICT