[gf] Formatting fixes.
This commit is contained in:
parent
52fc5d1819
commit
38f652dbd6
|
@ -28,7 +28,6 @@
|
|||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
#define FONT_DRIVER_GF 1
|
||||
|
||||
#define GF_PRE 247
|
||||
#define GF_ID 131
|
||||
|
@ -61,6 +60,7 @@ FT_BEGIN_HEADER
|
|||
|
||||
#define toint(x) (int)(((x)>0)?(x+0.5):(x-0.5))
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
|
|
127
src/gf/gfdrivr.c
127
src/gf/gfdrivr.c
|
@ -53,8 +53,8 @@
|
|||
gf_cmap_init( FT_CMap gfcmap,
|
||||
FT_Pointer init_data )
|
||||
{
|
||||
GF_CMap cmap = (GF_CMap)gfcmap;
|
||||
GF_Face face = (GF_Face)FT_CMAP_FACE( cmap );
|
||||
GF_CMap cmap = (GF_CMap) gfcmap;
|
||||
GF_Face face = (GF_Face) FT_CMAP_FACE( cmap );
|
||||
FT_UNUSED( init_data );
|
||||
|
||||
cmap->num_encodings = face->gf_glyph->nencodings;
|
||||
|
@ -67,7 +67,7 @@
|
|||
FT_CALLBACK_DEF( void )
|
||||
gf_cmap_done( FT_CMap gfcmap )
|
||||
{
|
||||
GF_CMap cmap = (GF_CMap)gfcmap;
|
||||
GF_CMap cmap = (GF_CMap) gfcmap;
|
||||
|
||||
cmap->encodings = NULL;
|
||||
cmap->num_encodings = 0;
|
||||
|
@ -79,30 +79,31 @@
|
|||
gf_cmap_char_index( FT_CMap gfcmap,
|
||||
FT_UInt32 charcode )
|
||||
{
|
||||
GF_CMap cmap = (GF_CMap)gfcmap;
|
||||
GF_CMap cmap = (GF_CMap) gfcmap;
|
||||
GF_Encoding encodings = cmap->encodings;
|
||||
FT_UInt max, code, result = 0, i;
|
||||
FT_UInt max, code, result = 0, i;
|
||||
|
||||
max = cmap->num_encodings;
|
||||
|
||||
for( i = 0; i < max; i++ )
|
||||
{
|
||||
code = (FT_ULong)encodings[i].enc;
|
||||
code = (FT_ULong) encodings[i].enc;
|
||||
if ( charcode == code )
|
||||
{
|
||||
result = encodings[i].glyph;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
return result;
|
||||
Exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_UInt )
|
||||
gf_cmap_char_next( FT_CMap gfcmap,
|
||||
FT_UInt32 *acharcode )
|
||||
{
|
||||
GF_CMap cmap = (GF_CMap)gfcmap;
|
||||
GF_CMap cmap = (GF_CMap) gfcmap;
|
||||
GF_Encoding encodings = cmap->encodings;
|
||||
FT_UInt result = 0, i, code, max;
|
||||
FT_ULong charcode = *acharcode + 1;
|
||||
|
@ -111,7 +112,7 @@
|
|||
|
||||
for( i = 0; i < max; i++ )
|
||||
{
|
||||
code = (FT_ULong)encodings[i].enc;
|
||||
code = (FT_ULong) encodings[i].enc;
|
||||
if ( charcode == code )
|
||||
{
|
||||
result = encodings[i].glyph + 1;
|
||||
|
@ -127,7 +128,7 @@
|
|||
/* XXX: result should be changed to indicate an overflow error */
|
||||
}
|
||||
else
|
||||
*acharcode = (FT_UInt32)charcode;
|
||||
*acharcode = (FT_UInt32) charcode;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -146,12 +147,11 @@
|
|||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
GF_Face_Done( FT_Face gfface ) /* GF_Face */
|
||||
GF_Face_Done( FT_Face gfface ) /* GF_Face */
|
||||
{
|
||||
GF_Face face = (GF_Face)gfface;
|
||||
GF_Face face = (GF_Face) gfface;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !face )
|
||||
return;
|
||||
|
||||
|
@ -168,16 +168,16 @@
|
|||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
GF_Face_Init( FT_Stream stream,
|
||||
FT_Face gfface, /* GF_Face */
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
GF_Face_Init( FT_Stream stream,
|
||||
FT_Face gfface, /* GF_Face */
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
GF_Face face = (GF_Face)gfface;
|
||||
GF_Face face = (GF_Face) gfface;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
GF_Glyph go=NULL;
|
||||
GF_Glyph go = NULL;
|
||||
|
||||
TFM_Service tfm;
|
||||
|
||||
|
@ -185,9 +185,9 @@
|
|||
FT_UNUSED( params );
|
||||
|
||||
|
||||
face->tfm = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
|
||||
"tfm" );
|
||||
tfm = (TFM_Service)face->tfm;
|
||||
face->tfm = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "tfm" );
|
||||
|
||||
tfm = (TFM_Service) face->tfm;
|
||||
if ( !tfm )
|
||||
{
|
||||
FT_ERROR(( "GF_Face_Init: cannot access `tfm' module\n" ));
|
||||
|
@ -244,9 +244,9 @@
|
|||
*/
|
||||
|
||||
gfface->family_name = NULL;
|
||||
gfface->num_glyphs = (FT_Long)go->nglyphs;
|
||||
gfface->num_glyphs = (FT_Long) go->nglyphs;
|
||||
|
||||
FT_TRACE4(( " number of glyphs: allocated %d\n",gfface->num_glyphs ));
|
||||
FT_TRACE4(( " number of glyphs: allocated %d\n", gfface->num_glyphs ));
|
||||
|
||||
if ( gfface->num_glyphs <= 0 )
|
||||
{
|
||||
|
@ -266,16 +266,15 @@
|
|||
bsize->height = (FT_Short) face->gf_glyph->font_bbx_h ;
|
||||
bsize->width = (FT_Short) face->gf_glyph->font_bbx_w ;
|
||||
bsize->size = (FT_Pos) FT_MulDiv( FT_ABS( face->gf_glyph->ds ),
|
||||
64 * 7200,
|
||||
72270L );
|
||||
|
||||
64 * 7200,
|
||||
72270L );
|
||||
x_res = toint( go->hppp * 72.27 );
|
||||
y_res = toint( go->vppp * 72.27 );
|
||||
|
||||
bsize->y_ppem = (FT_Pos) toint((face->gf_glyph->ds * y_res)/ 72.27) << 6 ;
|
||||
bsize->x_ppem = (FT_Pos)FT_MulDiv( bsize->y_ppem,
|
||||
x_res,
|
||||
y_res ); ;
|
||||
bsize->x_ppem = (FT_Pos) FT_MulDiv( bsize->y_ppem,
|
||||
x_res,
|
||||
y_res );
|
||||
}
|
||||
|
||||
/* set up charmap */
|
||||
|
@ -298,7 +297,6 @@
|
|||
|
||||
charmap.face = FT_FACE( face );
|
||||
charmap.encoding = FT_ENCODING_NONE;
|
||||
/* initial platform/encoding should indicate unset status? */
|
||||
charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
|
||||
charmap.encoding_id = TT_APPLE_ID_DEFAULT;
|
||||
|
||||
|
@ -331,6 +329,7 @@
|
|||
return FT_THROW( Unknown_File_Format );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
GF_Size_Select( FT_Size size,
|
||||
FT_ULong strike_index )
|
||||
|
@ -341,7 +340,7 @@
|
|||
|
||||
FT_Select_Metrics( size->face, 0 );
|
||||
|
||||
size->metrics.ascender = (go->font_bbx_h - go->font_bbx_yoff) * 64;
|
||||
size->metrics.ascender = ( go->font_bbx_h - go->font_bbx_yoff ) * 64;
|
||||
size->metrics.descender = -go->font_bbx_yoff * 64;
|
||||
size->metrics.max_advance = go->font_bbx_w * 64;
|
||||
|
||||
|
@ -349,11 +348,12 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
GF_Size_Request( FT_Size size,
|
||||
FT_Size_Request req )
|
||||
{
|
||||
GF_Face face = (GF_Face)size->face;
|
||||
GF_Face face = (GF_Face) size->face;
|
||||
FT_Bitmap_Size* bsize = size->face->available_sizes;
|
||||
FT_Error error = FT_ERR( Invalid_Pixel_Size );
|
||||
FT_Long height;
|
||||
|
@ -386,15 +386,14 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
GF_Glyph_Load( FT_GlyphSlot slot,
|
||||
FT_Size size,
|
||||
FT_UInt glyph_index,
|
||||
FT_Int32 load_flags )
|
||||
{
|
||||
GF_Face gf = (GF_Face)FT_SIZE_FACE( size );
|
||||
FT_Face face = FT_FACE( gf );
|
||||
GF_Face gf = (GF_Face) FT_SIZE_FACE( size );
|
||||
FT_Face face = FT_FACE ( gf );
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Bitmap* bitmap = &slot->bitmap;
|
||||
GF_Bitmap bm;
|
||||
|
@ -417,10 +416,8 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
FT_TRACE1(( "GF_Glyph_Load: glyph index %d charcode is %d\n", glyph_index, go->bm_table[glyph_index].code ));
|
||||
|
||||
if ( (FT_Int)glyph_index < 0 )
|
||||
glyph_index = 0;
|
||||
FT_TRACE1(( "GF_Glyph_Load: glyph index %d charcode is %d\n",
|
||||
glyph_index, go->bm_table[glyph_index].code ));
|
||||
|
||||
if ( !go->bm_table )
|
||||
{
|
||||
|
@ -443,7 +440,7 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
bitmap->pitch = (int)bm->raster ;
|
||||
bitmap->pitch = (FT_Int) bm->raster ;
|
||||
|
||||
/* note: we don't allocate a new array to hold the bitmap; */
|
||||
/* we can simply point to it */
|
||||
|
@ -464,9 +461,9 @@
|
|||
" bm->off_x is %ld\n"
|
||||
" bm->off_y is %ld\n"
|
||||
" bm->mv_x is %ld\n"
|
||||
" bm->mv_y is %ld\n", bm->bbx_height, bm->bbx_width,
|
||||
bm->off_x, bm->off_y, bm->mv_x,
|
||||
bm->mv_y ));
|
||||
" bm->mv_y is %ld\n",
|
||||
bm->bbx_height, bm->bbx_width, bm->off_x, bm->off_y,
|
||||
bm->mv_x, bm->mv_y ));
|
||||
|
||||
ft_synthesize_vertical_metrics( &slot->metrics, bm->bbx_height * 64 );
|
||||
|
||||
|
@ -474,16 +471,18 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( void )
|
||||
TFM_Done_Metrics( FT_Memory memory,
|
||||
TFM_FontInfo fi )
|
||||
{
|
||||
FT_FREE(fi->width);
|
||||
FT_FREE(fi->height);
|
||||
FT_FREE(fi->depth);
|
||||
FT_FREE( fi->width );
|
||||
FT_FREE( fi->height );
|
||||
FT_FREE( fi->depth );
|
||||
FT_FREE( fi );
|
||||
}
|
||||
|
||||
|
||||
/* parse a TFM metrics file */
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
TFM_Read_Metrics( FT_Face gf_face,
|
||||
|
@ -494,14 +493,14 @@
|
|||
TFM_ParserRec parser;
|
||||
TFM_FontInfo fi = NULL;
|
||||
FT_Error error = FT_ERR( Unknown_File_Format );
|
||||
GF_Face face = (GF_Face)gf_face;
|
||||
GF_Face face = (GF_Face) gf_face;
|
||||
GF_Glyph gf_glyph= face->gf_glyph;
|
||||
|
||||
|
||||
if ( face->tfm_data )
|
||||
{
|
||||
FT_TRACE1(( "TFM_Read_Metrics:"
|
||||
" Freeing previously attached metrics data.\n" ));
|
||||
"Freeing previously attached metrics data.\n" ));
|
||||
TFM_Done_Metrics( memory, (TFM_FontInfo)face->tfm_data );
|
||||
|
||||
face->tfm_data = NULL;
|
||||
|
@ -519,15 +518,16 @@
|
|||
error = tfm->tfm_parser_funcs->init( &parser,
|
||||
memory,
|
||||
stream );
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
FT_TRACE4(( "TFM_Read_Metrics: Initialised tfm metric data.\n" ));
|
||||
|
||||
parser.FontInfo = fi;
|
||||
parser.user_data = gf_glyph;
|
||||
|
||||
error = tfm->tfm_parser_funcs->parse_metrics( &parser );
|
||||
if( !error )
|
||||
|
||||
if( !error )
|
||||
FT_TRACE4(( "TFM_Read_Metrics: parsing TFM metric information done.\n" ));
|
||||
|
||||
FT_TRACE6(( "TFM_Read_Metrics: TFM Metric Information:\n"
|
||||
|
@ -537,10 +537,13 @@
|
|||
" End Char : %d\n"
|
||||
" font_bbx_w : %d\n"
|
||||
" font_bbx_h : %d\n"
|
||||
" slant : %d\n", parser.FontInfo->cs, parser.FontInfo->design_size, parser.FontInfo->begin_char,
|
||||
parser.FontInfo->end_char, parser.FontInfo->font_bbx_w,
|
||||
parser.FontInfo->font_bbx_h, parser.FontInfo->slant ));
|
||||
tfm->tfm_parser_funcs->done( &parser );
|
||||
" slant : %d\n",
|
||||
parser.FontInfo->cs, parser.FontInfo->design_size,
|
||||
parser.FontInfo->begin_char, parser.FontInfo->end_char,
|
||||
parser.FontInfo->font_bbx_w, parser.FontInfo->font_bbx_h,
|
||||
parser.FontInfo->slant ));
|
||||
|
||||
tfm->tfm_parser_funcs->done( &parser );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,6 +566,7 @@
|
|||
return error;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* SERVICES LIST
|
||||
|
@ -576,9 +580,10 @@
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Module_Interface )
|
||||
gf_driver_requester( FT_Module module,
|
||||
const char* name )
|
||||
const char* name )
|
||||
{
|
||||
FT_UNUSED( module );
|
||||
|
||||
|
@ -598,7 +603,7 @@
|
|||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
NULL, /* module-specific interface */
|
||||
NULL, /* module-specific interface */
|
||||
|
||||
NULL, /* FT_Module_Constructor module_init */
|
||||
NULL, /* FT_Module_Destructor module_done */
|
||||
|
@ -622,8 +627,8 @@
|
|||
TFM_Read_Metrics, /* FT_Face_AttachFunc attach_file */
|
||||
NULL, /* FT_Face_GetAdvancesFunc get_advances */
|
||||
|
||||
GF_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
GF_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
GF_Size_Request, /* FT_Size_RequestFunc request_size */
|
||||
GF_Size_Select /* FT_Size_SelectFunc select_size */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -30,47 +30,48 @@ FT_BEGIN_HEADER
|
|||
|
||||
typedef struct GF_EncodingRec_
|
||||
{
|
||||
FT_Long enc;
|
||||
FT_UShort glyph;
|
||||
FT_Long enc;
|
||||
FT_UShort glyph;
|
||||
|
||||
} GF_EncodingRec, *GF_Encoding;
|
||||
|
||||
|
||||
/* BitmapRec for GF format specific glyphs */
|
||||
typedef struct GF_BitmapRec_
|
||||
{
|
||||
FT_Long bbx_width, bbx_height;
|
||||
FT_Long off_x, off_y;
|
||||
FT_Long mv_x, mv_y;
|
||||
FT_Byte *bitmap;
|
||||
FT_UInt raster;
|
||||
FT_UShort code;
|
||||
FT_Long bbx_width, bbx_height;
|
||||
FT_Long off_x, off_y;
|
||||
FT_Long mv_x, mv_y;
|
||||
FT_Byte *bitmap;
|
||||
FT_UInt raster;
|
||||
FT_UShort code;
|
||||
|
||||
} GF_BitmapRec, *GF_Bitmap;
|
||||
|
||||
|
||||
typedef struct GF_GlyphRec_
|
||||
{
|
||||
FT_UInt code_min, code_max;
|
||||
GF_Bitmap bm_table;
|
||||
FT_Int ds, hppp, vppp;
|
||||
FT_Int font_bbx_w, font_bbx_h;
|
||||
FT_Int font_bbx_xoff, font_bbx_yoff;
|
||||
FT_UInt code_min, code_max;
|
||||
GF_Bitmap bm_table;
|
||||
FT_Int ds, hppp, vppp;
|
||||
FT_Int font_bbx_w, font_bbx_h;
|
||||
FT_Int font_bbx_xoff, font_bbx_yoff;
|
||||
|
||||
FT_ULong nencodings;
|
||||
GF_Encoding encodings;
|
||||
FT_ULong nencodings;
|
||||
GF_Encoding encodings;
|
||||
|
||||
FT_ULong nglyphs;
|
||||
FT_ULong nglyphs;
|
||||
|
||||
} GF_GlyphRec, *GF_Glyph;
|
||||
|
||||
|
||||
typedef struct GF_FaceRec_
|
||||
{
|
||||
FT_FaceRec root;
|
||||
GF_Glyph gf_glyph;
|
||||
FT_FaceRec root;
|
||||
GF_Glyph gf_glyph;
|
||||
|
||||
const void* tfm;
|
||||
const void* tfm_data;
|
||||
const void* tfm;
|
||||
const void* tfm_data;
|
||||
|
||||
} GF_FaceRec, *GF_Face;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* gferror.h
|
||||
*
|
||||
* FreeType font driver for TeX's GF FONT files
|
||||
* FreeType font driver for METAFONT GF FONT files
|
||||
*
|
||||
* Copyright 1996-2018 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
|
433
src/gf/gflib.c
433
src/gf/gflib.c
|
@ -21,6 +21,7 @@
|
|||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#include FT_SYSTEM_H
|
||||
#include FT_CONFIG_CONFIG_H
|
||||
#include FT_ERRORS_H
|
||||
|
@ -57,22 +58,24 @@ FT_Byte bit_table[] = {
|
|||
*
|
||||
*/
|
||||
|
||||
FT_Long gf_read_intn(FT_Stream, FT_Int);
|
||||
FT_ULong gf_read_uintn(FT_Stream, FT_Int);
|
||||
FT_Long gf_read_intn ( FT_Stream, FT_Int );
|
||||
FT_ULong gf_read_uintn( FT_Stream, FT_Int );
|
||||
|
||||
#define READ_UINT1( stream ) (FT_Byte)gf_read_uintn( stream, 1)
|
||||
#define READ_UINT2( stream ) (FT_Byte)gf_read_uintn( stream, 2)
|
||||
#define READ_UINT3( stream ) (FT_Byte)gf_read_uintn( stream, 3)
|
||||
#define READ_UINT4( stream ) (FT_Byte)gf_read_uintn( stream, 4)
|
||||
#define READ_UINTN( stream,n) (FT_ULong)gf_read_uintn( stream, n)
|
||||
#define READ_INT1( stream ) (FT_String)gf_read_intn( stream, 1)
|
||||
#define READ_INT4( stream ) (FT_Long)gf_read_intn( stream, 4)
|
||||
#define READ_UINT1( stream ) (FT_Byte)gf_read_uintn( stream, 1 )
|
||||
#define READ_UINT2( stream ) (FT_Byte)gf_read_uintn( stream, 2 )
|
||||
#define READ_UINT3( stream ) (FT_Byte)gf_read_uintn( stream, 3 )
|
||||
#define READ_UINT4( stream ) (FT_Byte)gf_read_uintn( stream, 4 )
|
||||
#define READ_UINTN( stream, n ) (FT_ULong)gf_read_uintn( stream, n )
|
||||
#define READ_INT1( stream ) (FT_String)gf_read_intn( stream, 1 )
|
||||
#define READ_INT4( stream ) (FT_Long)gf_read_intn( stream, 4 )
|
||||
|
||||
/*
|
||||
* Reading a Number from file
|
||||
*/
|
||||
|
||||
FT_ULong
|
||||
gf_read_uintn(FT_Stream stream, FT_Int size)
|
||||
gf_read_uintn( FT_Stream stream,
|
||||
FT_Int size )
|
||||
{
|
||||
FT_ULong v,k;
|
||||
FT_Error error;
|
||||
|
@ -80,19 +83,21 @@ FT_Byte bit_table[] = {
|
|||
|
||||
v = 0L;
|
||||
|
||||
while (size >= 1)
|
||||
while ( size >= 1 )
|
||||
{
|
||||
if ( FT_READ_BYTE(tp) )
|
||||
return 0;
|
||||
k = (FT_ULong)tp;
|
||||
k = (FT_ULong) tp;
|
||||
v = v*256L + k;
|
||||
--size;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
FT_Long
|
||||
gf_read_intn(FT_Stream stream, FT_Int size)
|
||||
gf_read_intn( FT_Stream stream,
|
||||
FT_Int size )
|
||||
{
|
||||
FT_Long v;
|
||||
FT_Byte tp;
|
||||
|
@ -100,25 +105,26 @@ FT_Byte bit_table[] = {
|
|||
FT_ULong z;
|
||||
|
||||
if ( FT_READ_BYTE(tp) )
|
||||
return 0;
|
||||
z = (FT_ULong)tp;
|
||||
v = (FT_Long)z & 0xffL;
|
||||
return 0;
|
||||
z = (FT_ULong) tp;
|
||||
v = (FT_Long) z & 0xffL;
|
||||
|
||||
if (v & 0x80L)
|
||||
if( v & 0x80L )
|
||||
v = v - 256L;
|
||||
--size;
|
||||
|
||||
while (size >= 1)
|
||||
while ( size >= 1 )
|
||||
{
|
||||
if ( FT_READ_BYTE(tp) )
|
||||
return 0;
|
||||
z = (FT_ULong)tp;
|
||||
z = (FT_ULong) tp;
|
||||
v = v*256L + z;
|
||||
--size;
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
compare( FT_Long* a,
|
||||
FT_Long* b )
|
||||
|
@ -131,12 +137,14 @@ FT_Byte bit_table[] = {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* API.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
static FT_Error
|
||||
gf_set_encodings( GF_CharOffset of,
|
||||
FT_Int ngphs,
|
||||
|
@ -151,7 +159,6 @@ FT_Byte bit_table[] = {
|
|||
FT_Long *tosort;
|
||||
|
||||
nencoding = ngphs;
|
||||
FT_TRACE2(( "gf_set_encodings: Reached here.\n" ));
|
||||
|
||||
if ( FT_NEW_ARRAY( encoding, nencoding ) )
|
||||
return error;
|
||||
|
@ -159,25 +166,22 @@ FT_Byte bit_table[] = {
|
|||
if ( FT_NEW_ARRAY( tosort, nencoding ) )
|
||||
return error;
|
||||
|
||||
|
||||
FT_TRACE2(( "gf_set_encodings: Allocated sufficient memory.\n" ));
|
||||
|
||||
for( i = 0 ; i < ngphs ; i++ )
|
||||
for ( i = 0 ; i < ngphs ; i++ )
|
||||
{
|
||||
if( of[i].char_offset >= 0 )
|
||||
if ( of[i].char_offset >= 0 )
|
||||
tosort[i] = of[i].char_offset;
|
||||
}
|
||||
|
||||
ft_qsort( (void*)tosort, ngphs, sizeof(FT_Long),
|
||||
(int(*)(const void*, const void*) )compare );
|
||||
(int(*)(const void*, const void*))compare );
|
||||
|
||||
k = 0;
|
||||
for ( i = 0; i < ngphs; i++ )
|
||||
{
|
||||
for ( j = 0; j < ngphs; j++ )
|
||||
{
|
||||
if( of[j].char_offset == tosort[i] )
|
||||
break;
|
||||
if ( of[j].char_offset == tosort[i] )
|
||||
break;
|
||||
}
|
||||
encoding[k].enc = of[j].code;
|
||||
encoding[k].glyph = k;
|
||||
|
@ -198,19 +202,19 @@ FT_Byte bit_table[] = {
|
|||
GF_Bitmap bm,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Long m, n;
|
||||
FT_Int paint_sw;
|
||||
FT_Int instr,inst;
|
||||
FT_Long min_m, max_m, min_n, max_n, del_m, del_n;
|
||||
FT_Long w, h, d;
|
||||
FT_Int m_b, k;
|
||||
FT_Byte *ptr;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Long m, n;
|
||||
FT_Int paint_sw;
|
||||
FT_Int instr,inst;
|
||||
FT_Long min_m, max_m, min_n, max_n, del_m, del_n;
|
||||
FT_Long w, h, d;
|
||||
FT_Int m_b, k;
|
||||
FT_Byte *ptr;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
inst = READ_UINT1( stream );
|
||||
switch ((FT_Int)inst)
|
||||
switch ( (FT_Int) inst )
|
||||
{
|
||||
case GF_BOC:
|
||||
if ( FT_STREAM_SKIP( 4 ) )
|
||||
|
@ -264,159 +268,160 @@ FT_Byte bit_table[] = {
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
BOC:
|
||||
if(error != FT_Err_Ok)
|
||||
return -1;
|
||||
w = max_m - min_m + 1;
|
||||
h = max_n - min_n + 1;
|
||||
if ((w < 0) || (h < 0))
|
||||
BOC:
|
||||
if ( error != FT_Err_Ok )
|
||||
return -1;
|
||||
w = max_m - min_m + 1;
|
||||
h = max_n - min_n + 1;
|
||||
if ( (w < 0) || (h < 0) )
|
||||
{
|
||||
FT_ERROR(( "gf_read_glyph: invalid w and h values\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* allocate and build bitmap */
|
||||
if ( (bm->bitmap = (FT_Byte*)malloc(h*((w+7)/8))) == NULL )
|
||||
{
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(bm->bitmap, 0, h*((w+7)/8));
|
||||
bm->raster = (FT_UInt)(w+7)/8;
|
||||
bm->bbx_width = w;
|
||||
bm->bbx_height = h;
|
||||
bm->off_x = -min_m;
|
||||
bm->off_y = max_n;
|
||||
#if 0
|
||||
bm->mv_x = -min_m;
|
||||
bm->mv_y = max_n;
|
||||
#endif
|
||||
|
||||
m = min_m;
|
||||
n = max_n;
|
||||
paint_sw = 0;
|
||||
while ( (instr = (FT_Int)READ_UINT1( stream )) != GF_EOC )
|
||||
{
|
||||
if ( instr == GF_PAINT_0 )
|
||||
{
|
||||
FT_ERROR(( "gf_read_glyph: invalid w and h values\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
paint_sw = 1 - paint_sw;
|
||||
}
|
||||
|
||||
/* allocate and build bitmap */
|
||||
if ((bm->bitmap = (FT_Byte*)malloc(h*((w+7)/8))) == NULL)
|
||||
else if ( (GF_NEW_ROW_0 <= instr) && (instr <= GF_NEW_ROW_164) )
|
||||
{
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
m = min_m + (instr - GF_NEW_ROW_0);
|
||||
n = n - 1;
|
||||
paint_sw = 1;
|
||||
}
|
||||
|
||||
memset(bm->bitmap, 0, h*((w+7)/8));
|
||||
bm->raster = (FT_UInt)(w+7)/8;
|
||||
bm->bbx_width = w;
|
||||
bm->bbx_height = h;
|
||||
bm->off_x = -min_m;
|
||||
bm->off_y = max_n;
|
||||
#if 0
|
||||
bm->mv_x = -min_m;
|
||||
bm->mv_y = max_n;
|
||||
#endif
|
||||
|
||||
m = min_m;
|
||||
n = max_n;
|
||||
paint_sw = 0;
|
||||
while ((instr = (FT_Int)READ_UINT1( stream )) != GF_EOC)
|
||||
else if ( (GF_PAINT_1 <= instr) && (instr <= GF_PAINT_63) )
|
||||
{
|
||||
if (instr == GF_PAINT_0)
|
||||
d = instr - GF_PAINT_1 + 1;
|
||||
goto Paint;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( (FT_Int)instr )
|
||||
{
|
||||
paint_sw = 1 - paint_sw;
|
||||
}
|
||||
else if ((GF_NEW_ROW_0 <= instr) && (instr <= GF_NEW_ROW_164))
|
||||
{
|
||||
m = min_m + (instr - GF_NEW_ROW_0);
|
||||
n = n - 1;
|
||||
paint_sw = 1;
|
||||
}
|
||||
else if ((GF_PAINT_1 <= instr) && (instr <= GF_PAINT_63))
|
||||
{
|
||||
d = (instr - GF_PAINT_1 + 1);
|
||||
goto Paint;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ((FT_Int)instr)
|
||||
{
|
||||
case GF_PAINT1:
|
||||
case GF_PAINT2:
|
||||
case GF_PAINT3:
|
||||
d = (FT_ULong)READ_UINTN( stream, (instr - GF_PAINT1 + 1));
|
||||
Paint:
|
||||
if (paint_sw == 0)
|
||||
case GF_PAINT1:
|
||||
case GF_PAINT2:
|
||||
case GF_PAINT3:
|
||||
d = (FT_ULong)READ_UINTN( stream, (instr - GF_PAINT1 + 1));
|
||||
Paint:
|
||||
if (paint_sw == 0)
|
||||
{
|
||||
m = m + d;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = &bm->bitmap[(max_n - n) * bm->raster + (m - min_m)/8];
|
||||
m_b = (m - min_m) % 8;
|
||||
while (d > 0)
|
||||
{
|
||||
m = m + d;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = &bm->bitmap[(max_n - n) * bm->raster + (m - min_m)/8];
|
||||
m_b = (m - min_m) % 8;
|
||||
while (d > 0)
|
||||
*ptr |= bit_table[m_b];
|
||||
m++;
|
||||
if (++m_b >= 8)
|
||||
{
|
||||
*ptr |= bit_table[m_b];
|
||||
m++;
|
||||
if (++m_b >= 8)
|
||||
{
|
||||
m_b = 0;
|
||||
++ptr;
|
||||
}
|
||||
d--;
|
||||
m_b = 0;
|
||||
++ptr;
|
||||
}
|
||||
d--;
|
||||
}
|
||||
paint_sw = 1 - paint_sw;
|
||||
break;
|
||||
case GF_SKIP0:
|
||||
m = min_m;
|
||||
n = n - 1;
|
||||
paint_sw = 0;
|
||||
break;
|
||||
case GF_SKIP1:
|
||||
case GF_SKIP2:
|
||||
case GF_SKIP3:
|
||||
m = min_m;
|
||||
n = n - (FT_ULong)READ_UINTN( stream, (instr - GF_SKIP1 + 1)) - 1;
|
||||
paint_sw = 0;
|
||||
break;
|
||||
case GF_XXX1:
|
||||
case GF_XXX2:
|
||||
case GF_XXX3:
|
||||
case GF_XXX4:
|
||||
k = READ_UINTN( stream, instr - GF_XXX1 + 1);
|
||||
if ( FT_STREAM_SKIP( k ) )
|
||||
return -1;
|
||||
break;
|
||||
case GF_YYY:
|
||||
if ( FT_STREAM_SKIP( 4 ) )
|
||||
return -1;
|
||||
break;
|
||||
case GF_NO_OP:
|
||||
break;
|
||||
default:
|
||||
FT_FREE(bm->bitmap);
|
||||
bm->bitmap = NULL;
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
}
|
||||
paint_sw = 1 - paint_sw;
|
||||
break;
|
||||
case GF_SKIP0:
|
||||
m = min_m;
|
||||
n = n - 1;
|
||||
paint_sw = 0;
|
||||
break;
|
||||
case GF_SKIP1:
|
||||
case GF_SKIP2:
|
||||
case GF_SKIP3:
|
||||
m = min_m;
|
||||
n = n - (FT_ULong)READ_UINTN( stream, (instr - GF_SKIP1 + 1)) - 1;
|
||||
paint_sw = 0;
|
||||
break;
|
||||
case GF_XXX1:
|
||||
case GF_XXX2:
|
||||
case GF_XXX3:
|
||||
case GF_XXX4:
|
||||
k = READ_UINTN( stream, instr - GF_XXX1 + 1);
|
||||
if ( FT_STREAM_SKIP( k ) )
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GF_YYY:
|
||||
if ( FT_STREAM_SKIP( 4 ) )
|
||||
return -1;
|
||||
break;
|
||||
case GF_NO_OP:
|
||||
break;
|
||||
default:
|
||||
FT_FREE( bm->bitmap );
|
||||
bm->bitmap = NULL;
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF( FT_Error )
|
||||
gf_load_font( FT_Stream stream,
|
||||
FT_Memory extmemory,
|
||||
GF_Glyph *goptr )
|
||||
{
|
||||
GF_Glyph go;
|
||||
GF_Bitmap bm;
|
||||
GF_CharOffset of;
|
||||
FT_Byte instr, d, pre, id, k, code;
|
||||
FT_Long ds, check_sum, hppp, vppp;
|
||||
FT_Long min_m, max_m, min_n, max_n, w;
|
||||
FT_UInt dx, dy;
|
||||
FT_Long ptr_post, ptr_p, ptr, optr, rptr;
|
||||
FT_Int bc, ec, nchars, i, ngphs, idx;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = extmemory; /* needed for FT_NEW */
|
||||
GF_Glyph go;
|
||||
GF_Bitmap bm;
|
||||
GF_CharOffset of;
|
||||
FT_Byte instr, d, pre, id, k, code;
|
||||
FT_Long ds, check_sum, hppp, vppp;
|
||||
FT_Long min_m, max_m, min_n, max_n, w;
|
||||
FT_UInt dx, dy;
|
||||
FT_Long ptr_post, ptr_p, ptr, optr, rptr;
|
||||
FT_Int bc, ec, nchars, i, ngphs, idx;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = extmemory; /* needed for FT_NEW */
|
||||
|
||||
go = NULL;
|
||||
nchars = -1;
|
||||
idx = 0;
|
||||
|
||||
if( FT_STREAM_SEEK( 0 ) )
|
||||
goto Exit;
|
||||
|
||||
pre = READ_UINT1( stream );
|
||||
if (pre != GF_PRE)
|
||||
if ( pre != GF_PRE )
|
||||
{
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
id = READ_UINT1( stream );
|
||||
if (id != GF_ID)
|
||||
if ( id != GF_ID )
|
||||
{
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
goto Exit;
|
||||
|
@ -429,6 +434,7 @@ FT_Byte bit_table[] = {
|
|||
/* seek to post_post instr. */
|
||||
if( FT_STREAM_SEEK( stream->size - 1 ) )
|
||||
goto Exit;
|
||||
|
||||
if( FT_STREAM_SEEK( stream->size - 1 ) )
|
||||
goto Exit;
|
||||
|
||||
|
@ -438,12 +444,11 @@ FT_Byte bit_table[] = {
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if( FT_STREAM_SEEK( stream->pos -1 ) )
|
||||
goto Exit;
|
||||
d= READ_UINT1( stream );
|
||||
|
||||
if (d != GF_ID)
|
||||
if ( d != GF_ID )
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: missing GF_ID(131) field\n" ));
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
|
@ -452,11 +457,11 @@ FT_Byte bit_table[] = {
|
|||
|
||||
FT_TRACE2(( "gf_load_font: GF_ID(131) found\n" ));
|
||||
|
||||
if(FT_STREAM_SEEK( stream->pos -6 ))
|
||||
if( FT_STREAM_SEEK( stream->pos -6 ) )
|
||||
goto Exit;
|
||||
|
||||
/* check if the code is post_post */
|
||||
if (READ_UINT1( stream ) != GF_POST_POST)
|
||||
if ( READ_UINT1( stream ) != GF_POST_POST )
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: missing GF_POST_POST(249) field\n" ));
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
|
@ -466,10 +471,10 @@ FT_Byte bit_table[] = {
|
|||
FT_TRACE2(( "gf_load_font: GF_POST_POST(249) found\n" ));
|
||||
|
||||
/* read pointer to post instr. */
|
||||
if(FT_READ_ULONG( ptr_post ))
|
||||
if( FT_READ_ULONG( ptr_post ) )
|
||||
goto Exit;
|
||||
|
||||
if (ptr_post == -1)
|
||||
if ( ptr_post == -1 )
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: invalid postamble pointer\n" ));
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
|
@ -477,27 +482,29 @@ FT_Byte bit_table[] = {
|
|||
}
|
||||
|
||||
/* goto post instr. and read it */
|
||||
if(FT_STREAM_SEEK( ptr_post ))
|
||||
if( FT_STREAM_SEEK( ptr_post ) )
|
||||
goto Exit;
|
||||
|
||||
if (READ_UINT1( stream ) != GF_POST)
|
||||
if ( READ_UINT1( stream ) != GF_POST )
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: missing GF_POST(248) field\n" ));
|
||||
error = FT_THROW( Unknown_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_TRACE2(( "gf_load_font: GF Postamble found\n" ));
|
||||
|
||||
if(FT_READ_ULONG( ptr_p ))
|
||||
if ( FT_READ_ULONG( ptr_p ) )
|
||||
goto Exit;
|
||||
if(FT_READ_ULONG( ds ))
|
||||
if ( FT_READ_ULONG( ds ) )
|
||||
goto Exit;
|
||||
if(FT_READ_ULONG( check_sum ))
|
||||
if ( FT_READ_ULONG( check_sum ) )
|
||||
goto Exit;
|
||||
if(FT_READ_ULONG( hppp ))
|
||||
if ( FT_READ_ULONG( hppp ) )
|
||||
goto Exit;
|
||||
if(FT_READ_ULONG( vppp ))
|
||||
if ( FT_READ_ULONG( vppp ) )
|
||||
goto Exit;
|
||||
|
||||
min_m = READ_INT4( stream );
|
||||
max_m = READ_INT4( stream );
|
||||
min_n = READ_INT4( stream );
|
||||
|
@ -505,17 +512,18 @@ FT_Byte bit_table[] = {
|
|||
|
||||
FT_TRACE5(( "gf_load_font: checksum is %ld\n",check_sum ));
|
||||
|
||||
if( ptr_p < 0 ) /* Defined to use ptr_p */
|
||||
if ( ptr_p < 0 ) /* Defined to use ptr_p */
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: invalid pointer in postamble\n" ));
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if( check_sum < 0 ) /* Defined to use check_sum */
|
||||
if ( check_sum < 0 ) /* Defined to use check_sum */
|
||||
{
|
||||
FT_ERROR(( "gf_load_font: invalid check sum value\n" ));
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
#if 0
|
||||
gptr = ftell(fp);
|
||||
#endif
|
||||
|
@ -527,16 +535,16 @@ FT_Byte bit_table[] = {
|
|||
for ( ; ; )
|
||||
{
|
||||
instr = READ_UINT1(fp);
|
||||
if (instr == GF_POST_POST)
|
||||
if ( instr == GF_POST_POST )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (instr == GF_CHAR_LOC)
|
||||
else if ( instr == GF_CHAR_LOC )
|
||||
{
|
||||
code = READ_UINT1(fp);
|
||||
(void)SKIP_N(fp, 16);
|
||||
}
|
||||
else if (instr == GF_CHAR_LOC0)
|
||||
else if ( instr == GF_CHAR_LOC0 )
|
||||
{
|
||||
code = READ_UINT1(fp);
|
||||
(void)SKIP_N(fp, 9);
|
||||
|
@ -546,9 +554,9 @@ FT_Byte bit_table[] = {
|
|||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Exit;
|
||||
}
|
||||
if (code < bc)
|
||||
if ( code < bc )
|
||||
bc = code;
|
||||
if (code > ec)
|
||||
if ( code > ec )
|
||||
ec = code;
|
||||
}
|
||||
#else
|
||||
|
@ -558,24 +566,24 @@ FT_Byte bit_table[] = {
|
|||
|
||||
nchars = ec - bc + 1;
|
||||
|
||||
if( FT_ALLOC(go, sizeof(GF_GlyphRec)) )
|
||||
if( FT_ALLOC( go, sizeof(GF_GlyphRec) ) )
|
||||
goto Exit;
|
||||
|
||||
FT_TRACE2(( "gf_load_font: Allocated bitmap table\n" ));
|
||||
|
||||
go->ds = (FT_UInt)ds/(1<<20);
|
||||
go->hppp = (FT_UInt)hppp/(1<<16);
|
||||
go->vppp = (FT_UInt)vppp/(1<<16);
|
||||
go->font_bbx_w = max_m - min_m;
|
||||
go->font_bbx_h = max_n - min_n;
|
||||
go->font_bbx_xoff = min_m;
|
||||
go->font_bbx_yoff = min_n;
|
||||
go->code_min = bc;
|
||||
go->code_max = ec;
|
||||
go->ds = (FT_UInt)ds/(1<<20);
|
||||
go->hppp = (FT_UInt)hppp/(1<<16);
|
||||
go->vppp = (FT_UInt)vppp/(1<<16);
|
||||
go->font_bbx_w = max_m - min_m;
|
||||
go->font_bbx_h = max_n - min_n;
|
||||
go->font_bbx_xoff = min_m;
|
||||
go->font_bbx_yoff = min_n;
|
||||
go->code_min = bc;
|
||||
go->code_max = ec;
|
||||
|
||||
go->nglyphs = 0;
|
||||
|
||||
if( FT_ALLOC_MULT(of, sizeof(GF_CharOffsetRec), nchars) )
|
||||
if( FT_ALLOC_MULT( of, sizeof(GF_CharOffsetRec), nchars ) )
|
||||
goto Exit;
|
||||
|
||||
rptr = stream->pos;
|
||||
|
@ -584,9 +592,9 @@ FT_Byte bit_table[] = {
|
|||
|
||||
for ( ; ; )
|
||||
{
|
||||
if ((instr = READ_UINT1( stream )) == GF_POST_POST)
|
||||
if ( (instr = READ_UINT1( stream )) == GF_POST_POST )
|
||||
break;
|
||||
switch ((FT_Int)instr)
|
||||
switch ( (FT_Int)instr )
|
||||
{
|
||||
case GF_CHAR_LOC:
|
||||
code = READ_UINT1( stream );
|
||||
|
@ -608,14 +616,14 @@ FT_Byte bit_table[] = {
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
of[i].char_offset = (FT_ULong)ptr;
|
||||
of[i].code = (FT_UShort)code;
|
||||
of[i].char_offset = (FT_ULong) ptr;
|
||||
of[i].code = (FT_UShort) code;
|
||||
of[i].gid = -1;
|
||||
ngphs += 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
if( FT_ALLOC_MULT(go->bm_table, sizeof(GF_BitmapRec), ngphs) )
|
||||
if( FT_ALLOC_MULT( go->bm_table, sizeof(GF_BitmapRec), ngphs ) )
|
||||
goto Exit;
|
||||
|
||||
error = gf_set_encodings( of, ngphs, go, memory );
|
||||
|
@ -627,9 +635,9 @@ FT_Byte bit_table[] = {
|
|||
|
||||
for ( ; ; )
|
||||
{
|
||||
if ((instr = READ_UINT1( stream )) == GF_POST_POST)
|
||||
if ( (instr = READ_UINT1( stream )) == GF_POST_POST )
|
||||
break;
|
||||
switch ((FT_Int)instr)
|
||||
switch ( (FT_Int) instr )
|
||||
{
|
||||
case GF_CHAR_LOC:
|
||||
code = READ_UINT1( stream );
|
||||
|
@ -652,7 +660,7 @@ FT_Byte bit_table[] = {
|
|||
}
|
||||
|
||||
optr = stream->pos;
|
||||
if( FT_STREAM_SEEK( ptr ) )
|
||||
if ( FT_STREAM_SEEK( ptr ) )
|
||||
goto Exit;
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
|
@ -663,6 +671,7 @@ FT_Byte bit_table[] = {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bm = &go->bm_table[idx];
|
||||
|
||||
bm->mv_x = dx;
|
||||
|
@ -670,29 +679,29 @@ FT_Byte bit_table[] = {
|
|||
bm->code = code;
|
||||
go->nglyphs += 1;
|
||||
|
||||
if (gf_read_glyph( stream, bm, memory ) < 0)
|
||||
if ( gf_read_glyph( stream, bm, memory ) < 0 )
|
||||
goto Exit;
|
||||
|
||||
if(FT_STREAM_SEEK( optr ))
|
||||
if ( FT_STREAM_SEEK( optr ) )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
FT_FREE(of);
|
||||
*goptr = go;
|
||||
*goptr = go;
|
||||
return error;
|
||||
|
||||
Exit:
|
||||
if (go != NULL)
|
||||
Exit:
|
||||
if ( go != NULL )
|
||||
{
|
||||
if ( go->bm_table )
|
||||
{
|
||||
if( go->bm_table )
|
||||
{
|
||||
for (i = 0; i < nchars; i++)
|
||||
FT_FREE(go->bm_table[i].bitmap);
|
||||
}
|
||||
FT_FREE(go->bm_table);
|
||||
FT_FREE(go);
|
||||
for ( i = 0; i < nchars; i++ )
|
||||
FT_FREE(go->bm_table[i].bitmap);
|
||||
}
|
||||
return error;
|
||||
FT_FREE( go->bm_table );
|
||||
FT_FREE( go );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,11 +717,11 @@ FT_Byte bit_table[] = {
|
|||
|
||||
if( go->bm_table )
|
||||
{
|
||||
for (i = 0; i < nchars; i++)
|
||||
FT_FREE(go->bm_table[i].bitmap);
|
||||
for ( i = 0; i < nchars; i++ )
|
||||
FT_FREE(go->bm_table[i].bitmap);
|
||||
}
|
||||
FT_FREE(go->bm_table);
|
||||
FT_FREE(go);
|
||||
FT_FREE( go->bm_table );
|
||||
FT_FREE( go );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue