Preparing changes in cff parser later needed for PIC version.

* src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffparse.c, src/cff/cffparse.h: Add library pointer to
'CFF_ParserRec' set by `cff_parser_init'.
Route library pointer from 'cff_face_init' to 'cff_subfont_load'
for `cff_parser_init'.

* src/cff/cffparse.c (CFF_Field_Handler): Move it to...
* src/cff/cffparse.h: This file, to be used by other C files.
This commit is contained in:
Oran Agra 2009-04-05 17:34:40 +03:00
parent 3da7e68f75
commit 2589e5fd94
6 changed files with 65 additions and 41 deletions

View File

@ -1,3 +1,16 @@
2009-04-05 Oran Agra <oran@monfort.co.il>
Preparing changes in cff parser later needed for PIC version.
* src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c,
src/cff/cffparse.c, src/cff/cffparse.h: Add library pointer to
'CFF_ParserRec' set by `cff_parser_init'.
Route library pointer from 'cff_face_init' to 'cff_subfont_load'
for `cff_parser_init'.
* src/cff/cffparse.c (CFF_Field_Handler): Move it to...
* src/cff/cffparse.h: This file, to be used by other C files.
2009-04-05 Oran Agra <oran@monfort.co.il>
Minor change in ftstroke.c.

View File

@ -1267,7 +1267,8 @@
CFF_Index idx,
FT_UInt font_index,
FT_Stream stream,
FT_ULong base_offset )
FT_ULong base_offset,
FT_Library library )
{
FT_Error error;
CFF_ParserRec parser;
@ -1277,7 +1278,7 @@
CFF_Private priv = &font->private_dict;
cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict );
cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library );
/* set defaults */
FT_MEM_ZERO( top, sizeof ( *top ) );
@ -1328,7 +1329,7 @@
priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );
cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library );
if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
FT_FRAME_ENTER( font->font_dict.private_size ) )
@ -1381,7 +1382,8 @@
FT_LOCAL_DEF( FT_Error )
cff_font_load( FT_Stream stream,
cff_font_load( FT_Library library,
FT_Stream stream,
FT_Int face_index,
CFF_Font font,
FT_Bool pure_cff )
@ -1459,7 +1461,8 @@
&font->font_dict_index,
face_index,
stream,
base_offset );
base_offset,
library );
if ( error )
goto Exit;
@ -1507,7 +1510,7 @@
{
sub = font->subfonts[idx];
error = cff_subfont_load( sub, &fd_index, idx,
stream, base_offset );
stream, base_offset, library );
if ( error )
goto Fail_CID;
}

View File

@ -58,7 +58,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
cff_font_load( FT_Stream stream,
cff_font_load( FT_Library library,
FT_Stream stream,
FT_Int face_index,
CFF_Font font,
FT_Bool pure_cff );

View File

@ -408,6 +408,7 @@
PSHinter_Service pshinter;
FT_Bool pure_cff = 1;
FT_Bool sfnt_format = 0;
FT_Library library = cffface->driver->root.library;
#if 0
@ -419,14 +420,14 @@
goto Bad_Format;
#else
sfnt = (SFNT_Service)FT_Get_Module_Interface(
cffface->driver->root.library, "sfnt" );
library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
cffface->driver->root.library, "pshinter" );
library, "pshinter" );
#endif
/* create input stream from resource */
@ -507,7 +508,7 @@
goto Exit;
face->extra.data = cff;
error = cff_font_load( stream, face_index, cff, pure_cff );
error = cff_font_load( library, stream, face_index, cff, pure_cff );
if ( error )
goto Exit;

View File

@ -34,47 +34,20 @@
#define FT_COMPONENT trace_cffparse
enum
{
cff_kind_none = 0,
cff_kind_num,
cff_kind_fixed,
cff_kind_fixed_thousand,
cff_kind_string,
cff_kind_bool,
cff_kind_delta,
cff_kind_callback,
cff_kind_max /* do not remove */
};
/* now generate handlers for the most simple fields */
typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
typedef struct CFF_Field_Handler_
{
int kind;
int code;
FT_UInt offset;
FT_Byte size;
CFF_Field_Reader reader;
FT_UInt array_max;
FT_UInt count_offset;
} CFF_Field_Handler;
FT_LOCAL_DEF( void )
cff_parser_init( CFF_Parser parser,
FT_UInt code,
void* object )
void* object,
FT_Library library)
{
FT_MEM_ZERO( parser, sizeof ( *parser ) );
parser->top = parser->stack;
parser->object_code = code;
parser->object = object;
parser->library = library;
}

View File

@ -36,6 +36,7 @@ FT_BEGIN_HEADER
typedef struct CFF_ParserRec_
{
FT_Library library;
FT_Byte* start;
FT_Byte* limit;
FT_Byte* cursor;
@ -52,7 +53,8 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
cff_parser_init( CFF_Parser parser,
FT_UInt code,
void* object );
void* object,
FT_Library library);
FT_LOCAL( FT_Error )
cff_parser_run( CFF_Parser parser,
@ -60,6 +62,37 @@ FT_BEGIN_HEADER
FT_Byte* limit );
enum
{
cff_kind_none = 0,
cff_kind_num,
cff_kind_fixed,
cff_kind_fixed_thousand,
cff_kind_string,
cff_kind_bool,
cff_kind_delta,
cff_kind_callback,
cff_kind_max /* do not remove */
};
/* now generate handlers for the most simple fields */
typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
typedef struct CFF_Field_Handler_
{
int kind;
int code;
FT_UInt offset;
FT_Byte size;
CFF_Field_Reader reader;
FT_UInt array_max;
FT_UInt count_offset;
} CFF_Field_Handler;
FT_END_HEADER