summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--include/freetype/internal/ftstream.h191
-rw-r--r--include/freetype/internal/tttypes.h4
-rw-r--r--src/base/ftapi.c2000
-rw-r--r--src/base/ftobjs.c6
-rw-r--r--src/base/ftstream.c138
-rw-r--r--src/base/rules.mk1
-rw-r--r--src/cff/cffload.c46
-rw-r--r--src/cff/cffobjs.c4
-rw-r--r--src/cid/cidgload.c8
-rw-r--r--src/cid/cidload.c10
-rw-r--r--src/cid/cidobjs.c2
-rw-r--r--src/cid/cidparse.c16
-rw-r--r--src/pcf/pcfdriver.c4
-rw-r--r--src/pcf/pcfread.c32
-rw-r--r--src/sfnt/ttcmap.c54
-rw-r--r--src/sfnt/ttload.c102
-rw-r--r--src/sfnt/ttpost.c10
-rw-r--r--src/sfnt/ttsbit.c56
-rw-r--r--src/truetype/ttgload.c14
-rw-r--r--src/truetype/ttobjs.c6
-rw-r--r--src/truetype/ttpload.c16
-rw-r--r--src/type1/t1afm.c4
-rw-r--r--src/type1/t1parse.c18
-rw-r--r--src/winfonts/winfnt.c32
25 files changed, 403 insertions, 2381 deletions
diff --git a/ChangeLog b/ChangeLog
index fec37e941..b273a4bc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2002-03-20 David Turner <david@freetype.org>
+ * renaming stream macros. Examples:
+
+ FILE_Skip => FT_STREAM_SKIP
+ FILE_Read => FT_STREAM_READ
+ ACCESS_Frame => FT_FRAME_ENTER
+ FORGET_Frame => FT_FRAME_EXIT
+ etc...
+
+ * src/sfnt/sfdriver.c (get_sfnt_postscript_name): fixed memory leak
+
* include/freetype/internal/ftobjs.h: changing the definition of
FT_CMap_CharNextFunc slightly
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
index 6bfb1b03d..fcef640e6 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -265,38 +265,38 @@ FT_BEGIN_HEADER
/* */
#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )
-#define GET_Char() FT_GET_MACRO( FT_Stream_Get_Char, FT_Char )
-#define GET_Byte() FT_GET_MACRO( FT_Stream_Get_Char, FT_Byte )
-#define GET_Short() FT_GET_MACRO( FT_Stream_Get_Short, FT_Short )
-#define GET_UShort() FT_GET_MACRO( FT_Stream_Get_Short, FT_UShort )
-#define GET_Offset() FT_GET_MACRO( FT_Stream_Get_Offset, FT_Long )
-#define GET_UOffset() FT_GET_MACRO( FT_Stream_Get_Offset, FT_ULong )
-#define GET_Long() FT_GET_MACRO( FT_Stream_Get_Long, FT_Long )
-#define GET_ULong() FT_GET_MACRO( FT_Stream_Get_Long, FT_ULong )
-#define GET_Tag4() FT_GET_MACRO( FT_Stream_Get_Long, FT_ULong )
-
-#define GET_ShortLE() FT_GET_MACRO( FT_Stream_Get_ShortLE, FT_Short )
-#define GET_UShortLE() FT_GET_MACRO( FT_Stream_Get_ShortLE, FT_UShort )
-#define GET_LongLE() FT_GET_MACRO( FT_Stream_Get_LongLE, FT_Long )
-#define GET_ULongLE() FT_GET_MACRO( FT_Stream_Get_LongLE, FT_ULong )
+#define GET_Char() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
+#define GET_Byte() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
+#define GET_Short() FT_GET_MACRO( FT_Stream_GetShort, FT_Short )
+#define GET_UShort() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort )
+#define GET_Offset() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long )
+#define GET_UOffset() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong )
+#define GET_Long() FT_GET_MACRO( FT_Stream_GetLong, FT_Long )
+#define GET_ULong() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
+#define GET_Tag4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
+
+#define GET_ShortLE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short )
+#define GET_UShortLE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort )
+#define GET_LongLE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long )
+#define GET_ULongLE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong )
#define FT_READ_MACRO( func, type, var ) \
( var = (type)func( stream, &error ), \
error != FT_Err_Ok )
-#define READ_Byte( var ) FT_READ_MACRO( FT_Stream_Read_Char, FT_Byte, var )
-#define READ_Char( var ) FT_READ_MACRO( FT_Stream_Read_Char, FT_Char, var )
-#define READ_Short( var ) FT_READ_MACRO( FT_Stream_Read_Short, FT_Short, var )
-#define READ_UShort( var ) FT_READ_MACRO( FT_Stream_Read_Short, FT_UShort, var )
-#define READ_Offset( var ) FT_READ_MACRO( FT_Stream_Read_Offset, FT_Long, var )
-#define READ_UOffset( var ) FT_READ_MACRO( FT_Stream_Read_Offset, FT_ULong, var )
-#define READ_Long( var ) FT_READ_MACRO( FT_Stream_Read_Long, FT_Long, var )
-#define READ_ULong( var ) FT_READ_MACRO( FT_Stream_Read_Long, FT_ULong, var )
+#define READ_Byte( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )
+#define READ_Char( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )
+#define READ_Short( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var )
+#define READ_UShort( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var )
+#define READ_Offset( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var )
+#define READ_UOffset( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var )
+#define READ_Long( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var )
+#define READ_ULong( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var )
-#define READ_ShortLE( var ) FT_READ_MACRO( FT_Stream_Read_ShortLE, FT_Short, var )
-#define READ_UShortLE( var ) FT_READ_MACRO( FT_Stream_Read_ShortLE, FT_UShort, var )
-#define READ_LongLE( var ) FT_READ_MACRO( FT_Stream_Read_LongLE, FT_Long, var )
-#define READ_ULongLE( var ) FT_READ_MACRO( FT_Stream_Read_LongLE, FT_ULong, var )
+#define READ_ShortLE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var )
+#define READ_UShortLE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var )
+#define READ_LongLE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var )
+#define READ_ULongLE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var )
@@ -313,9 +313,9 @@ FT_BEGIN_HEADER
/* initialize a stream for reading in-memory data */
FT_BASE( void )
- FT_Stream_Open_Memory( FT_Stream stream,
- const FT_Byte* base,
- FT_ULong size );
+ FT_Stream_OpenMemory( FT_Stream stream,
+ const FT_Byte* base,
+ FT_ULong size );
/* close a stream (does not destroy the stream structure) */
FT_BASE( void )
@@ -346,27 +346,27 @@ FT_BEGIN_HEADER
/* read bytes from a stream at a given position */
FT_BASE( FT_Error )
- FT_Stream_Read_At( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count );
+ FT_Stream_ReadAt( FT_Stream stream,
+ FT_ULong pos,
+ FT_Byte* buffer,
+ FT_ULong count );
/* enter a frame of 'count' consecutive bytes in a stream. returns an */
/* error if the frame could not be read/accessed. The caller can use */
/* the FT_Stream_Get_XXX function to retrieve frame data without */
/* error checks.. */
/* */
- /* you must _always_ call FT_Stream_Exit_Frame once you've entered */
+ /* you must _always_ call FT_Stream_ExitFrame once you've entered */
/* a stream frame !! */
/* */
FT_BASE( FT_Error )
- FT_Stream_Enter_Frame( FT_Stream stream,
- FT_ULong count );
+ FT_Stream_EnterFrame( FT_Stream stream,
+ FT_ULong count );
/* exit a stream frame.. */
/* */
FT_BASE( void )
- FT_Stream_Exit_Frame( FT_Stream stream );
+ FT_Stream_ExitFrame( FT_Stream stream );
/* extract a stream frame. if the stream is disk-based, a heap block */
/* is allocated and the frame bytes are read into it. if the stream */
@@ -375,126 +375,119 @@ FT_BEGIN_HEADER
/* useful to optimize access to memory-based streams transparently. */
/* */
/* all extracted frames must be "freed" with a call to the function */
- /* FT_Stream_Release_Frame */
+ /* FT_Stream_ReleaseFrame */
/* */
FT_BASE( FT_Error )
- FT_Stream_Extract_Frame( FT_Stream stream,
- FT_ULong count,
- FT_Byte** pbytes );
+ FT_Stream_ExtractFrame( FT_Stream stream,
+ FT_ULong count,
+ FT_Byte** pbytes );
- /* release an extract frame (see FT_Stream_Extract_Frame) */
+ /* release an extract frame (see FT_Stream_ExtractFrame) */
/* */
FT_BASE( void )
- FT_Stream_Release_Frame( FT_Stream stream,
- FT_Byte** pbytes );
-
+ FT_Stream_ReleaseFrame( FT_Stream stream,
+ FT_Byte** pbytes );
+
/* read a byte from an entered frame */
FT_BASE( FT_Char )
- FT_Stream_Get_Char( FT_Stream stream );
+ FT_Stream_GetChar( FT_Stream stream );
/* read a 16-bit big-endian integer from an entered frame */
FT_BASE( FT_Short )
- FT_Stream_Get_Short( FT_Stream stream );
+ FT_Stream_GetShort( FT_Stream stream );
/* read a 24-bit big-endian integer from an entered frame */
FT_BASE( FT_Long )
- FT_Stream_Get_Offset( FT_Stream stream );
+ FT_Stream_GetOffset( FT_Stream stream );
/* read a 32-bit big-endian integer from an entered frame */
FT_BASE( FT_Long )
- FT_Stream_Get_Long( FT_Stream stream );
+ FT_Stream_GetLong( FT_Stream stream );
/* read a 16-bit little-endian integer from an entered frame */
FT_BASE( FT_Short )
- FT_Stream_Get_ShortLE( FT_Stream stream );
+ FT_Stream_GetShortLE( FT_Stream stream );
/* read a 32-bit little-endian integer from an entered frame */
FT_BASE( FT_Long )
- FT_Stream_Get_LongLE( FT_Stream stream );
+ FT_Stream_GetLongLE( FT_Stream stream );
/* read a byte from a stream */
FT_BASE( FT_Char )
- FT_Stream_Read_Char( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadChar( FT_Stream stream,
+ FT_Error* error );
/* read a 16-bit big-endian integer from a stream */
FT_BASE( FT_Short )
- FT_Stream_Read_Short( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadShort( FT_Stream stream,
+ FT_Error* error );
/* read a 24-bit big-endian integer from a stream */
FT_BASE( FT_Long )
- FT_Stream_Read_Offset( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadOffset( FT_Stream stream,
+ FT_Error* error );
/* read a 32-bit big-endian integer from a stream */
FT_BASE( FT_Long )
- FT_Stream_Read_Long( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadLong( FT_Stream stream,
+ FT_Error* error );
/* read a 16-bit little-endian integer from a stream */
FT_BASE( FT_Short )
- FT_Stream_Read_ShortLE( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadShortLE( FT_Stream stream,
+ FT_Error* error );
/* read a 32-bit little-endian integer from a stream */
FT_BASE( FT_Long )
- FT_Stream_Read_LongLE( FT_Stream stream,
- FT_Error* error );
+ FT_Stream_ReadLongLE( FT_Stream stream,
+ FT_Error* error );
/* read a structure from a stream. The structure must be described */
/* by an array of FT_Frame_Field records.. */
FT_BASE( FT_Error )
- FT_Stream_Read_Fields( FT_Stream stream,
- const FT_Frame_Field* fields,
- void* structure );
-
-
-
-
-#define USE_Stream( resource, stream ) \
- FT_SET_ERROR( FT_Open_Stream( resource, stream ) )
-
-#define DONE_Stream( stream ) \
- FT_Stream_Close( stream )
+ FT_Stream_ReadFields( FT_Stream stream,
+ const FT_Frame_Field* fields,
+ void* structure );
-#define ACCESS_Frame( size ) \
- FT_SET_ERROR( FT_Stream_Enter_Frame( stream, size ) )
-
-#define FORGET_Frame() \
- FT_Stream_Exit_Frame( stream )
-
-#define EXTRACT_Frame( size, bytes ) \
- FT_SET_ERROR( FT_Stream_Extract_Frame( stream, size, \
- (FT_Byte**)&(bytes) ) )
-
-#define RELEASE_Frame( bytes ) \
- FT_Stream_Release_Frame( stream, (FT_Byte**)&(bytes) )
+#define FT_STREAM_POS() \
+ FT_Stream_Pos( stream )
-#define FILE_Seek( position ) \
+#define FT_STREAM_SEEK( position ) \
FT_SET_ERROR( FT_Stream_Seek( stream, position ) )
-#define FILE_Skip( distance ) \
+#define FT_STREAM_SKIP( distance ) \
FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
-#define FILE_Pos() \
- FT_Stream_Pos( stream )
-
-#define FILE_Read( buffer, count ) \
- FT_SET_ERROR( FT_Stream_Read( stream, \
- (FT_Byte*)buffer, \
+#define FT_STREAM_READ( buffer, count ) \
+ FT_SET_ERROR( FT_Stream_Read( stream, \
+ (FT_Byte*)buffer, \
count ) )
-#define FILE_Read_At( position, buffer, count ) \
- FT_SET_ERROR( FT_Stream_Read_At( stream, \
+#define FT_STREAM_READ_AT( position, buffer, count ) \
+ FT_SET_ERROR( FT_Stream_ReadAt( stream, \
position, \
(FT_Byte*)buffer, \
count ) )
-#define READ_Fields( fields, object ) \
- ( ( error = FT_Stream_Read_Fields( stream, fields, object ) ) != FT_Err_Ok )
+#define FT_STREAM_READ_FIELDS( fields, object ) \
+ FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
+
+
+#define FT_FRAME_ENTER( size ) \
+ FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) )
+
+#define FT_FRAME_EXIT() \
+ FT_Stream_ExitFrame( stream )
+
+#define FT_FRAME_EXTRACT( size, bytes ) \
+ FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \
+ (FT_Byte**)&(bytes) ) )
+
+#define FT_FRAME_RELEASE( bytes ) \
+ FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) )
+
FT_END_HEADER
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 5d5bc6735..5beb9e8df 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1220,8 +1220,8 @@ FT_BEGIN_HEADER
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
- /* This function is normally equivalent to FILE_Seek(offset) */
- /* followed by ACCESS_Frame(byte_count) with the loader's stream, but */
+ /* This function is normally equivalent to FT_STREAM_SEEK(offset) */
+ /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, but */
/* alternative formats (e.g. compressed ones) might use something */
/* different. */
/* */
diff --git a/src/base/ftapi.c b/src/base/ftapi.c
index 2e5b18a08..1d6654feb 100644
--- a/src/base/ftapi.c
+++ b/src/base/ftapi.c
@@ -25,2003 +25,33 @@
#include FT_TRUETYPE_TABLES_H
#include FT_OUTLINE_H
-#include <string.h> /* for strcmp() */
-
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Transform( FT_Face face,
- FT_Matrix* matrix,
- FT_Vector* delta )
- {
- FT_Face_Internal internal;
-
-
- if ( !face )
- return;
-
- internal = face->internal;
-
- internal->transform_flags = 0;
-
- if ( !matrix )
- {
- internal->transform_matrix.xx = 0x10000L;
- internal->transform_matrix.xy = 0;
- internal->transform_matrix.yx = 0;
- internal->transform_matrix.yy = 0x10000L;
- matrix = &internal->transform_matrix;
- }
- else
- internal->transform_matrix = *matrix;
-
- /* set transform_flags bit flag 0 if `matrix' isn't the identity */
- if ( ( matrix->xy | matrix->yx ) ||
- matrix->xx != 0x10000L ||
- matrix->yy != 0x10000L )
- internal->transform_flags |= 1;
-
- if ( !delta )
- {
- internal->transform_delta.x = 0;
- internal->transform_delta.y = 0;
- delta = &internal->transform_delta;
- }
- else
- internal->transform_delta = *delta;
-
- /* set transform_flags bit flag 1 if `delta' isn't the null vector */
- if ( delta->x | delta->y )
- internal->transform_flags |= 2;
- }
-
-
- static FT_Renderer
- ft_lookup_glyph_renderer( FT_GlyphSlot slot );
-
-
-
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Load_Glyph( FT_Face face,
- FT_UInt glyph_index,
- FT_Int load_flags )
- {
- FT_Error error;
- FT_Driver driver;
- FT_GlyphSlot slot;
- FT_Library library;
- FT_Bool autohint;
- FT_Module hinter;
-
-
- if ( !face || !face->size || !face->glyph )
- return FT_Err_Invalid_Face_Handle;
-
- if ( glyph_index >= (FT_UInt)face->num_glyphs )
- return FT_Err_Invalid_Argument;
-
- slot = face->glyph;
- ft_glyphslot_clear( slot );
-
- driver = face->driver;
-
- /* if the flag NO_RECURSE is set, we disable hinting and scaling */
- if ( load_flags & FT_LOAD_NO_RECURSE )
- {
- /* disable scaling, hinting, and transformation */
- load_flags |= FT_LOAD_NO_SCALE |
- FT_LOAD_NO_HINTING |
- FT_LOAD_IGNORE_TRANSFORM;
-
- /* disable bitmap rendering */
- load_flags &= ~FT_LOAD_RENDER;
- }
-
- /* do we need to load the glyph through the auto-hinter? */
- library = driver->root.library;
- hinter = library->auto_hinter;
- autohint =
- FT_BOOL( hinter &&
- !( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) &&
- FT_DRIVER_IS_SCALABLE( driver ) &&
- FT_DRIVER_USES_OUTLINES( driver ) );
- if ( autohint )
- {
- if ( FT_DRIVER_HAS_HINTER( driver ) &&
- !( load_flags & FT_LOAD_FORCE_AUTOHINT ) )
- autohint = 0;
- }
-
- if ( autohint )
- {
- FT_AutoHinter_Service hinting;
-
-
- /* try to load embedded bitmaps first if available */
- /* */
- /* XXX: This is really a temporary hack that should disappear */
- /* promptly with FreeType 2.1! */
- /* */
- if ( FT_HAS_FIXED_SIZES( face ) )
- {
- error = driver->clazz->load_glyph( slot, face->size,
- glyph_index,
- load_flags | FT_LOAD_SBITS_ONLY );
-
- if ( !error && slot->format == ft_glyph_format_bitmap )
- goto Load_Ok;
- }
-
- /* load auto-hinted outline */
- hinting = (FT_AutoHinter_Service)hinter->clazz->module_interface;
-
- error = hinting->load_glyph( (FT_AutoHinter)hinter,
- slot, face->size,
- glyph_index, load_flags );
- }
- else
- {
- error = driver->clazz->load_glyph( slot,
- face->size,
- glyph_index,
- load_flags );
- if ( error )
- goto Exit;
-
- /* check that the loaded outline is correct */
- error = FT_Outline_Check( &slot->outline );
- if ( error )
- goto Exit;
- }
-
- Load_Ok:
- /* compute the advance */
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- slot->advance.x = 0;
- slot->advance.y = slot->metrics.vertAdvance;
- }
- else
- {
- slot->advance.x = slot->metrics.horiAdvance;
- slot->advance.y = 0;
- }
-
- /* compute the linear advance in 16.16 pixels */
- if ( ( load_flags & FT_LOAD_LINEAR_DESIGN ) == 0 )
- {
- FT_UInt EM = face->units_per_EM;
- FT_Size_Metrics* metrics = &face->size->metrics;
-
- slot->linearHoriAdvance = FT_MulDiv( slot->linearHoriAdvance,
- (FT_Long)metrics->x_ppem << 16, EM );
-
- slot->linearVertAdvance = FT_MulDiv( slot->linearVertAdvance,
- (FT_Long)metrics->y_ppem << 16, EM );
- }
-
- if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
- {
- FT_Face_Internal internal = face->internal;
-
-
- /* now, transform the glyph image if needed */
- if ( internal->transform_flags )
- {
- /* get renderer */
- FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
-
-
- if ( renderer )
- error = renderer->clazz->transform_glyph(
- renderer, slot,
- &internal->transform_matrix,
- &internal->transform_delta );
- /* transform advance */
- FT_Vector_Transform( &slot->advance, &internal->transform_matrix );
- }
- }
-
- /* do we need to render the image now? */
- if ( !error &&
- slot->format != ft_glyph_format_bitmap &&
- slot->format != ft_glyph_format_composite &&
- load_flags & FT_LOAD_RENDER )
- {
- error = FT_Render_Glyph( slot,
- ( load_flags & FT_LOAD_MONOCHROME )
- ? ft_render_mode_mono
- : ft_render_mode_normal );
- }
-
- Exit:
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Load_Char( FT_Face face,
- FT_ULong char_code,
- FT_Int load_flags )
- {
- FT_UInt glyph_index;
-
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- glyph_index = (FT_UInt)char_code;
- if ( face->charmap )
- glyph_index = FT_Stream_Get_Char_Index( face, char_code );
-
- return FT_Load_Glyph( face, glyph_index, load_flags );
- }
-
-
- /* destructor for sizes list */
- static void
- destroy_size( FT_Memory memory,
- FT_Size size,
- FT_Driver driver )
- {
- /* finalize client-specific data */
- if ( size->generic.finalizer )
- size->generic.finalizer( size );
-
- /* finalize format-specific stuff */
- if ( driver->clazz->done_size )
- driver->clazz->done_size( size );
-
- FREE( size->internal );
- FREE( size );
- }
-
-
- /* destructor for faces list */
- static void
- destroy_face( FT_Memory memory,
- FT_Face face,
- FT_Driver driver )
- {
- FT_Driver_Class clazz = driver->clazz;
-
-
- /* discard auto-hinting data */
- if ( face->autohint.finalizer )
- face->autohint.finalizer( face->autohint.data );
-
- /* Discard glyph slots for this face */
- /* Beware! FT_GlyphSlot_New() changes the field `face->glyph' */
- while ( face->glyph )
- FT_GlyphSlot_New( face->glyph );
-
- /* Discard all sizes for this face */
- FT_List_Finalize( &face->sizes_list,
- (FT_List_Destructor)destroy_size,
- memory,
- driver );
- face->size = 0;
-
- /* Now discard client data */
- if ( face->generic.finalizer )
- face->generic.finalizer( face );
-
- /* finalize format-specific stuff */
- if ( clazz->done_face )
- clazz->done_face( face );
-
- /* close the stream for this face if needed */
- ft_done_stream(
- &face->stream,
- ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
-
- /* get rid of it */
- if ( face->internal )
- {
- FREE( face->internal->postscript_name );
- FREE( face->internal );
- }
- FREE( face );
- }
-
-
- static void
- ft_driver_destroy( FT_Driver driver )
- {
- FT_List_Finalize( &driver->faces_list,
- (FT_List_Destructor)destroy_face,
- driver->root.memory,
- driver );
-
- /* check whether we need to drop the driver's glyph loader */
- if ( FT_DRIVER_USES_OUTLINES( driver ) )
- FT_GlyphLoader_Done( driver->glyph_loader );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* open_face */
- /* */
- /* <Description> */
- /* This function does some work for FT_Open_Face(). */
- /* */
- static FT_Error
- open_face( FT_Driver driver,
- FT_Stream stream,
- FT_Long face_index,
- FT_Int num_params,
- FT_Parameter* params,
- FT_Face* aface )
- {
- FT_Memory memory;
- FT_Driver_Class clazz;
- FT_Face face = 0;
- FT_Error error;
- FT_Face_Internal internal;
-
-
- clazz = driver->clazz;
- memory = driver->root.memory;
-
- /* allocate the face object and perform basic initialization */
- if ( ALLOC( face, clazz->face_object_size ) )
- goto Fail;
-
- if ( ALLOC( internal, sizeof ( *internal ) ) )
- goto Fail;
-
- face->internal = internal;
-
- face->driver = driver;
- face->memory = memory;
- face->stream = stream;
-
- error = clazz->init_face( stream,
- face,
- face_index,
- num_params,
- params );
- if ( error )
- goto Fail;
-
- *aface = face;
-
- Fail:
- if ( error )
- {
- clazz->done_face( face );
- FREE( face->internal );
- FREE( face );
- *aface = 0;
- }
-
- return error;
- }
-
-
- /* there's a Mac-specific extended implementation of FT_New_Face() */
- /* in src/mac/ftmac.c */
-
-#ifndef macintosh
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Face( FT_Library library,
- const char* pathname,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Open_Args args;
-
-
- /* test for valid `library' and `aface' delayed to FT_Open_Face() */
- if ( !pathname )
- return FT_Err_Invalid_Argument;
-
- args.flags = ft_open_pathname;
- args.pathname = (char*)pathname;
-
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-#endif /* !macintosh */
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Memory_Face( FT_Library library,
- const FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Open_Args args;
-
-
- /* test for valid `library' and `face' delayed to FT_Open_Face() */
- if ( !file_base )
- return FT_Err_Invalid_Argument;
-
- args.flags = ft_open_memory;
- args.memory_base = file_base;
- args.memory_size = file_size;
-
- return FT_Open_Face( library, &args, face_index, aface );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Open_Face( FT_Library library,
- FT_Open_Args* args,
- FT_Long face_index,
- FT_Face *aface )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Memory memory;
- FT_Stream stream;
- FT_Face face = 0;
- FT_ListNode node = 0;
- FT_Bool external_stream;
-
-
- /* test for valid `library' delayed to */
- /* ft_new_input_stream() */
-
- if ( !aface || !args )
- return FT_Err_Invalid_Argument;
-
- *aface = 0;
-
- external_stream = FT_BOOL( ( args->flags & ft_open_stream ) &&
- args->stream );
-
- /* create input stream */
- error = ft_new_input_stream( library, args, &stream );
- if ( error )
- goto Exit;
-
- memory = library->memory;
-
- /* If the font driver is specified in the `args' structure, use */
- /* it. Otherwise, we scan the list of registered drivers. */
- if ( ( args->flags & ft_open_driver ) && args->driver )
- {
- driver = FT_DRIVER( args->driver );
-
- /* not all modules are drivers, so check... */
- if ( FT_MODULE_IS_DRIVER( driver ) )
- {
- FT_Int num_params = 0;
- FT_Parameter* params = 0;
-
-
- if ( args->flags & ft_open_params )
- {
- num_params = args->num_params;
- params = args->params;
- }
-
- error = open_face( driver, stream, face_index,
- num_params, params, &face );
- if ( !error )
- goto Success;
- }
- else
- error = FT_Err_Invalid_Handle;
-
- ft_done_stream( &stream, external_stream );
- goto Fail;
- }
- else
- {
- /* check each font driver for an appropriate format */
- FT_Module* cur = library->modules;
- FT_Module* limit = cur + library->num_modules;
-
-
- for ( ; cur < limit; cur++ )
- {
- /* not all modules are font drivers, so check... */
- if ( FT_MODULE_IS_DRIVER( cur[0] ) )
- {
- FT_Int num_params = 0;
- FT_Parameter* params = 0;
-
-
- driver = FT_DRIVER( cur[0] );
-
- if ( args->flags & ft_open_params )
- {
- num_params = args->num_params;
- params = args->params;
- }
-
- error = open_face( driver, stream, face_index,
- num_params, params, &face );
- if ( !error )
- goto Success;
-
- if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
- goto Fail2;
- }
- }
-
- /* no driver is able to handle this format */
- error = FT_Err_Unknown_File_Format;
-
- Fail2:
- ft_done_stream( &stream, external_stream );
- goto Fail;
- }
-
- Success:
- FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" ));
-
- /* set the FT_FACE_FLAG_EXTERNAL_STREAM bit for FT_Done_Face */
- if ( external_stream )
- face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
-
- /* add the face object to its driver's list */
- if ( ALLOC( node, sizeof ( *node ) ) )
- goto Fail;
-
- node->data = face;
- /* don't assume driver is the same as face->driver, so use */
- /* face->driver instead. */
- FT_List_Add( &face->driver->faces_list, node );
-
- /* now allocate a glyph slot object for the face */
- {
- FT_GlyphSlot slot;
-
-
- FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" ));
-
- error = FT_GlyphSlot_New( face, &slot );
- if ( error )
- goto Fail;
-
- face->glyph = slot;
- }
-
- /* finally, allocate a size object for the face */
- {
- FT_Size size;
-
-
- FT_TRACE4(( "FT_Open_Face: Creating size object\n" ));
-
- error = FT_New_Size( face, &size );
- if ( error )
- goto Fail;
-
- face->size = size;
- }
-
- /* initialize internal face data */
- {
- FT_Face_Internal internal = face->internal;
-
-
- internal->transform_matrix.xx = 0x10000L;
- internal->transform_matrix.xy = 0;
- internal->transform_matrix.yx = 0;
- internal->transform_matrix.yy = 0x10000L;
-
- internal->transform_delta.x = 0;
- internal->transform_delta.y = 0;
- }
-
- *aface = face;
- goto Exit;
-
- Fail:
- FT_Done_Face( face );
-
- Exit:
- FT_TRACE4(( "FT_Open_Face: Return %d\n", error ));
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Attach_File( FT_Face face,
- const char* filepathname )
- {
- FT_Open_Args open;
-
-
- /* test for valid `face' delayed to FT_Attach_Stream() */
-
- if ( !filepathname )
- return FT_Err_Invalid_Argument;
-
- open.flags = ft_open_pathname;
- open.pathname = (char*)filepathname;
-
- return FT_Attach_Stream( face, &open );
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Attach_Stream( FT_Face face,
- FT_Open_Args* parameters )
- {
- FT_Stream stream;
- FT_Error error;
- FT_Driver driver;
-
- FT_Driver_Class clazz;
-
-
- /* test for valid `parameters' delayed to ft_new_input_stream() */
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- driver = face->driver;
- if ( !driver )
- return FT_Err_Invalid_Driver_Handle;
-
- error = ft_new_input_stream( driver->root.library, parameters, &stream );
- if ( error )
- goto Exit;
-
- /* we implement FT_Attach_Stream in each driver through the */
- /* `attach_file' interface */
-
- error = FT_Err_Unimplemented_Feature;
- clazz = driver->clazz;
- if ( clazz->attach_file )
- error = clazz->attach_file( face, stream );
-
- /* close the attached stream */
- ft_done_stream( &stream,
- (FT_Bool)( parameters->stream &&
- ( parameters->flags & ft_open_stream ) ) );
-
- Exit:
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Face( FT_Face face )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Memory memory;
- FT_ListNode node;
-
-
- error = FT_Err_Invalid_Face_Handle;
- if ( face && face->driver )
- {
- driver = face->driver;
- memory = driver->root.memory;
-
- /* find face in driver's list */
- node = FT_List_Find( &driver->faces_list, face );
- if ( node )
- {
- /* remove face object from the driver's list */
- FT_List_Remove( &driver->faces_list, node );
- FREE( node );
-
- /* now destroy the object proper */
- destroy_face( memory, face, driver );
- error = FT_Err_Ok;
- }
- }
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Size( FT_Face face,
- FT_Size *asize )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Driver driver;
- FT_Driver_Class clazz;
-
- FT_Size size = 0;
- FT_ListNode node = 0;
-
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- if ( !asize )
- return FT_Err_Invalid_Size_Handle;
-
- if ( !face->driver )
- return FT_Err_Invalid_Driver_Handle;
-
- *asize = 0;
-
- driver = face->driver;
- clazz = driver->clazz;
- memory = face->memory;
-
- /* Allocate new size object and perform basic initialisation */
- if ( ALLOC( size, clazz->size_object_size ) ||
- ALLOC( node, sizeof ( FT_ListNodeRec ) ) )
- goto Exit;
-
- size->face = face;
-
- /* for now, do not use any internal fields in size objects */
- size->internal = 0;
-
- if ( clazz->init_size )
- error = clazz->init_size( size );
-
- /* in case of success, add to the face's list */
- if ( !error )
- {
- *asize = size;
- node->data = size;
- FT_List_Add( &face->sizes_list, node );
- }
-
- Exit:
- if ( error )
- {
- FREE( node );
- FREE( size );
- }
-
- return error;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Size( FT_Size size )
- {
- FT_Error error;
- FT_Driver driver;
- FT_Memory memory;
- FT_Face face;
- FT_ListNode node;
-
-
- if ( !size )
- return FT_Err_Invalid_Size_Handle;
-
- face = size->face;
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- driver = face->driver;
- if ( !driver )
- return FT_Err_Invalid_Driver_Handle;
-
- memory = driver->root.memory;
-
- error = FT_Err_Ok;
- node = FT_List_Find( &face->sizes_list, size );
- if ( node )
- {
- FT_List_Remove( &face->sizes_list, node );
- FREE( node );
-
- if ( face->size == size )
- {
- face->size = 0;
- if ( face->sizes_list.head )
- face->size = (FT_Size)(face->sizes_list.head->data);
- }
-
- destroy_size( memory, size, driver );
- }
- else
- error = FT_Err_Invalid_Size_Handle;
-
- return error;
- }
-
-
- static void
- ft_recompute_scaled_metrics( FT_Face face,
- FT_Size_Metrics* metrics )
- {
- /* Compute root ascender, descender, test height, and max_advance */
-
- metrics->ascender = ( FT_MulFix( face->ascender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->descender = ( FT_MulFix( face->descender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->height = ( FT_MulFix( face->height,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->max_advance = ( FT_MulFix( face->max_advance_width,
- metrics->x_scale ) + 32 ) & -64;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Char_Size( FT_Face face,
- FT_F26Dot6 char_width,
- FT_F26Dot6 char_height,
- FT_UInt horz_resolution,
- FT_UInt vert_resolution )
- {
- FT_Error error = FT_Err_Ok;
- FT_Driver driver;
- FT_Driver_Class clazz;
- FT_Size_Metrics* metrics;
- FT_Long dim_x, dim_y;
-
-
- if ( !face || !face->size || !face->driver )
- return FT_Err_Invalid_Face_Handle;
-
- driver = face->driver;
- metrics = &face->size->metrics;
-
- if ( !char_width )
- char_width = char_height;
-
- else if ( !char_height )
- char_height = char_width;
-
- if ( !horz_resolution )
- horz_resolution = 72;
-
- if ( !vert_resolution )
- vert_resolution = 72;
-
- driver = face->driver;
- clazz = driver->clazz;
-
- /* default processing -- this can be overridden by the driver */
- if ( char_width < 1 * 64 )
- char_width = 1 * 64;
- if ( char_height < 1 * 64 )
- char_height = 1 * 64;
-
- /* Compute pixel sizes in 26.6 units */
- dim_x = ( ( ( char_width * horz_resolution ) / 72 ) + 32 ) & -64;
- dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
-
- metrics->x_ppem = (FT_UShort)( dim_x >> 6 );
- metrics->y_ppem = (FT_UShort)( dim_y >> 6 );
-
- metrics->x_scale = 0x10000L;
- metrics->y_scale = 0x10000L;
-
- if ( face->face_flags & FT_FACE_FLAG_SCALABLE )
- {
- metrics->x_scale = FT_DivFix( dim_x, face->units_per_EM );
- metrics->y_scale = FT_DivFix( dim_y, face->units_per_EM );
-
- ft_recompute_scaled_metrics( face, metrics );
- }
-
- if ( clazz->set_char_sizes )
- error = clazz->set_char_sizes( face->size,
- char_width,
- char_height,
- horz_resolution,
- vert_resolution );
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Pixel_Sizes( FT_Face face,
- FT_UInt pixel_width,
- FT_UInt pixel_height )
- {
- FT_Error error = FT_Err_Ok;
- FT_Driver driver;
- FT_Driver_Class clazz;
- FT_Size_Metrics* metrics = &face->size->metrics;
-
-
- if ( !face || !face->size || !face->driver )
- return FT_Err_Invalid_Face_Handle;
-
- driver = face->driver;
- clazz = driver->clazz;
-
- /* default processing -- this can be overridden by the driver */
- if ( pixel_width == 0 )
- pixel_width = pixel_height;
-
- else if ( pixel_height == 0 )
- pixel_height = pixel_width;
-
- if ( pixel_width < 1 )
- pixel_width = 1;
- if ( pixel_height < 1 )
- pixel_height = 1;
-
- metrics->x_ppem = (FT_UShort)pixel_width;
- metrics->y_ppem = (FT_UShort)pixel_height;
-
- if ( face->face_flags & FT_FACE_FLAG_SCALABLE )
- {
- metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,
- face->units_per_EM );
-
- metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,
- face->units_per_EM );
-
- ft_recompute_scaled_metrics( face, metrics );
- }
-
- if ( clazz->set_pixel_sizes )
- error = clazz->set_pixel_sizes( face->size,
- pixel_width,
- pixel_height );
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Kerning( FT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_UInt kern_mode,
- FT_Vector *akerning )
- {
- FT_Error error = FT_Err_Ok;
- FT_Driver driver;
-
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- if ( !akerning )
- return FT_Err_Invalid_Argument;
-
- driver = face->driver;
-
- akerning->x = 0;
- akerning->y = 0;
-
- if ( driver->clazz->get_kerning )
- {
- error = driver->clazz->get_kerning( face,
- left_glyph,
- right_glyph,
- akerning );
- if ( !error )
- {
- if ( kern_mode != ft_kerning_unscaled )
- {
- akerning->x = FT_MulFix( akerning->x, face->size->metrics.x_scale );
- akerning->y = FT_MulFix( akerning->y, face->size->metrics.y_scale );
-
- if ( kern_mode != ft_kerning_unfitted )
- {
- akerning->x = ( akerning->x + 32 ) & -64;
- akerning->y = ( akerning->y + 32 ) & -64;
- }
- }
- }
- }
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Select_Charmap( FT_Face face,
- FT_Encoding encoding )
- {
- FT_CharMap* cur;
- FT_CharMap* limit;
-
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- cur = face->charmaps;
- if ( !cur )
- return FT_Err_Invalid_CharMap_Handle;
-
- limit = cur + face->num_charmaps;
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0]->encoding == encoding )
- {
- face->charmap = cur[0];
- return 0;
- }
- }
-
- return FT_Err_Invalid_Argument;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Charmap( FT_Face face,
- FT_CharMap charmap )
- {
- FT_CharMap* cur;
- FT_CharMap* limit;
-
-
- if ( !face )
- return FT_Err_Invalid_Face_Handle;
-
- cur = face->charmaps;
- if ( !cur )
- return FT_Err_Invalid_CharMap_Handle;
-
- limit = cur + face->num_charmaps;
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0] == charmap )
- {
- face->charmap = cur[0];
- return 0;
- }
- }
- return FT_Err_Invalid_Argument;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Stream_Get_Char_Index( FT_Face face,
- FT_ULong charcode )
- {
- FT_UInt result;
- FT_Driver driver;
-
-
- result = 0;
- if ( face && face->charmap )
- {
- driver = face->driver;
- result = driver->clazz->get_char_index( face->charmap, charcode );
- }
- return result;
- }
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_ULong )
- FT_Get_First_Char( FT_Face face,
- FT_UInt *agindex )
- {
- FT_ULong result = 0;
- FT_UInt gindex;
-
- gindex = FT_Stream_Get_Char_Index( face, 0 );
- if ( gindex == 0 )
- result = FT_Get_Next_Char( face, 0, &gindex );
-
- *agindex = gindex;
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_ULong )
- FT_Get_Next_Char( FT_Face face,
- FT_ULong charcode,
- FT_UInt *agindex )
- {
- FT_ULong result = 0;
- FT_UInt gindex = 0;
-
- result = 0;
- if ( face && face->charmap )
- {
- FT_Driver driver;
-
-
- driver = face->driver;
- result = driver->clazz->get_next_char( face->charmap, charcode, &gindex );
- }
-
- if ( agindex )
- *agindex = gindex;
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_UInt )
- FT_Get_Name_Index( FT_Face face,
- FT_String* glyph_name )
- {
- FT_UInt result = 0;
-
-
- if ( face && FT_HAS_GLYPH_NAMES( face ) )
- {
- /* now, lookup for glyph name */
- FT_Driver driver = face->driver;
- FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
-
-
- if ( clazz->get_interface )
- {
- FT_Face_GetGlyphNameIndexFunc requester;
-
-
- requester = (FT_Face_GetGlyphNameIndexFunc)clazz->get_interface(
- FT_MODULE( driver ), "name_index" );
- if ( requester )
- result = requester( face, glyph_name );
- }
- }
-
- return result;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Get_Glyph_Name( FT_Face face,
- FT_UInt glyph_index,
- FT_Pointer buffer,
- FT_UInt buffer_max )
- {
- FT_Error error = FT_Err_Invalid_Argument;
-
-
- /* clean up buffer */
- if ( buffer && buffer_max > 0 )
- ((FT_Byte*)buffer)[0] = 0;
-
- if ( face &&
- glyph_index < (FT_UInt)face->num_glyphs &&
- FT_HAS_GLYPH_NAMES( face ) )
- {
- /* now, lookup for glyph name */
- FT_Driver driver = face->driver;
- FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
-
-
- if ( clazz->get_interface )
- {
- FT_Face_GetGlyphNameFunc requester;
-
-
- requester = (FT_Face_GetGlyphNameFunc)clazz->get_interface(
- FT_MODULE( driver ), "glyph_name" );
- if ( requester )
- error = requester( face, glyph_index, buffer, buffer_max );
- }
- }
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( const char* )
- FT_Get_Postscript_Name( FT_Face face )
- {
- const char* result = NULL;
-
-
- if ( !face )
- goto Exit;
-
- result = face->internal->postscript_name;
- if ( !result )
- {
- /* now, lookup for glyph name */
- FT_Driver driver = face->driver;
- FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
-
-
- if ( clazz->get_interface )
- {
- FT_Face_GetPostscriptNameFunc requester;
-
-
- requester = (FT_Face_GetPostscriptNameFunc)clazz->get_interface(
- FT_MODULE( driver ), "postscript_name" );
- if ( requester )
- result = requester( face );
- }
- }
- Exit:
- return result;
- }
-
-
- /* documentation is in tttables.h */
-
- FT_EXPORT_DEF( void* )
- FT_Get_Sfnt_Table( FT_Face face,
- FT_Sfnt_Tag tag )
- {
- void* table = 0;
- FT_Get_Sfnt_Table_Func func;
- FT_Driver driver;
-
-
- if ( !face || !FT_IS_SFNT( face ) )
- goto Exit;
-
- driver = face->driver;
- func = (FT_Get_Sfnt_Table_Func)driver->root.clazz->get_interface(
- FT_MODULE( driver ), "get_sfnt" );
- if ( func )
- table = func( face, tag );
-
- Exit:
- return table;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Activate_Size( FT_Size size )
- {
- FT_Face face;
-
-
- if ( size == NULL )
- return FT_Err_Bad_Argument;
-
- face = size->face;
- if ( face == NULL || face->driver == NULL )
- return FT_Err_Bad_Argument;
-
- /* we don't need anything more complex than that; all size objects */
- /* are already listed by the face */
- face->size = size;
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** R E N D E R E R S ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
- /* lookup a renderer by glyph format in the library's list */
- FT_BASE_DEF( FT_Renderer )
- FT_Lookup_Renderer( FT_Library library,
- FT_Glyph_Format format,
- FT_ListNode* node )
- {
- FT_ListNode cur;
- FT_Renderer result = 0;
-
-
- if ( !library )
- goto Exit;
-
- cur = library->renderers.head;
-
- if ( node )
- {
- if ( *node )
- cur = (*node)->next;
- *node = 0;
- }
-
- while ( cur )
- {
- FT_Renderer renderer = FT_RENDERER( cur->data );
-
-
- if ( renderer->glyph_format == format )
- {
- if ( node )
- *node = cur;
-
- result = renderer;
- break;
- }
- cur = cur->next;
- }
-
- Exit:
- return result;
- }
-
-
- static FT_Renderer
- ft_lookup_glyph_renderer( FT_GlyphSlot slot )
- {
- FT_Face face = slot->face;
- FT_Library library = FT_FACE_LIBRARY( face );
- FT_Renderer result = library->cur_renderer;
-
-
- if ( !result || result->glyph_format != slot->format )
- result = FT_Lookup_Renderer( library, slot->format, 0 );
-
- return result;
- }
-
-
- static void
- ft_set_current_renderer( FT_Library library )
- {
- FT_Renderer renderer;
-
-
- renderer = FT_Lookup_Renderer( library, ft_glyph_format_outline, 0 );
- library->cur_renderer = renderer;
- }
-
-
- static FT_Error
- ft_add_renderer( FT_Module module )
- {
- FT_Library library = module->library;
- FT_Memory memory = library->memory;
- FT_Error error;
- FT_ListNode node;
-
-
- if ( ALLOC( node, sizeof ( *node ) ) )
- goto Exit;
-
- {
- FT_Renderer render = FT_RENDERER( module );
- FT_Renderer_Class* clazz = (FT_Renderer_Class*)module->clazz;
-
-
- render->clazz = clazz;
- render->glyph_format = clazz->glyph_format;
-
- /* allocate raster object if needed */
- if ( clazz->glyph_format == ft_glyph_format_outline &&
- clazz->raster_class->raster_new )
- {
- error = clazz->raster_class->raster_new( memory, &render->raster );
- if ( error )
- goto Fail;
-
- render->raster_render = clazz->raster_class->raster_render;
- render->render = clazz->render_glyph;
- }
-
- /* add to list */
- node->data = module;
- FT_List_Add( &library->renderers, node );
-
- ft_set_current_renderer( library );
- }
-
- Fail:
- if ( error )
- FREE( node );
-
- Exit:
- return error;
- }
-
-
- static void
- ft_renderer_remove( FT_Module module )
- {
- FT_Library library = module->library;
- FT_Memory memory = library->memory;
- FT_ListNode node;
-
-
- node = FT_List_Find( &library->renderers, module );
- if ( node )
- {
- FT_Renderer render = FT_RENDERER( module );
-
-
- /* release raster object, if any */
- if ( render->raster )
- render->clazz->raster_class->raster_done( render->raster );
-
- /* remove from list */
- FT_List_Remove( &library->renderers, node );
- FREE( node );
-
- ft_set_current_renderer( library );
- }
- }
-
-
- /* documentation is in ftrender.h */
-
- FT_EXPORT_DEF( FT_Renderer )
- FT_Get_Renderer( FT_Library library,
- FT_Glyph_Format format )
- {
- /* test for valid `library' delayed to FT_Lookup_Renderer() */
-
- return FT_Lookup_Renderer( library, format, 0 );
- }
-
-
- /* documentation is in ftrender.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Set_Renderer( FT_Library library,
- FT_Renderer renderer,
- FT_UInt num_params,
- FT_Parameter* parameters )
- {
- FT_ListNode node;
- FT_Error error = FT_Err_Ok;
-
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- if ( !renderer )
- return FT_Err_Invalid_Argument;
-
- node = FT_List_Find( &library->renderers, renderer );
- if ( !node )
- {
- error = FT_Err_Invalid_Argument;
- goto Exit;
- }
-
- FT_List_Up( &library->renderers, node );
-
- if ( renderer->glyph_format == ft_glyph_format_outline )
- library->cur_renderer = renderer;
-
- if ( num_params > 0 )
- {
- FTRenderer_setMode set_mode = renderer->clazz->set_mode;
-
-
- for ( ; num_params > 0; num_params-- )
- {
- error = set_mode( renderer, parameters->tag, parameters->data );
- if ( error )
- break;
- }
- }
-
- Exit:
- return error;
- }
-
-
- FT_EXPORT_DEF( FT_Error )
- FT_Render_Glyph_Internal( FT_Library library,
- FT_GlyphSlot slot,
- FT_UInt render_mode )
- {
- FT_Error error = FT_Err_Ok;
- FT_Renderer renderer;
-
-
- /* if it is already a bitmap, no need to do anything */
- switch ( slot->format )
- {
- case ft_glyph_format_bitmap: /* already a bitmap, don't do anything */
- break;
-
- default:
- {
- FT_ListNode node = 0;
- FT_Bool update = 0;
-
-
- /* small shortcut for the very common case */
- if ( slot->format == ft_glyph_format_outline )
- {
- renderer = library->cur_renderer;
- node = library->renderers.head;
- }
- else
- renderer = FT_Lookup_Renderer( library, slot->format, &node );
-
- error = FT_Err_Unimplemented_Feature;
- while ( renderer )
- {
- error = renderer->render( renderer, slot, render_mode, NULL );
- if ( !error ||
- FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph )
- break;
-
- /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
- /* is unsupported by the current renderer for this glyph image */
- /* format. */
-
- /* now, look for another renderer that supports the same */
- /* format. */
- renderer = FT_Lookup_Renderer( library, slot->format, &node );
- update = 1;
- }
-
- /* if we changed the current renderer for the glyph image format */
- /* we need to select it as the next current one */
- if ( !error && update && renderer )
- FT_Set_Renderer( library, renderer, 0, 0 );
- }
- }
-
- return error;
- }
-
-
- /* documentation is in freetype.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Render_Glyph( FT_GlyphSlot slot,
- FT_UInt render_mode )
- {
- FT_Library library;
-
-
- if ( !slot )
- return FT_Err_Invalid_Argument;
-
- library = FT_FACE_LIBRARY( slot->face );
-
- return FT_Render_Glyph_Internal( library, slot, render_mode );
- }
-
-
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
- /**** M O D U L E S ****/
+ /**** C O M P A T I B I L I T Y ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* ft_module_destroy */
- /* */
- /* <Description> */
- /* Destroys a given module object. For drivers, this also destroys */
- /* all child faces. */
- /* */
- /* <InOut> */
- /* module :: A handle to the target driver object. */
- /* */
- /* <Note> */
- /* The driver _must_ be LOCKED! */
- /* */
- static void
- ft_module_destroy( FT_Module module )
- {
- FT_Memory memory = module->memory;
- FT_Module_Class* clazz = module->clazz;
- FT_Library library = module->library;
-
-
- /* finalize client-data - before anything else */
- if ( module->generic.finalizer )
- module->generic.finalizer( module );
-
- if ( library && library->auto_hinter == module )
- library->auto_hinter = 0;
-
- /* if the module is a renderer */
- if ( FT_MODULE_IS_RENDERER( module ) )
- ft_renderer_remove( module );
-
- /* if the module is a font driver, add some steps */
- if ( FT_MODULE_IS_DRIVER( module ) )
- ft_driver_destroy( FT_DRIVER( module ) );
-
- /* finalize the module object */
- if ( clazz->module_done )
- clazz->module_done( module );
-
- /* discard it */
- FREE( module );
- }
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Add_Module( FT_Library library,
- const FT_Module_Class* clazz )
- {
- FT_Error error;
- FT_Memory memory;
- FT_Module module;
- FT_UInt nn;
-
-
-#define FREETYPE_VER_FIXED ( ( (FT_Long)FREETYPE_MAJOR << 16 ) | \
- FREETYPE_MINOR )
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- if ( !clazz )
- return FT_Err_Invalid_Argument;
-
- /* check freetype version */
- if ( clazz->module_requires > FREETYPE_VER_FIXED )
- return FT_Err_Invalid_Version;
-
- /* look for a module with the same name in the library's table */
- for ( nn = 0; nn < library->num_modules; nn++ )
- {
- module = library->modules[nn];
- if ( strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
- {
- /* this installed module has the same name, compare their versions */
- if ( clazz->module_version <= module->clazz->module_version )
- return FT_Err_Lower_Module_Version;
-
- /* remove the module from our list, then exit the loop to replace */
- /* it by our new version.. */
- FT_Remove_Module( library, module );
- break;
- }
- }
-
- memory = library->memory;
- error = FT_Err_Ok;
-
- if ( library->num_modules >= FT_MAX_MODULES )
- {
- error = FT_Err_Too_Many_Drivers;
- goto Exit;
- }
-
- /* allocate module object */
- if ( ALLOC( module,clazz->module_size ) )
- goto Exit;
-
- /* base initialization */
- module->library = library;
- module->memory = memory;
- module->clazz = (FT_Module_Class*)clazz;
-
- /* check whether the module is a renderer - this must be performed */
- /* before the normal module initialization */
- if ( FT_MODULE_IS_RENDERER( module ) )
- {
- /* add to the renderers list */
- error = ft_add_renderer( module );
- if ( error )
- goto Fail;
- }
-
- /* is the module a auto-hinter? */
- if ( FT_MODULE_IS_HINTER( module ) )
- library->auto_hinter = module;
-
- /* if the module is a font driver */
- if ( FT_MODULE_IS_DRIVER( module ) )
- {
- /* allocate glyph loader if needed */
- FT_Driver driver = FT_DRIVER( module );
-
-
- driver->clazz = (FT_Driver_Class)module->clazz;
- if ( FT_DRIVER_USES_OUTLINES( driver ) )
- {
- error = FT_GlyphLoader_New( memory, &driver->glyph_loader );
- if ( error )
- goto Fail;
- }
- }
-
- if ( clazz->module_init )
- {
- error = clazz->module_init( module );
- if ( error )
- goto Fail;
- }
-
- /* add module to the library's table */
- library->modules[library->num_modules++] = module;
-
- Exit:
- return error;
-
- Fail:
- if ( FT_MODULE_IS_DRIVER( module ) )
- {
- FT_Driver driver = FT_DRIVER( module );
-
-
- if ( FT_DRIVER_USES_OUTLINES( driver ) )
- FT_GlyphLoader_Done( driver->glyph_loader );
- }
-
- if ( FT_MODULE_IS_RENDERER( module ) )
- {
- FT_Renderer renderer = FT_RENDERER( module );
-
-
- if ( renderer->raster )
- renderer->clazz->raster_class->raster_done( renderer->raster );
- }
-
- FREE( module );
- goto Exit;
- }
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( FT_Module )
- FT_Get_Module( FT_Library library,
- const char* module_name )
- {
- FT_Module result = 0;
- FT_Module* cur;
- FT_Module* limit;
-
-
- if ( !library || !module_name )
- return result;
-
- cur = library->modules;
- limit = cur + library->num_modules;
-
- for ( ; cur < limit; cur++ )
- if ( strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
- {
- result = cur[0];
- break;
- }
-
- return result;
- }
-
-
- /* documentation is in ftobjs.h */
-
- FT_BASE_DEF( const void* )
- FT_Get_Module_Interface( FT_Library library,
- const char* mod_name )
- {
- FT_Module module;
-
-
- /* test for valid `library' delayed to FT_Get_Module() */
-
- module = FT_Get_Module( library, mod_name );
-
- return module ? module->clazz->module_interface : 0;
- }
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Remove_Module( FT_Library library,
- FT_Module module )
- {
- /* try to find the module from the table, then remove it from there */
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- if ( module )
- {
- FT_Module* cur = library->modules;
- FT_Module* limit = cur + library->num_modules;
-
-
- for ( ; cur < limit; cur++ )
- {
- if ( cur[0] == module )
- {
- /* remove it from the table */
- library->num_modules--;
- limit--;
- while ( cur < limit )
- {
- cur[0] = cur[1];
- cur++;
- }
- limit[0] = 0;
-
- /* destroy the module */
- ft_module_destroy( module );
-
- return FT_Err_Ok;
- }
- }
- }
- return FT_Err_Invalid_Driver_Handle;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /**** ****/
- /**** ****/
- /**** L I B R A R Y ****/
- /**** ****/
- /**** ****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_New_Library( FT_Memory memory,
- FT_Library *alibrary )
- {
- FT_Library library = 0;
- FT_Error error;
-
-
- if ( !memory )
- return FT_Err_Invalid_Argument;
-
- /* first of all, allocate the library object */
- if ( ALLOC( library, sizeof ( *library ) ) )
- return error;
-
- library->memory = memory;
-
- /* allocate the render pool */
- library->raster_pool_size = FT_RENDER_POOL_SIZE;
- if ( ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
- goto Fail;
-
- /* That's ok now */
- *alibrary = library;
-
- return FT_Err_Ok;
-
- Fail:
- FREE( library );
- return error;
- }
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( FT_Error )
- FT_Done_Library( FT_Library library )
- {
- FT_Memory memory;
-
-
- if ( !library )
- return FT_Err_Invalid_Library_Handle;
-
- memory = library->memory;
-
- /* Discard client-data */
- if ( library->generic.finalizer )
- library->generic.finalizer( library );
-
- /* Close all modules in the library */
-#if 1
- while ( library->num_modules > 0 )
- FT_Remove_Module( library, library->modules[0] );
-#else
- {
- FT_UInt n;
-
-
- for ( n = 0; n < library->num_modules; n++ )
- {
- FT_Module module = library->modules[n];
-
-
- if ( module )
- {
- ft_module_destroy( module );
- library->modules[n] = 0;
- }
- }
- }
-#endif
-
- /* Destroy raster objects */
- FREE( library->raster_pool );
- library->raster_pool_size = 0;
-
- FREE( library );
- return FT_Err_Ok;
- }
-
-
- /* documentation is in ftmodule.h */
-
- FT_EXPORT_DEF( void )
- FT_Set_Debug_Hook( FT_Library library,
- FT_UInt hook_index,
- FT_DebugHook_Func debug_hook )
- {
- if ( library && debug_hook &&
- hook_index <
- ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )
- library->debug_hooks[hook_index] = debug_hook;
- }
-
-
-
-
-
-
-
-
/* backwards compatibility API */
FT_BASE_DEF( void )
- FT_Stream_OpenMemory( FT_Library library,
+ FT_New_Memory_Stream( FT_Library library,
FT_Byte* base,
FT_ULong size,
FT_Stream stream )
{
- return FT_Stream_New_Memory( library, base, size, stream );
+ return FT_Stream_OpenMemory( library, base, size, stream );
}
FT_BASE_DEF( FT_Error )
- FT_Stream_Seek( FT_Stream stream,
+ FT_Seek_Stream( FT_Stream stream,
FT_ULong pos )
{
return FT_Stream_Seek( stream, pos );
@@ -2029,7 +59,7 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Skip( FT_Stream stream,
+ FT_Skip_Stream( FT_Stream stream,
FT_Long distance )
{
return FT_Stream_Skip( stream, distance );
@@ -2037,7 +67,7 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Read( FT_Stream stream,
+ FT_Read_Stream( FT_Stream stream,
FT_Byte* buffer,
FT_ULong count )
{
@@ -2046,7 +76,7 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Read_At( FT_Stream stream,
+ FT_Read_Stream_At( FT_Stream stream,
FT_ULong pos,
FT_Byte* buffer,
FT_ULong count )
@@ -2056,33 +86,33 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Extract_Frame( FT_Stream stream,
+ FT_Extract_Frame( FT_Stream stream,
FT_ULong count,
FT_Byte** pbytes )
{
- return FT_Stream_Extract_Frame( stream, count, pbytes );
+ return FT_Stream_ExtractFrame( stream, count, pbytes );
}
FT_BASE_DEF( void )
- FT_Stream_Release_Frame( FT_Stream stream,
+ FT_Release_Frame( FT_Stream stream,
FT_Byte** pbytes )
{
- FT_Stream_Release_Frame( stream, pbytes );
+ FT_Stream_ReleaseFrame( stream, pbytes );
}
FT_BASE_DEF( FT_Error )
- FT_Stream_Enter_Frame( FT_Stream stream,
+ FT_Access_Frame( FT_Stream stream,
FT_ULong count )
{
- return FT_Stream_Enter_Frame( stream, count );
+ return FT_Stream_EnterFrame( stream, count );
}
FT_BASE_DEF( void )
- FT_Stream_Exit_Frame( FT_Stream stream )
+ FT_Forget_Frame( FT_Stream stream )
{
- FT_Stream_Exit_Frame( stream );
+ FT_Stream_ExitFrame( stream );
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index b2766c3d8..e7dbdd7fd 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -69,9 +69,9 @@
if ( args->flags & ft_open_memory )
{
/* create a memory-based stream */
- FT_Stream_Open_Memory( stream,
- (FT_Byte*)args->memory_base,
- args->memory_size );
+ FT_Stream_OpenMemory( stream,
+ (const FT_Byte*)args->memory_base,
+ args->memory_size );
}
else if ( args->flags & ft_open_pathname )
{
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index cda168c7e..c1fa989b2 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -32,9 +32,9 @@
FT_BASE_DEF( void )
- FT_Stream_Open_Memory( FT_Stream stream,
- const FT_Byte* base,
- FT_ULong size )
+ FT_Stream_OpenMemory( FT_Stream stream,
+ const FT_Byte* base,
+ FT_ULong size )
{
stream->base = (FT_Byte*) base;
stream->size = size;
@@ -60,7 +60,7 @@
FT_Stream_Seek( FT_Stream stream,
FT_ULong pos )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
stream->pos = pos;
@@ -69,28 +69,21 @@
{
if ( stream->read( stream, pos, 0, 0 ) )
{
- FT_ERROR(( "FT_Stream_Seek:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_Seek", pos, stream->size ));
error = FT_Err_Invalid_Stream_Operation;
}
- else
- error = FT_Err_Ok;
}
/* note that seeking to the first position after the file is valid */
else if ( pos > stream->size )
{
- FT_ERROR(( "FT_Stream_Seek:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_Seek", pos, stream->size ));
error = FT_Err_Invalid_Stream_Operation;
}
- else
- error = FT_Err_Ok;
-
return error;
}
@@ -115,15 +108,15 @@
FT_Byte* buffer,
FT_ULong count )
{
- return FT_Stream_Read_At( stream, stream->pos, buffer, count );
+ return FT_Stream_ReadAt( stream, stream->pos, buffer, count );
}
FT_BASE_DEF( FT_Error )
- FT_Stream_Read_At( FT_Stream stream,
- FT_ULong pos,
- FT_Byte* buffer,
- FT_ULong count )
+ FT_Stream_ReadAt( FT_Stream stream,
+ FT_ULong pos,
+ FT_Byte* buffer,
+ FT_ULong count )
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
@@ -131,9 +124,8 @@
if ( pos >= stream->size )
{
- FT_ERROR(( "FT_Stream_Read_At:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_ReadAt", pos, stream->size ));
return FT_Err_Invalid_Stream_Operation;
}
@@ -153,9 +145,8 @@
if ( read_bytes < count )
{
- FT_ERROR(( "FT_Stream_Read_At:" ));
- FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
- count, read_bytes ));
+ FT_ERROR(( "%s: invalid read; expected %lu bytes, got %lu\n",
+ "FT_Stream_ReadAt", count, read_bytes ));
error = FT_Err_Invalid_Stream_Operation;
}
@@ -165,19 +156,19 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Extract_Frame( FT_Stream stream,
- FT_ULong count,
- FT_Byte** pbytes )
+ FT_Stream_ExtractFrame( FT_Stream stream,
+ FT_ULong count,
+ FT_Byte** pbytes )
{
FT_Error error;
- error = FT_Stream_Enter_Frame( stream, count );
+ error = FT_Stream_EnterFrame( stream, count );
if ( !error )
{
*pbytes = (FT_Byte*)stream->cursor;
- /* equivalent to FT_Stream_Exit_Frame(), with no memory block release */
+ /* equivalent to FT_Stream_ExitFrame(), with no memory block release */
stream->cursor = 0;
stream->limit = 0;
}
@@ -187,8 +178,8 @@
FT_BASE_DEF( void )
- FT_Stream_Release_Frame( FT_Stream stream,
- FT_Byte** pbytes )
+ FT_Stream_ReleaseFrame( FT_Stream stream,
+ FT_Byte** pbytes )
{
if ( stream->read )
{
@@ -202,8 +193,8 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Enter_Frame( FT_Stream stream,
- FT_ULong count )
+ FT_Stream_EnterFrame( FT_Stream stream,
+ FT_ULong count )
{
FT_Error error = FT_Err_Ok;
FT_ULong read_bytes;
@@ -226,7 +217,7 @@
stream->base, count );
if ( read_bytes < count )
{
- FT_ERROR(( "FT_Stream_Enter_Frame:" ));
+ FT_ERROR(( "FT_Stream_EnterFrame:" ));
FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
count, read_bytes ));
@@ -243,7 +234,7 @@
if ( stream->pos >= stream->size ||
stream->pos + count > stream->size )
{
- FT_ERROR(( "FT_Stream_Enter_Frame:" ));
+ FT_ERROR(( "FT_Stream_EnterFrame:" ));
FT_ERROR(( " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
stream->pos, count, stream->size ));
@@ -263,7 +254,7 @@
FT_BASE_DEF( void )
- FT_Stream_Exit_Frame( FT_Stream stream )
+ FT_Stream_ExitFrame( FT_Stream stream )
{
/* IMPORTANT: The assertion stream->cursor != 0 was removed, given */
/* that it is possible to access a frame of length 0 in */
@@ -272,7 +263,7 @@
/* */
/* In this case, the loader code handles the 0-length table */
/* gracefully; however, stream.cursor is really set to 0 by the */
- /* FT_Stream_Enter_Frame() call, and this is not an error. */
+ /* FT_Stream_EnterFrame() call, and this is not an error. */
/* */
FT_ASSERT( stream );
@@ -289,7 +280,7 @@
FT_BASE_DEF( FT_Char )
- FT_Stream_Get_Char( FT_Stream stream )
+ FT_Stream_GetChar( FT_Stream stream )
{
FT_Char result;
@@ -305,7 +296,7 @@
FT_BASE_DEF( FT_Short )
- FT_Stream_Get_Short( FT_Stream stream )
+ FT_Stream_GetShort( FT_Stream stream )
{
FT_Byte* p;
FT_Short result;
@@ -324,7 +315,7 @@
FT_BASE_DEF( FT_Short )
- FT_Stream_Get_ShortLE( FT_Stream stream )
+ FT_Stream_GetShortLE( FT_Stream stream )
{
FT_Byte* p;
FT_Short result;
@@ -343,7 +334,7 @@
FT_BASE_DEF( FT_Long )
- FT_Stream_Get_Offset( FT_Stream stream )
+ FT_Stream_GetOffset( FT_Stream stream )
{
FT_Byte* p;
FT_Long result;
@@ -361,7 +352,7 @@
FT_BASE_DEF( FT_Long )
- FT_Stream_Get_Long( FT_Stream stream )
+ FT_Stream_GetLong( FT_Stream stream )
{
FT_Byte* p;
FT_Long result;
@@ -379,7 +370,7 @@
FT_BASE_DEF( FT_Long )
- FT_Stream_Get_LongLE( FT_Stream stream )
+ FT_Stream_GetLongLE( FT_Stream stream )
{
FT_Byte* p;
FT_Long result;
@@ -397,8 +388,8 @@
FT_BASE_DEF( FT_Char )
- FT_Stream_Read_Char( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadChar( FT_Stream stream,
+ FT_Error* error )
{
FT_Byte result = 0;
@@ -425,17 +416,16 @@
Fail:
*error = FT_Err_Invalid_Stream_Operation;
- FT_ERROR(( "FT_Stream_Read_Char:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_ReadChar", stream->pos, stream->size ));
return 0;
}
FT_BASE_DEF( FT_Short )
- FT_Stream_Read_Short( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadShort( FT_Stream stream,
+ FT_Error* error )
{
FT_Byte reads[2];
FT_Byte* p = 0;
@@ -472,7 +462,7 @@
Fail:
*error = FT_Err_Invalid_Stream_Operation;
- FT_ERROR(( "FT_Stream_Read_Short:" ));
+ FT_ERROR(( "FT_Stream_ReadShort:" ));
FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
@@ -481,8 +471,8 @@
FT_BASE_DEF( FT_Short )
- FT_Stream_Read_ShortLE( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadShortLE( FT_Stream stream,
+ FT_Error* error )
{
FT_Byte reads[2];
FT_Byte* p = 0;
@@ -519,7 +509,7 @@
Fail:
*error = FT_Err_Invalid_Stream_Operation;
- FT_ERROR(( "FT_Stream_Read_Short:" ));
+ FT_ERROR(( "FT_Stream_ReadShort:" ));
FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
@@ -528,8 +518,8 @@
FT_BASE_DEF( FT_Long )
- FT_Stream_Read_Offset( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadOffset( FT_Stream stream,
+ FT_Error* error )
{
FT_Byte reads[3];
FT_Byte* p = 0;
@@ -566,19 +556,18 @@
Fail:
*error = FT_Err_Invalid_Stream_Operation;
- FT_ERROR(( "FT_Stream_Read_Offset:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_ReadOffset", stream->pos, stream->size ));
return 0;
}
FT_BASE_DEF( FT_Long )
- FT_Stream_Read_Long( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadLong( FT_Stream stream,
+ FT_Error* error )
{
- FT_Byte reads[4];
+ FT_Byte reads[4];
FT_Byte* p = 0;
FT_Long result = 0;
@@ -612,9 +601,8 @@
return result;
Fail:
- FT_ERROR(( "FT_Stream_Read_Long:" ));
- FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
- stream->pos, stream->size ));
+ FT_ERROR(( "%s: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+ "FT_Stream_ReadLong", stream->pos, stream->size ));
*error = FT_Err_Invalid_Stream_Operation;
return 0;
@@ -622,8 +610,8 @@
FT_BASE_DEF( FT_Long )
- FT_Stream_Read_LongLE( FT_Stream stream,
- FT_Error* error )
+ FT_Stream_ReadLongLE( FT_Stream stream,
+ FT_Error* error )
{
FT_Byte reads[4];
FT_Byte* p = 0;
@@ -659,7 +647,7 @@
return result;
Fail:
- FT_ERROR(( "FT_Stream_Read_Long:" ));
+ FT_ERROR(( "FT_Stream_ReadLong:" ));
FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
*error = FT_Err_Invalid_Stream_Operation;
@@ -669,9 +657,9 @@
FT_BASE_DEF( FT_Error )
- FT_Stream_Read_Fields( FT_Stream stream,
- const FT_Frame_Field* fields,
- void* structure )
+ FT_Stream_ReadFields( FT_Stream stream,
+ const FT_Frame_Field* fields,
+ void* structure )
{
FT_Error error;
FT_Bool frame_accessed = 0;
@@ -692,7 +680,7 @@
switch ( fields->value )
{
case ft_frame_start: /* access a new frame */
- error = FT_Stream_Enter_Frame( stream, fields->offset );
+ error = FT_Stream_EnterFrame( stream, fields->offset );
if ( error )
goto Exit;
@@ -804,7 +792,7 @@
Exit:
/* close the frame if it was opened by this read */
if ( frame_accessed )
- FT_Stream_Exit_Frame( stream );
+ FT_Stream_ExitFrame( stream );
return error;
}
diff --git a/src/base/rules.mk b/src/base/rules.mk
index 0fe18817d..6b74753d2 100644
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -39,6 +39,7 @@ BASE_SRC := $(BASE_)ftcalc.c \
$(BASE_)ftgloadr.c \
$(BASE_)ftoutln.c \
$(BASE_)ftobjs.c \
+ $(BASE_)ftapi.c \
$(BASE_)ftnames.c \
$(BASE_)ftdbgmem.c
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 9ee3e0324..df0ca3b05 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1114,7 +1114,7 @@
data_size = (FT_ULong)( count + 1 ) * offsize;
if ( ALLOC_ARRAY( idx->offsets, count + 1, FT_ULong ) ||
- ACCESS_Frame( data_size ) )
+ FT_FRAME_ENTER( data_size ) )
goto Exit;
poff = idx->offsets;
@@ -1127,21 +1127,21 @@
p += offsize;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
- idx->data_offset = FILE_Pos();
+ idx->data_offset = FT_STREAM_POS();
data_size = poff[-1] - 1;
if ( load )
{
/* load the data */
- if ( EXTRACT_Frame( data_size, idx->bytes ) )
+ if ( FT_FRAME_EXTRACT( data_size, idx->bytes ) )
goto Exit;
}
else
{
/* skip the data */
- if ( FILE_Skip( data_size ) )
+ if ( FT_STREAM_SKIP( data_size ) )
goto Exit;
}
}
@@ -1164,7 +1164,7 @@
if ( idx->bytes )
- RELEASE_Frame( idx->bytes );
+ FT_FRAME_RELEASE( idx->bytes );
FREE( idx->offsets );
MEM_Set( idx, 0, sizeof ( *idx ) );
@@ -1249,8 +1249,8 @@
FT_Stream stream = idx->stream;
- if ( FILE_Seek( idx->data_offset + off1 - 1 ) ||
- EXTRACT_Frame( off2 - off1, *pbytes ) )
+ if ( FT_STREAM_SEEK( idx->data_offset + off1 - 1 ) ||
+ FT_FRAME_EXTRACT( off2 - off1, *pbytes ) )
goto Exit;
}
}
@@ -1278,7 +1278,7 @@
FT_Stream stream = idx->stream;
- RELEASE_Frame( *pbytes );
+ FT_FRAME_RELEASE( *pbytes );
}
}
@@ -1361,7 +1361,7 @@
FT_Stream stream )
{
if ( select->data )
- RELEASE_Frame( select->data );
+ FT_FRAME_RELEASE( select->data );
select->data_size = 0;
select->format = 0;
@@ -1381,7 +1381,7 @@
/* read format */
- if ( FILE_Seek( offset ) || READ_Byte( format ) )
+ if ( FT_STREAM_SEEK( offset ) || READ_Byte( format ) )
goto Exit;
select->format = format;
@@ -1400,7 +1400,7 @@
select->data_size = num_ranges * 3 + 2;
Load_Data:
- if ( EXTRACT_Frame( select->data_size, select->data ) )
+ if ( FT_FRAME_EXTRACT( select->data_size, select->data ) )
goto Exit;
break;
@@ -1528,7 +1528,7 @@
charset->offset = base_offset + offset;
/* Get the format of the table. */
- if ( FILE_Seek( charset->offset ) ||
+ if ( FT_STREAM_SEEK( charset->offset ) ||
READ_Byte( charset->format ) )
goto Exit;
@@ -1746,7 +1746,7 @@
encoding->offset = base_offset + offset;
/* we need to parse the table to determine its size */
- if ( FILE_Seek( encoding->offset ) ||
+ if ( FT_STREAM_SEEK( encoding->offset ) ||
READ_Byte( encoding->format ) ||
READ_Byte( count ) )
goto Exit;
@@ -2009,14 +2009,14 @@
CFF_Parser_Init( &parser, CFF_CODE_PRIVATE, priv );
- if ( FILE_Seek( base_offset + font->font_dict.private_offset ) ||
- ACCESS_Frame( font->font_dict.private_size ) )
+ if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
+ FT_FRAME_ENTER( font->font_dict.private_size ) )
goto Exit;
error = CFF_Parser_Run( &parser,
(FT_Byte*)stream->cursor,
(FT_Byte*)stream->limit );
- FORGET_Frame();
+ FT_FRAME_EXIT();
if ( error )
goto Exit;
}
@@ -2024,7 +2024,7 @@
/* read the local subrs, if any */
if ( priv->local_subrs_offset )
{
- if ( FILE_Seek( base_offset + top->private_offset +
+ if ( FT_STREAM_SEEK( base_offset + top->private_offset +
priv->local_subrs_offset ) )
goto Exit;
@@ -2085,10 +2085,10 @@
font->stream = stream;
font->memory = memory;
dict = &font->top_font.font_dict;
- base_offset = FILE_Pos();
+ base_offset = FT_STREAM_POS();
/* read CFF font header */
- if ( READ_Fields( cff_header_fields, font ) )
+ if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) )
goto Exit;
/* check format */
@@ -2102,7 +2102,7 @@
}
/* skip the rest of the header */
- if ( FILE_Skip( font->header_size - 4 ) )
+ if ( FT_STREAM_SKIP( font->header_size - 4 ) )
goto Exit;
/* read the name, top dict, string and global subrs index */
@@ -2144,7 +2144,7 @@
/* this is a CID-keyed font, we must now allocate a table of */
/* sub-fonts, then load each of them separately */
- if ( FILE_Seek( base_offset + dict->cid_fd_array_offset ) )
+ if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) )
goto Exit;
error = cff_new_index( &fd_index, stream, 0 );
@@ -2199,7 +2199,7 @@
goto Exit;
}
- if ( FILE_Seek( base_offset + dict->charstrings_offset ) )
+ if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )
goto Exit;
error = cff_new_index( &font->charstrings_index, stream, 0 );
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index b3631bacc..500c7e14e 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -326,7 +326,7 @@
face->root.driver->root.library, "pshinter" );
/* create input stream from resource */
- if ( FILE_Seek( 0 ) )
+ if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
/* check that we have a valid OpenType file */
@@ -378,7 +378,7 @@
else
{
/* rewind to start of file; we are going to load a pure-CFF font */
- if ( FILE_Seek( 0 ) )
+ if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
error = CFF_Err_Ok;
}
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 4ef73e01e..fd1a0a4b4 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -51,9 +51,9 @@
/* read the CID font dict index and charstring offset from the CIDMap */
- if ( FILE_Seek( cid->data_offset + cid->cidmap_offset +
+ if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
glyph_index * entry_len ) ||
- ACCESS_Frame( 2 * entry_len ) )
+ FT_FRAME_ENTER( 2 * entry_len ) )
goto Exit;
p = (FT_Byte*)stream->cursor;
@@ -62,7 +62,7 @@
p += cid->fd_bytes;
glyph_len = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* now, if the glyph is not empty, set up the subrs array, and parse */
/* the charstrings */
@@ -92,7 +92,7 @@
if ( ALLOC( charstring, glyph_len ) )
goto Exit;
- if ( !FILE_Read_At( cid->data_offset + off1, charstring, glyph_len ) )
+ if ( !FT_STREAM_READ_AT( cid->data_offset + off1, charstring, glyph_len ) )
{
FT_Int cs_offset;
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index fdb5230df..31e421bd3 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -426,15 +426,15 @@
}
/* read the subrmap's offsets */
- if ( FILE_Seek( cid->data_offset + dict->subrmap_offset ) ||
- ACCESS_Frame( ( num_subrs + 1 ) * dict->sd_bytes ) )
+ if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
+ FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes ) )
goto Fail;
p = (FT_Byte*)stream->cursor;
for ( count = 0; count <= num_subrs; count++ )
offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* now, compute the size of subrs charstrings, */
/* allocate, and read them */
@@ -444,8 +444,8 @@
ALLOC( subr->code[0], data_len ) )
goto Fail;
- if ( FILE_Seek( cid->data_offset + offsets[0] ) ||
- FILE_Read( subr->code[0], data_len ) )
+ if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
+ FT_STREAM_READ( subr->code[0], data_len ) )
goto Fail;
/* set up pointers */
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 4aee9562e..fde6c9a54 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -310,7 +310,7 @@
}
/* open the tokenizer; this will also check the font format */
- if ( FILE_Seek( 0 ) )
+ if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
error = CID_Open_Face( face );
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index df14bc3fb..e35eba799 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -67,10 +67,10 @@
parser->stream = stream;
- base_offset = FILE_Pos();
+ base_offset = FT_STREAM_POS();
/* first of all, check the font format in the header */
- if ( ACCESS_Frame( 31 ) )
+ if ( FT_FRAME_ENTER( 31 ) )
goto Exit;
if ( strncmp( (char *)stream->cursor,
@@ -80,7 +80,7 @@
error = CID_Err_Unknown_File_Format;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
if ( error )
goto Exit;
@@ -99,10 +99,10 @@
p = buffer + buff_len;
- if ( FILE_Read( p, 256 + 10 - buff_len ) )
+ if ( FT_STREAM_READ( p, 256 + 10 - buff_len ) )
goto Exit;
- top_position = FILE_Pos() - buff_len;
+ top_position = FT_STREAM_POS() - buff_len;
buff_len = 256 + 10;
/* look for `StartData' */
@@ -123,8 +123,8 @@
/* section */
ps_len = offset - base_offset;
- if ( FILE_Seek( base_offset ) ||
- EXTRACT_Frame( ps_len, parser->postscript ) )
+ if ( FT_STREAM_SEEK( base_offset ) ||
+ FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
goto Exit;
parser->data_offset = offset;
@@ -148,7 +148,7 @@
FT_Stream stream = parser->stream;
- RELEASE_Frame( parser->postscript );
+ FT_FRAME_RELEASE( parser->postscript );
}
parser->root.funcs.done( &parser->root );
}
diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c
index 281014e08..1e866a39e 100644
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -211,8 +211,8 @@ THE SOFTWARE.
if ( ALLOC( bitmap->buffer, bytes ) )
goto Exit;
- if ( FILE_Seek( metric->bits ) ||
- FILE_Read( bitmap->buffer, bytes ) )
+ if ( FT_STREAM_SEEK( metric->bits ) ||
+ FT_STREAM_READ( bitmap->buffer, bytes ) )
goto Exit;
if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index e7cc8603e..52899c82a 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -98,8 +98,8 @@ THE SOFTWARE.
FT_UInt n;
- if ( FILE_Seek ( 0 ) ||
- READ_Fields ( pcf_toc_header, toc ) )
+ if ( FT_STREAM_SEEK ( 0 ) ||
+ FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
return PCF_Err_Cannot_Open_Resource;
if ( toc->version != PCF_FILE_VERSION )
@@ -111,7 +111,7 @@ THE SOFTWARE.
tables = face->toc.tables;
for ( n = 0; n < toc->count; n++ )
{
- if ( READ_Fields( pcf_table_header, tables ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )
goto Exit;
tables++;
}
@@ -220,7 +220,7 @@ THE SOFTWARE.
: pcf_metric_header;
/* the following sets 'error' but doesn't return in case of failure */
- (void) READ_Fields( fields, metric );
+ (void) FT_STREAM_READ_FIELDS( fields, metric );
}
else
{
@@ -228,7 +228,7 @@ THE SOFTWARE.
/* parsing compressed metrics */
- if ( READ_Fields( pcf_compressed_metric_header, &compr ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_compressed_metric_header, &compr ) )
goto Exit;
metric->leftSideBearing = (FT_Short)( compr.leftSideBearing - 0x80 );
@@ -262,7 +262,7 @@ THE SOFTWARE.
if ( stream->pos > tables[i].offset )
return PCF_Err_Invalid_Stream_Skip;
- if ( FILE_Skip( tables[i].offset - stream->pos ) )
+ if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )
return PCF_Err_Invalid_Stream_Skip;
*asize = tables[i].size; /* unused - to be removed */
@@ -390,12 +390,12 @@ THE SOFTWARE.
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
{
- if ( READ_Fields( pcf_property_msb_header, props + i ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) )
goto Bail;
}
else
{
- if ( READ_Fields( pcf_property_header, props + i ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) )
goto Bail;
}
}
@@ -568,7 +568,7 @@ THE SOFTWARE.
if ( error )
return error;
- error = FT_Stream_Enter_Frame( stream, 8 );
+ error = FT_Stream_EnterFrame( stream, 8 );
if ( error )
return error;
@@ -578,7 +578,7 @@ THE SOFTWARE.
else
nbitmaps = GET_ULongLE();
- FT_Stream_Exit_Frame( stream );
+ FT_Stream_ExitFrame( stream );
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
return PCF_Err_Invalid_File_Format;
@@ -660,7 +660,7 @@ THE SOFTWARE.
if ( error )
return error;
- error = FT_Stream_Enter_Frame( stream, 14 );
+ error = FT_Stream_EnterFrame( stream, 14 );
if ( error )
return error;
@@ -683,7 +683,7 @@ THE SOFTWARE.
face->defaultChar = GET_ShortLE();
}
- FT_Stream_Exit_Frame( stream );
+ FT_Stream_ExitFrame( stream );
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
return PCF_Err_Invalid_File_Format;
@@ -696,7 +696,7 @@ THE SOFTWARE.
if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) )
return PCF_Err_Out_Of_Memory;
- error = FT_Stream_Enter_Frame( stream, 2 * nencoding );
+ error = FT_Stream_EnterFrame( stream, 2 * nencoding );
if ( error )
goto Bail;
@@ -721,7 +721,7 @@ THE SOFTWARE.
FT_TRACE4(( "enc n. %d ; Uni %ld ; Glyph %d\n",
i, tmpEncoding[j - 1].enc, encodingOffset ));
}
- FT_Stream_Exit_Frame( stream );
+ FT_Stream_ExitFrame( stream );
if ( ALLOC( encoding, (--j) * sizeof ( PCF_EncodingRec ) ) )
goto Bail;
@@ -816,12 +816,12 @@ THE SOFTWARE.
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
{
- if ( READ_Fields( pcf_accel_msb_header, accel ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_accel_msb_header, accel ) )
goto Bail;
}
else
{
- if ( READ_Fields( pcf_accel_header, accel ) )
+ if ( FT_STREAM_READ_FIELDS( pcf_accel_header, accel ) )
goto Bail;
}
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index aed6ca515..665b2ddad 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -135,7 +135,7 @@
memory = stream->memory;
- if ( FILE_Seek( cmap->offset ) )
+ if ( FT_STREAM_SEEK( cmap->offset ) )
return error;
switch ( cmap->format )
@@ -145,7 +145,7 @@
if ( READ_UShort( cmap0->language ) ||
ALLOC( cmap0->glyphIdArray, 256L ) ||
- FILE_Read( cmap0->glyphIdArray, 256L ) )
+ FT_STREAM_READ( cmap0->glyphIdArray, 256L ) )
goto Fail;
cmap->get_index = code_to_index0;
@@ -159,7 +159,7 @@
/* allocate subheader keys */
if ( ALLOC_ARRAY( cmap2->subHeaderKeys, 256, FT_UShort ) ||
- ACCESS_Frame( 2L + 512L ) )
+ FT_FRAME_ENTER( 2L + 512L ) )
goto Fail;
cmap2->language = GET_UShort();
@@ -173,7 +173,7 @@
num_SH = u;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* load subheaders */
@@ -183,7 +183,7 @@
if ( ALLOC_ARRAY( cmap2->subHeaders,
num_SH + 1,
TT_CMap2SubHeaderRec ) ||
- ACCESS_Frame( ( num_SH + 1 ) * 8L ) )
+ FT_FRAME_ENTER( ( num_SH + 1 ) * 8L ) )
{
FREE( cmap2->subHeaderKeys );
goto Fail;
@@ -203,12 +203,12 @@
cmap2sub++;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* load glyph IDs */
if ( ALLOC_ARRAY( cmap2->glyphIdArray, l, FT_UShort ) ||
- ACCESS_Frame( l * 2L ) )
+ FT_FRAME_ENTER( l * 2L ) )
{
FREE( cmap2->subHeaders );
FREE( cmap2->subHeaderKeys );
@@ -218,7 +218,7 @@
for ( i = 0; i < l; i++ )
cmap2->glyphIdArray[i] = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap->get_index = code_to_index2;
cmap->get_next_char = code_to_next2;
@@ -229,7 +229,7 @@
/* load header */
- if ( ACCESS_Frame( 10L ) )
+ if ( FT_FRAME_ENTER( 10L ) )
goto Fail;
cmap4->language = GET_UShort();
@@ -240,14 +240,14 @@
num_Seg = (FT_UShort)( cmap4->segCountX2 / 2 );
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* load segments */
if ( ALLOC_ARRAY( cmap4->segments,
num_Seg,
TT_CMap4SegmentRec ) ||
- ACCESS_Frame( ( num_Seg * 4 + 1 ) * 2L ) )
+ FT_FRAME_ENTER( ( num_Seg * 4 + 1 ) * 2L ) )
goto Fail;
segments = cmap4->segments;
@@ -266,7 +266,7 @@
for ( i = 0; i < num_Seg; i++ )
segments[i].idRangeOffset = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap4->numGlyphId = l = (FT_UShort)(
( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2 );
@@ -274,7 +274,7 @@
/* load IDs */
if ( ALLOC_ARRAY( cmap4->glyphIdArray, l, FT_UShort ) ||
- ACCESS_Frame( l * 2L ) )
+ FT_FRAME_ENTER( l * 2L ) )
{
FREE( cmap4->segments );
goto Fail;
@@ -283,7 +283,7 @@
for ( i = 0; i < l; i++ )
cmap4->glyphIdArray[i] = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap4->last_segment = cmap4->segments;
@@ -294,25 +294,25 @@
case 6:
cmap6 = &cmap->c.cmap6;
- if ( ACCESS_Frame( 6L ) )
+ if ( FT_FRAME_ENTER( 6L ) )
goto Fail;
cmap6->language = GET_UShort();
cmap6->firstCode = GET_UShort();
cmap6->entryCount = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
l = cmap6->entryCount;
if ( ALLOC_ARRAY( cmap6->glyphIdArray, l, FT_Short ) ||
- ACCESS_Frame( l * 2L ) )
+ FT_FRAME_ENTER( l * 2L ) )
goto Fail;
for ( i = 0; i < l; i++ )
cmap6->glyphIdArray[i] = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap->get_index = code_to_index6;
cmap->get_next_char = code_to_next6;
break;
@@ -321,16 +321,16 @@
case 12:
cmap8_12 = &cmap->c.cmap8_12;
- if ( ACCESS_Frame( 8L ) )
+ if ( FT_FRAME_ENTER( 8L ) )
goto Fail;
cmap->length = GET_ULong();
cmap8_12->language = GET_ULong();
- FORGET_Frame();
+ FT_FRAME_EXIT();
if ( cmap->format == 8 )
- if ( FILE_Skip( 8192L ) )
+ if ( FT_STREAM_SKIP( 8192L ) )
goto Fail;
if ( READ_ULong( cmap8_12->nGroups ) )
@@ -339,7 +339,7 @@
n = cmap8_12->nGroups;
if ( ALLOC_ARRAY( cmap8_12->groups, n, TT_CMapGroupRec ) ||
- ACCESS_Frame( n * 3 * 4L ) )
+ FT_FRAME_ENTER( n * 3 * 4L ) )
goto Fail;
groups = cmap8_12->groups;
@@ -351,7 +351,7 @@
groups[j].startGlyphID = GET_ULong();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap8_12->last_group = cmap8_12->groups;
@@ -362,7 +362,7 @@
case 10:
cmap10 = &cmap->c.cmap10;
- if ( ACCESS_Frame( 16L ) )
+ if ( FT_FRAME_ENTER( 16L ) )
goto Fail;
cmap->length = GET_ULong();
@@ -370,18 +370,18 @@
cmap10->startCharCode = GET_ULong();
cmap10->numChars = GET_ULong();
- FORGET_Frame();
+ FT_FRAME_EXIT();
n = cmap10->numChars;
if ( ALLOC_ARRAY( cmap10->glyphs, n, FT_Short ) ||
- ACCESS_Frame( n * 2L ) )
+ FT_FRAME_ENTER( n * 2L ) )
goto Fail;
for ( j = 0; j < n; j++ )
cmap10->glyphs[j] = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
cmap->get_index = code_to_index10;
cmap->get_next_char = code_to_next10;
break;
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 41b98cd26..0b729e730 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -120,7 +120,7 @@
if ( length )
*length = table->Length;
- if ( FILE_Seek( table->Offset ) )
+ if ( FT_STREAM_SEEK( table->Offset ) )
goto Exit;
}
else
@@ -217,20 +217,20 @@
/* it's a TrueType collection, i.e. a file containing several */
/* font files. Read the font directory now */
- if ( READ_Fields( ttc_header_fields, &face->ttc_header ) )
+ if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
goto Exit;
/* now read the offsets of each font in the file */
if ( ALLOC_ARRAY( face->ttc_header.offsets,
face->ttc_header.count,
FT_ULong ) ||
- ACCESS_Frame( face->ttc_header.count * 4L ) )
+ FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
goto Exit;
for ( n = 0; n < face->ttc_header.count; n++ )
face->ttc_header.offsets[n] = GET_ULong();
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* check face index */
if ( face_index >= face->ttc_header.count )
@@ -240,14 +240,14 @@
}
/* seek to the appropriate TrueType file, then read tag */
- if ( FILE_Seek( face->ttc_header.offsets[face_index] ) ||
+ if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ||
READ_Long( format_tag ) )
goto Exit;
}
/* the format tag was read, now check the rest of the header */
sfnt->format_tag = format_tag;
- if ( READ_Fields( sfnt_header_fields, sfnt ) )
+ if ( FT_STREAM_READ_FIELDS( sfnt_header_fields, sfnt ) )
goto Exit;
/* now, check the values of `num_tables', `seach_range', etc. */
@@ -317,7 +317,7 @@
TT_TableRec ) )
goto Exit;
- if ( ACCESS_Frame( face->num_tables * 16L ) )
+ if ( FT_FRAME_ENTER( face->num_tables * 16L ) )
goto Exit;
entry = face->dir_tables;
@@ -339,7 +339,7 @@
entry->Length ));
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
FT_TRACE2(( "Directory loaded\n\n" ));
@@ -430,7 +430,7 @@
stream = face->root.stream;
/* the `if' is syntactic sugar for picky compilers */
- if ( FILE_Read_At( offset, buffer, size ) )
+ if ( FT_STREAM_READ_AT( offset, buffer, size ) )
goto Exit;
Exit:
@@ -507,7 +507,7 @@
header = &face->header;
- if ( READ_Fields( header_fields, header ) )
+ if ( FT_STREAM_READ_FIELDS( header_fields, header ) )
goto Exit;
FT_TRACE2(( " Units per EM: %8u\n", header->Units_Per_EM ));
@@ -598,7 +598,7 @@
if ( error )
goto Exit;
- if ( READ_Fields( maxp_fields, maxProfile ) )
+ if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) )
goto Exit;
maxProfile->maxPoints = 0;
@@ -617,7 +617,7 @@
if ( maxProfile->version >= 0x10000L )
{
- if ( READ_Fields( maxp_fields_extra, maxProfile ) )
+ if ( FT_STREAM_READ_FIELDS( maxp_fields_extra, maxProfile ) )
goto Exit;
/* XXX: an adjustment that is necessary to load certain */
@@ -753,7 +753,7 @@
ALLOC_ARRAY( *shorts, num_shorts, TT_ShortMetrics ) )
goto Exit;
- if ( ACCESS_Frame( table_len ) )
+ if ( FT_FRAME_ENTER( table_len ) )
goto Exit;
{
@@ -791,7 +791,7 @@
}
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
FT_TRACE2(( "loaded\n" ));
@@ -883,7 +883,7 @@
header = &face->horizontal;
}
- if ( READ_Fields( metrics_header_fields, header ) )
+ if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
goto Exit;
header->long_metrics = NULL;
@@ -967,11 +967,11 @@
goto Exit;
}
- table_pos = FILE_Pos();
+ table_pos = FT_STREAM_POS();
names = &face->name_table;
- if ( READ_Fields( name_table_fields, names ) )
+ if ( FT_STREAM_READ_FIELDS( name_table_fields, names ) )
goto Exit;
/* check the 'storageOffset' field */
@@ -989,7 +989,7 @@
/* Allocate the array of name records. */
if ( ALLOC( names->names,
names->numNameRecords*sizeof(TT_NameEntryRec) + storageSize ) ||
- ACCESS_Frame( names->numNameRecords * 12L ) )
+ FT_FRAME_ENTER( names->numNameRecords * 12L ) )
goto Exit;
storage = (FT_Byte*)(names->names + names->numNameRecords);
@@ -1003,7 +1003,7 @@
for ( ; cur < limit; cur ++ )
{
- if ( READ_Fields( name_record_fields, cur ) )
+ if ( FT_STREAM_READ_FIELDS( name_record_fields, cur ) )
break;
/* invalid name entries will have "cur->string" set to NULL !! */
@@ -1018,14 +1018,14 @@
}
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
if (error)
goto Exit;
storageOffset -= 6 + 12*names->numNameRecords;
- if ( FILE_Skip( storageOffset ) ||
- FILE_Read( storage, storageSize ) )
+ if ( FT_STREAM_SKIP( storageOffset ) ||
+ FT_STREAM_READ( storage, storageSize ) )
goto Exit;
@@ -1165,9 +1165,9 @@
goto Exit;
}
- table_start = FILE_Pos();
+ table_start = FT_STREAM_POS();
- if ( READ_Fields( cmap_fields, &cmap_dir ) )
+ if ( FT_STREAM_READ_FIELDS( cmap_fields, &cmap_dir ) )
goto Exit;
/* reserve space in face table for cmap tables */
@@ -1183,7 +1183,7 @@
/* read the header of each charmap first */
- if ( ACCESS_Frame( face->num_charmaps * 8L ) )
+ if ( FT_FRAME_ENTER( face->num_charmaps * 8L ) )
goto Exit;
for ( ; charmap < limit; charmap++ )
@@ -1200,7 +1200,7 @@
cmap->offset = (FT_ULong)GET_Long();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* now read the rest of each table */
for ( charmap = face->charmaps; charmap < limit; charmap++ )
@@ -1208,11 +1208,11 @@
TT_CMapTable cmap = &charmap->cmap;
- if ( FILE_Seek( table_start + (FT_Long)cmap->offset ) ||
- READ_Fields( cmap_rec_fields, cmap ) )
+ if ( FT_STREAM_SEEK( table_start + (FT_Long)cmap->offset ) ||
+ FT_STREAM_READ_FIELDS( cmap_rec_fields, cmap ) )
goto Exit;
- cmap->offset = FILE_Pos();
+ cmap->offset = FT_STREAM_POS();
}
}
@@ -1333,7 +1333,7 @@
os2 = &face->os2;
- if ( READ_Fields( os2_fields, os2 ) )
+ if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) )
goto Exit;
os2->ulCodePageRange1 = 0;
@@ -1347,13 +1347,13 @@
if ( os2->version >= 0x0001 )
{
/* only version 1 tables */
- if ( READ_Fields( os2_fields_extra, os2 ) )
+ if ( FT_STREAM_READ_FIELDS( os2_fields_extra, os2 ) )
goto Exit;
if ( os2->version >= 0x0002 )
{
/* only version 2 tables */
- if ( READ_Fields( os2_fields_extra2, os2 ) )
+ if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
goto Exit;
}
}
@@ -1412,7 +1412,7 @@
if ( error )
return SFNT_Err_Post_Table_Missing;
- if ( READ_Fields( post_fields, post ) )
+ if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
return error;
/* we don't load the glyph names, we do that in another */
@@ -1480,7 +1480,7 @@
return SFNT_Err_Ok;
}
- if ( READ_Fields( pclt_fields, pclt ) )
+ if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )
goto Exit;
FT_TRACE2(( "loaded\n" ));
@@ -1523,19 +1523,19 @@
if ( error )
return SFNT_Err_Ok;
- if ( ACCESS_Frame( 4L ) )
+ if ( FT_FRAME_ENTER( 4L ) )
goto Exit;
face->gasp.version = GET_UShort();
face->gasp.numRanges = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
num_ranges = face->gasp.numRanges;
FT_TRACE3(( "number of ranges = %d\n", num_ranges ));
if ( ALLOC_ARRAY( gaspranges, num_ranges, TT_GaspRangeRec ) ||
- ACCESS_Frame( num_ranges * 4L ) )
+ FT_FRAME_ENTER( num_ranges * 4L ) )
goto Exit;
face->gasp.gaspRanges = gaspranges;
@@ -1551,7 +1551,7 @@
}
FT_TRACE3(( "\n" ));
- FORGET_Frame();
+ FT_FRAME_EXIT();
FT_TRACE2(( "GASP loaded\n" ));
Exit:
@@ -1597,13 +1597,13 @@
if ( error )
return SFNT_Err_Ok;
- if ( ACCESS_Frame( 4L ) )
+ if ( FT_FRAME_ENTER( 4L ) )
goto Exit;
(void)GET_UShort(); /* version */
num_tables = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
for ( n = 0; n < num_tables; n++ )
{
@@ -1611,14 +1611,14 @@
FT_UInt length;
- if ( ACCESS_Frame( 6L ) )
+ if ( FT_FRAME_ENTER( 6L ) )
goto Exit;
(void)GET_UShort(); /* version */
length = GET_UShort() - 6; /* substract header length */
coverage = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
if ( coverage == 0x0001 )
{
@@ -1628,18 +1628,18 @@
/* found a horizontal format 0 kerning table! */
- if ( ACCESS_Frame( 8L ) )
+ if ( FT_FRAME_ENTER( 8L ) )
goto Exit;
num_pairs = GET_UShort();
/* skip the rest */
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* allocate array of kerning pairs */
if ( ALLOC_ARRAY( face->kern_pairs, num_pairs, TT_Kern0_PairRec ) ||
- ACCESS_Frame( 6L * num_pairs ) )
+ FT_FRAME_ENTER( 6L * num_pairs ) )
goto Exit;
pair = face->kern_pairs;
@@ -1651,7 +1651,7 @@
pair->value = GET_UShort();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
face->num_kern_pairs = num_pairs;
face->kern_table_index = n;
@@ -1679,7 +1679,7 @@
goto Exit;
}
- if ( FILE_Skip( length ) )
+ if ( FT_STREAM_SKIP( length ) )
goto Exit;
}
@@ -1750,14 +1750,14 @@
if ( error )
return SFNT_Err_Ok;
- if ( ACCESS_Frame( 8L ) )
+ if ( FT_FRAME_ENTER( 8L ) )
goto Exit;
hdmx->version = GET_UShort();
hdmx->num_records = GET_Short();
record_size = GET_Long();
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* Only recognize format 0 */
if ( hdmx->version != 0 )
@@ -1782,11 +1782,11 @@
goto Exit;
if ( ALLOC( cur->widths, num_glyphs ) ||
- FILE_Read( cur->widths, num_glyphs ) )
+ FT_STREAM_READ( cur->widths, num_glyphs ) )
goto Exit;
/* skip padding bytes */
- if ( record_size > 0 && FILE_Skip( record_size ) )
+ if ( record_size > 0 && FT_STREAM_SKIP( record_size ) )
goto Exit;
}
}
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 8edc08e3b..7a5a49ae4 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -186,13 +186,13 @@
if ( ALLOC_ARRAY ( glyph_indices, num_glyphs, FT_UShort ) ||
- ACCESS_Frame( num_glyphs * 2L ) )
+ FT_FRAME_ENTER( num_glyphs * 2L ) )
goto Fail;
for ( n = 0; n < num_glyphs; n++ )
glyph_indices[n] = GET_UShort();
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
/* compute number of names stored in table */
@@ -232,7 +232,7 @@
if ( READ_Byte ( len ) ||
ALLOC_ARRAY( name_strings[n], len + 1, FT_Char ) ||
- FILE_Read ( name_strings[n], len ) )
+ FT_STREAM_READ ( name_strings[n], len ) )
goto Fail1;
name_strings[n][len] = '\0';
@@ -293,7 +293,7 @@
}
if ( ALLOC ( offset_table, num_glyphs ) ||
- FILE_Read( offset_table, num_glyphs ) )
+ FT_STREAM_READ( offset_table, num_glyphs ) )
goto Fail;
/* now check the offset table */
@@ -352,7 +352,7 @@
format = face->postscript.FormatType;
/* go to beginning of subtable */
- if ( FILE_Skip( 32 ) )
+ if ( FT_STREAM_SKIP( 32 ) )
goto Exit;
/* now read postscript table */
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 161d023db..babff52c0 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -231,7 +231,7 @@
if ( READ_ULong( range->image_size ) )
return error;
- return READ_Fields( sbit_metrics_fields, &range->metrics );
+ return FT_STREAM_READ_FIELDS( sbit_metrics_fields, &range->metrics );
}
@@ -281,7 +281,7 @@
/* Allocate glyph codes table and access frame */
if ( ALLOC_ARRAY ( range->glyph_codes, count, FT_UShort ) ||
- ACCESS_Frame( size ) )
+ FT_FRAME_ENTER( size ) )
goto Exit;
for ( n = 0; n < count; n++ )
@@ -293,7 +293,7 @@
GET_UShort();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
Exit:
return error;
@@ -342,14 +342,14 @@
if ( ALLOC_ARRAY( range->glyph_offsets,
num_glyphs, FT_ULong ) ||
- ACCESS_Frame( num_glyphs * size_elem ) )
+ FT_FRAME_ENTER( num_glyphs * size_elem ) )
goto Exit;
for ( n = 0; n < num_glyphs; n++ )
range->glyph_offsets[n] = (FT_ULong)( range->image_offset +
( large ? GET_ULong()
: GET_UShort() ) );
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
break;
@@ -459,14 +459,14 @@
if ( error )
goto Exit;
- table_base = FILE_Pos();
- if ( ACCESS_Frame( 8L ) )
+ table_base = FT_STREAM_POS();
+ if ( FT_FRAME_ENTER( 8L ) )
goto Exit;
version = GET_Long();
num_strikes = GET_ULong();
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* check version number and strike count */
if ( version != 0x00020000L ||
@@ -490,22 +490,22 @@
FT_ULong count = num_strikes;
- if ( ACCESS_Frame( 48L * num_strikes ) )
+ if ( FT_FRAME_ENTER( 48L * num_strikes ) )
goto Exit;
while ( count > 0 )
{
- if ( READ_Fields( strike_start_fields, strike ) ||
- READ_Fields( sbit_line_metrics_fields, &strike->hori ) ||
- READ_Fields( sbit_line_metrics_fields, &strike->vert ) ||
- READ_Fields( strike_end_fields, strike ) )
+ if ( FT_STREAM_READ_FIELDS( strike_start_fields, strike ) ||
+ FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->hori ) ||
+ FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->vert ) ||
+ FT_STREAM_READ_FIELDS( strike_end_fields, strike ) )
break;
count--;
strike++;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
/* allocate the index ranges for each strike table */
@@ -526,8 +526,8 @@
goto Exit;
/* read each range */
- if ( FILE_Seek( table_base + strike->ranges_offset ) ||
- ACCESS_Frame( strike->num_ranges * 8L ) )
+ if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) ||
+ FT_FRAME_ENTER( strike->num_ranges * 8L ) )
goto Exit;
range = strike->sbit_ranges;
@@ -541,7 +541,7 @@
range++;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* Now, read each index table */
count2 = strike->num_ranges;
@@ -549,15 +549,15 @@
while ( count2 > 0 )
{
/* Read the header */
- if ( FILE_Seek( range->table_offset ) ||
- ACCESS_Frame( 8L ) )
+ if ( FT_STREAM_SEEK( range->table_offset ) ||
+ FT_FRAME_ENTER( 8L ) )
goto Exit;
range->index_format = GET_UShort();
range->image_format = GET_UShort();
range->image_offset = GET_ULong();
- FORGET_Frame();
+ FT_FRAME_EXIT();
error = Load_SBit_Range( range, stream );
if ( error )
@@ -879,7 +879,7 @@
/* read small metrics */
- if ( READ_Fields( sbit_small_metrics_fields, &smetrics ) )
+ if ( FT_STREAM_READ_FIELDS( sbit_small_metrics_fields, &smetrics ) )
goto Exit;
/* convert it to a big metrics */
@@ -901,7 +901,7 @@
case 7:
case 9:
/* variable big metrics */
- if ( READ_Fields( sbit_metrics_fields, metrics ) )
+ if ( FT_STREAM_READ_FIELDS( sbit_metrics_fields, metrics ) )
goto Exit;
break;
@@ -1186,7 +1186,7 @@
}
/* Now read data and draw glyph into target pixmap */
- if ( ACCESS_Frame( glyph_size ) )
+ if ( FT_FRAME_ENTER( glyph_size ) )
goto Exit;
/* don't forget to multiply `x_offset' by `map->pix_bits' as */
@@ -1195,7 +1195,7 @@
blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes,
x_offset * pix_bits, y_offset );
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
Exit:
@@ -1219,7 +1219,7 @@
/* place stream at beginning of glyph data and read metrics */
- if ( FILE_Seek( ebdt_pos + glyph_offset ) )
+ if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) )
goto Exit;
error = Load_SBit_Metrics( stream, range, metrics );
@@ -1309,7 +1309,7 @@
count = num_components;
- if ( ACCESS_Frame( 4L * num_components ) )
+ if ( FT_FRAME_ENTER( 4L * num_components ) )
goto Fail_Memory;
for ( comp = components; count > 0; count--, comp++ )
@@ -1319,7 +1319,7 @@
comp->y_offset = GET_Char();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* Now recursively load each element glyph */
count = num_components;
@@ -1426,7 +1426,7 @@
if (error)
goto Exit;
- ebdt_pos = FILE_Pos();
+ ebdt_pos = FT_STREAM_POS();
/* clear the bitmap & load the bitmap */
if ( face->root.glyph->flags & FT_GLYPH_OWN_BITMAP )
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index aa03b706d..9855b1148 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -217,7 +217,7 @@
FT_TRACE5(( "Glyph %ld\n", glyph_index ));
/* the following line sets the `error' variable through macros! */
- if ( FILE_Seek( offset ) || ACCESS_Frame( byte_count ) )
+ if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )
return error;
return TT_Err_Ok;
@@ -230,7 +230,7 @@
FT_Stream stream = loader->stream;
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
@@ -561,11 +561,11 @@
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
- /* we must undo the ACCESS_Frame in order to point to the */
+ /* we must undo the FT_FRAME_ENTER in order to point to the */
/* composite instructions, if we find some. */
/* we will process them later... */
/* */
- loader->ins_pos = (FT_ULong)( FILE_Pos() +
+ loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
stream->cursor - stream->limit );
}
#endif
@@ -1108,7 +1108,7 @@
/* read size of instructions */
- if ( FILE_Seek( ins_pos ) ||
+ if ( FT_STREAM_SEEK( ins_pos ) ||
READ_UShort( n_ins ) )
goto Fail;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
@@ -1127,7 +1127,7 @@
}
/* read the instructions */
- if ( FILE_Read( exec->glyphIns, n_ins ) )
+ if ( FT_STREAM_READ( exec->glyphIns, n_ins ) )
goto Fail;
glyph->control_data = exec->glyphIns;
@@ -1564,7 +1564,7 @@
loader.glyph = (FT_GlyphSlot)glyph;
loader.stream = stream;
- loader.glyf_offset = FILE_Pos();
+ loader.glyf_offset = FT_STREAM_POS();
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 59ebe2c3f..ac04ca283 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -171,7 +171,7 @@
goto Bad_Format;
/* create input stream from resource */
- if ( FILE_Seek( 0 ) )
+ if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
/* check that we have a valid TrueType file */
@@ -249,8 +249,8 @@
face->cvt_size = 0;
/* freeing the programs */
- RELEASE_Frame( face->font_program );
- RELEASE_Frame( face->cvt_program );
+ FT_FRAME_RELEASE( face->font_program );
+ FT_FRAME_RELEASE( face->cvt_program );
face->font_program_size = 0;
face->cvt_program_size = 0;
}
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index c57b098cf..180735bdf 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -85,7 +85,7 @@
FT_Long ) )
goto Exit;
- if ( ACCESS_Frame( face->num_locations * 4L ) )
+ if ( FT_FRAME_ENTER( face->num_locations * 4L ) )
goto Exit;
{
@@ -97,7 +97,7 @@
*loc = GET_Long();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
else
{
@@ -110,7 +110,7 @@
FT_Long ) )
goto Exit;
- if ( ACCESS_Frame( face->num_locations * 2L ) )
+ if ( FT_FRAME_ENTER( face->num_locations * 2L ) )
goto Exit;
{
FT_Long* loc = face->glyph_locations;
@@ -120,7 +120,7 @@
for ( ; loc < limit; loc++ )
*loc = (FT_Long)( (FT_ULong)GET_UShort() * 2 );
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
}
FT_TRACE2(( "loaded\n" ));
@@ -177,7 +177,7 @@
FT_Short ) )
goto Exit;
- if ( ACCESS_Frame( face->cvt_size * 2L ) )
+ if ( FT_FRAME_ENTER( face->cvt_size * 2L ) )
goto Exit;
{
@@ -189,7 +189,7 @@
*cur = GET_Short();
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
FT_TRACE2(( "loaded\n" ));
Exit:
@@ -236,7 +236,7 @@
else
{
face->font_program_size = table_len;
- if ( EXTRACT_Frame( table_len, face->font_program ) )
+ if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )
goto Exit;
FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size ));
@@ -256,7 +256,7 @@
else
{
face->cvt_program_size = table_len;
- if ( EXTRACT_Frame( table_len, face->cvt_program ) )
+ if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )
goto Exit;
FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index 2c4dc1824..897d20c7d 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -171,7 +171,7 @@
T1_AFM* afm = 0;
- if ( ACCESS_Frame( stream->size ) )
+ if ( FT_FRAME_ENTER( stream->size ) )
return error;
start = (FT_Byte*)stream->cursor;
@@ -237,7 +237,7 @@
if ( error )
FREE( afm );
- FORGET_Frame();
+ FT_FRAME_EXIT();
return error;
}
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index fe6ee4fb2..93693f0a7 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -106,7 +106,7 @@
*tag = 0;
*size = 0;
- if ( !READ_Fields( pfb_tag_fields, &head ) )
+ if ( !FT_STREAM_READ_FIELDS( pfb_tag_fields, &head ) )
{
if ( head.tag == 0x8001 || head.tag == 0x8002 )
{
@@ -158,7 +158,7 @@
/* try to compute the size of the base dictionary; */
/* look for a Postscript binary file tag, i.e 0x8001 */
- if ( FILE_Seek( 0L ) )
+ if ( FT_STREAM_SEEK( 0L ) )
goto Exit;
error = read_pfb_tag( stream, &tag, &size );
@@ -169,7 +169,7 @@
{
/* assume that this is a PFA file for now; an error will */
/* be produced later when more things are checked */
- if ( FILE_Seek( 0L ) )
+ if ( FT_STREAM_SEEK( 0L ) )
goto Exit;
size = stream->size;
}
@@ -187,14 +187,14 @@
parser->in_memory = 1;
/* check that the `size' field is valid */
- if ( FILE_Skip( size ) )
+ if ( FT_STREAM_SKIP( size ) )
goto Exit;
}
else
{
/* read segment in memory */
if ( ALLOC( parser->base_dict, size ) ||
- FILE_Read( parser->base_dict, size ) )
+ FT_STREAM_READ( parser->base_dict, size ) )
goto Exit;
parser->base_len = size;
}
@@ -283,7 +283,7 @@
/* made of several segments. We thus first read the number of */
/* segments to compute the total size of the private dictionary */
/* then re-read them into memory. */
- FT_Long start_pos = FILE_Pos();
+ FT_Long start_pos = FT_STREAM_POS();
FT_UShort tag;
@@ -299,7 +299,7 @@
parser->private_len += size;
- if ( FILE_Skip( size ) )
+ if ( FT_STREAM_SKIP( size ) )
goto Fail;
}
@@ -313,7 +313,7 @@
goto Fail;
}
- if ( FILE_Seek( start_pos ) ||
+ if ( FT_STREAM_SEEK( start_pos ) ||
ALLOC( parser->private_dict, parser->private_len ) )
goto Fail;
@@ -327,7 +327,7 @@
break;
}
- if ( FILE_Read( parser->private_dict + parser->private_len, size ) )
+ if ( FT_STREAM_READ( parser->private_dict + parser->private_len, size ) )
goto Fail;
parser->private_len += size;
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 299930b17..b84e1709e 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -116,7 +116,7 @@
FT_Stream stream )
{
if ( font->fnt_frame )
- RELEASE_Frame( font->fnt_frame );
+ FT_FRAME_RELEASE( font->fnt_frame );
font->fnt_size = 0;
font->fnt_frame = 0;
@@ -132,8 +132,8 @@
/* first of all, read the FNT header */
- if ( FILE_Seek( font->offset ) ||
- READ_Fields( winfnt_header_fields, header ) )
+ if ( FT_STREAM_SEEK( font->offset ) ||
+ FT_STREAM_READ_FIELDS( winfnt_header_fields, header ) )
goto Exit;
/* check header */
@@ -157,8 +157,8 @@
header->pixel_width = header->pixel_height;
/* this is a FNT file/table, we now extract its frame */
- if ( FILE_Seek( font->offset ) ||
- EXTRACT_Frame( header->file_size, font->fnt_frame ) )
+ if ( FT_STREAM_SEEK( font->offset ) ||
+ FT_FRAME_EXTRACT( header->file_size, font->fnt_frame ) )
goto Exit;
Exit:
@@ -196,8 +196,8 @@
face->num_fonts = 0;
/* does it begin with a MZ header? */
- if ( FILE_Seek( 0 ) ||
- READ_Fields( winmz_header_fields, &mz_header ) )
+ if ( FT_STREAM_SEEK( 0 ) ||
+ FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) )
goto Exit;
error = FNT_Err_Unknown_File_Format;
@@ -207,8 +207,8 @@
WinNE_HeaderRec ne_header;
- if ( FILE_Seek( mz_header.lfanew ) ||
- READ_Fields( winne_header_fields, &ne_header ) )
+ if ( FT_STREAM_SEEK( mz_header.lfanew ) ||
+ FT_STREAM_READ_FIELDS( winne_header_fields, &ne_header ) )
goto Exit;
error = FNT_Err_Unknown_File_Format;
@@ -223,8 +223,8 @@
FT_ULong font_offset = 0;
- if ( FILE_Seek( res_offset ) ||
- ACCESS_Frame( ne_header.rname_tab_offset -
+ if ( FT_STREAM_SEEK( res_offset ) ||
+ FT_FRAME_ENTER( ne_header.rname_tab_offset -
ne_header.resource_tab_offset ) )
goto Exit;
@@ -244,14 +244,14 @@
if ( type_id == 0x8008 )
{
font_count = count;
- font_offset = (FT_ULong)( FILE_Pos() + 4 +
+ font_offset = (FT_ULong)( FT_STREAM_POS() + 4 +
( stream->cursor - stream->limit ) );
break;
}
stream->cursor += 4 + count * 12;
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
if ( !font_count || !font_offset )
{
@@ -260,13 +260,13 @@
goto Exit;
}
- if ( FILE_Seek( font_offset ) ||
+ if ( FT_STREAM_SEEK( font_offset ) ||
ALLOC_ARRAY( face->fonts, font_count, FNT_FontRec ) )
goto Exit;
face->num_fonts = font_count;
- if ( ACCESS_Frame( (FT_Long)font_count * 12 ) )
+ if ( FT_FRAME_ENTER( (FT_Long)font_count * 12 ) )
goto Exit;
/* now read the offset and position of each FNT font */
@@ -283,7 +283,7 @@
stream->cursor += 8;
}
}
- FORGET_Frame();
+ FT_FRAME_EXIT();
/* finally, try to load each font there */
{