diff --git a/docs/design/design-3.html b/docs/design/design-3.html index e1b07d304..3b57bb3fb 100644 --- a/docs/design/design-3.html +++ b/docs/design/design-3.html @@ -280,7 +280,9 @@ their relationships

- + Simple library model

Note that this picture will be updated at the end of the next diff --git a/docs/design/design-4.html b/docs/design/design-4.html index a5829bb54..6147da1e1 100644 --- a/docs/design/design-4.html +++ b/docs/design/design-4.html @@ -291,7 +291,9 @@ graph of FreeType 2's base design:

- Library Model + Complete library model
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 62d092d76..31ece537b 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -297,8 +297,8 @@ #define FT_FACE_SIZE( x ) FT_FACE( x )->size - /* this must be kept exported -- it is used by the cache manager */ - /* even though it shouldn't be considered public for now.. */ + /* this must be kept exported -- it is used by the cache manager */ + /* even though it shouldn't be considered public for now */ FT_EXPORT( FT_Error ) FT_New_Size( FT_Face face, FT_Size* size ); diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 8689ca457..f9cc0accd 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -243,7 +243,7 @@ FT_Error (*TT_Load_Any_Func)( TT_Face face, FT_ULong tag, FT_Long offset, - FT_Byte* buffer, + FT_Byte *buffer, FT_ULong* length ); @@ -268,9 +268,9 @@ /* stream :: The input stream. */ /* */ /* */ - /* map :: The target pixmap. */ + /* amap :: The target pixmap. */ /* */ - /* metrics :: A big sbit metrics structure for the glyph image. */ + /* ametrics :: A big sbit metrics structure for the glyph image. */ /* */ /* */ /* FreeType error code. 0 means success. Returns an error if no */ @@ -281,18 +281,43 @@ /* */ typedef FT_Error (*TT_Load_SBit_Image_Func)( TT_Face face, - FT_ULong strike_index, + FT_ULong strike_index, FT_UInt glyph_index, FT_UInt load_flags, FT_Stream stream, - FT_Bitmap* map, - TT_SBit_Metrics* metrics ); + FT_Bitmap *amap, + TT_SBit_Metrics *ametrics ); + + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_SBit_Strike_Func */ + /* */ + /* */ + /* Selects an sbit strike for given horizontal and vertical ppem */ + /* values. */ + /* */ + /* */ + /* face :: The target face object. */ + /* */ + /* x_ppem :: The horizontal resolution in points per EM. */ + /* */ + /* y_ppem :: The vertical resolution in points per EM. */ + /* */ + /* */ + /* astrike_index :: The index of the sbit strike. */ + /* */ + /* */ + /* FreeType error code. 0 means success. Returns an error if no */ + /* sbit strike exists for the selected ppem values. */ + /* */ typedef - FT_Error (*TT_Set_SBit_Strike_Func)( TT_Face face, - FT_Int x_ppem, - FT_Int y_ppem, - FT_ULong* astrike_index ); + FT_Error (*TT_Set_SBit_Strike_Func)( TT_Face face, + FT_Int x_ppem, + FT_Int y_ppem, + FT_ULong *astrike_index ); + /*************************************************************************/ /* */ @@ -479,9 +504,11 @@ TT_Load_Table_Func load_gasp; TT_Load_Table_Func load_pclt; + /* see `ttload.h' */ TT_Load_Table_Func load_bitmap_header; - TT_Set_SBit_Strike_Func set_sbit_strike; + /* see `ttsbit.h' */ + TT_Set_SBit_Strike_Func set_sbit_strike; TT_Load_Table_Func load_sbits; TT_Load_SBit_Image_Func load_sbit_image; TT_Free_Table_Func free_sbits; diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 68ef1b7e6..9d6bd3d48 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -700,11 +700,13 @@ /* */ /* index_ranges :: An array of glyph index ranges. */ /* */ - /* color_ref :: Unused. color_ref is put in for future */ + /* color_ref :: Unused. `color_ref' is put in for future */ /* enhancements, but these fields are already */ - /* in use by other platforms (e.g. Newton). */ + /* in use by other platforms (e.g. Newton). */ /* For details, please see */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6bloc.html */ + /* */ + /* http://fonts.apple.com/ */ + /* TTRefMan/RM06/Chap6bloc.html */ /* */ /* hori :: The line metrics for horizontal layouts. */ /* */ @@ -721,9 +723,11 @@ /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */ /* and 8. */ /* */ - /* flags :: Is this a vertical or horizontal strike? */ - /* For details, please see */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6bloc.html */ + /* flags :: Is this a vertical or horizontal strike? For */ + /* details, please see */ + /* */ + /* http://fonts.apple.com/ */ + /* TTRefMan/RM06/Chap6bloc.html */ /* */ typedef struct TT_SBit_Strike_ { diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index cbf9d5fdf..fb08ab4e0 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -357,7 +357,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, - FT_BBox* abbox ) + FT_BBox *abbox ) { FT_BBox cbox; FT_BBox bbox; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 3f98542e3..1d5e2a2cd 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -532,7 +532,7 @@ /* */ FT_EXPORT_DEF( void ) FT_Add64( FT_Int64* x, FT_Int64* y, - FT_Int64* z ) + FT_Int64 *z ) { register FT_UInt32 lo, hi; @@ -565,7 +565,7 @@ /* */ FT_EXPORT_DEF( void ) FT_MulTo64( FT_Int32 x, FT_Int32 y, - FT_Int64* z ) + FT_Int64 *z ) { FT_Int32 s; diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index d7f7384d0..9b362a76e 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -424,7 +424,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_Glyph_Copy( FT_Glyph source, - FT_Glyph* target ) + FT_Glyph *target ) { FT_Glyph copy; FT_Error error; @@ -476,7 +476,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, - FT_Glyph* aglyph ) + FT_Glyph *aglyph ) { FT_Library library = slot->library; FT_Error error; @@ -646,13 +646,13 @@ /* */ FT_EXPORT_DEF( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, - FT_BBox* cbox ) + FT_BBox *acbox ) { const FT_Glyph_Class* clazz; FT_Error error = FT_Err_Ok; - if ( !cbox || !glyph || !glyph->clazz ) + if ( !acbox || !glyph || !glyph->clazz ) error = FT_Err_Invalid_Argument; else { @@ -662,24 +662,24 @@ else { /* retrieve bbox in 26.6 coordinates */ - clazz->glyph_bbox( glyph, cbox ); + clazz->glyph_bbox( glyph, acbox ); /* perform grid fitting if needed */ if ( bbox_mode & ft_glyph_bbox_gridfit ) { - cbox->xMin &= -64; - cbox->yMin &= -64; - cbox->xMax = ( cbox->xMax + 63 ) & -64; - cbox->yMax = ( cbox->yMax + 63 ) & -64; + acbox->xMin &= -64; + acbox->yMin &= -64; + acbox->xMax = ( acbox->xMax + 63 ) & -64; + acbox->yMax = ( acbox->yMax + 63 ) & -64; } /* convert to integer pixels if needed */ if ( bbox_mode & ft_glyph_bbox_truncate ) { - cbox->xMin >>= 6; - cbox->yMin >>= 6; - cbox->xMax >>= 6; - cbox->yMax >>= 6; + acbox->xMin >>= 6; + acbox->yMin >>= 6; + acbox->xMax >>= 6; + acbox->yMax >>= 6; } } } diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 6cb9e5b2b..87c5b3db1 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -123,7 +123,7 @@ const FT_Module_Class* const ft_default_modules[] = /* */ /* FreeType error code. 0 means success. */ /* */ - FT_EXPORT_DEF( FT_Error ) FT_Init_FreeType( FT_Library* library ) + FT_EXPORT_DEF( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ) { FT_Error error; FT_Memory memory; @@ -142,9 +142,9 @@ const FT_Module_Class* const ft_default_modules[] = /* build a library out of it, then fill it with the set of */ /* default drivers. */ - error = FT_New_Library( memory, library ); + error = FT_New_Library( memory, alibrary ); if ( !error ) - FT_Add_Default_Modules( *library ); + FT_Add_Default_Modules( *alibrary ); return error; } diff --git a/src/base/ftmac.c b/src/base/ftmac.c index bf1805902..ff7eb5940 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -638,7 +638,7 @@ /* FreeType error code. 0 means success. */ /* */ /* */ - /* This function can be used to create FT_Face abjects from fonts */ + /* This function can be used to create FT_Face objects from fonts */ /* that are installed in the system like so: */ /* */ /* fond = GetResource( 'FOND', fontName ); */ @@ -647,7 +647,7 @@ FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FOND( FT_Library library, Handle fond, FT_Long face_index, - FT_Face* aface ) + FT_Face *aface ) { short sfnt_id, have_sfnt, have_lwfn = 0; Str255 lwfn_file_name; @@ -703,7 +703,7 @@ FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, FT_Long face_index, - FT_Face* aface ) + FT_Face *aface ) { FT_Open_Args args; FSSpec spec; diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 8e7478dd8..c32c9f67d 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -48,7 +48,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_Get_Multi_Master( FT_Face face, - FT_Multi_Master* master ) + FT_Multi_Master *amaster ) { FT_Error error; @@ -67,7 +67,7 @@ func = (FT_Get_MM_Func)driver->root.clazz->get_interface( FT_MODULE( driver ), "get_mm" ); if ( func ) - error = func( face, master ); + error = func( face, amaster ); } return error; diff --git a/src/base/ftnames.c b/src/base/ftnames.c index d632747bb..03caf3951 100644 --- a/src/base/ftnames.c +++ b/src/base/ftnames.c @@ -75,7 +75,7 @@ /* */ FT_EXPORT_DEF( FT_Error ) FT_Get_Sfnt_Name( FT_Face face, FT_UInt index, - FT_SfntName* aname ) + FT_SfntName *aname ) { FT_Error error = FT_Err_Invalid_Argument; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 4b97e2ed4..b4018a967 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1337,7 +1337,7 @@ FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, FT_Long face_index, - FT_Face* aface ) + FT_Face *aface ) { FT_Open_Args args; @@ -1399,7 +1399,7 @@ FT_Byte* file_base, FT_Long file_size, FT_Long face_index, - FT_Face* face ) + FT_Face *aface ) { FT_Open_Args args; @@ -1412,7 +1412,7 @@ args.memory_base = file_base; args.memory_size = file_size; - return FT_Open_Face( library, &args, face_index, face ); + return FT_Open_Face( library, &args, face_index, aface ); } @@ -1459,7 +1459,7 @@ FT_EXPORT_DEF( FT_Error ) FT_Open_Face( FT_Library library, FT_Open_Args* args, FT_Long face_index, - FT_Face* aface ) + FT_Face *aface ) { FT_Error error; FT_Driver driver; @@ -1810,7 +1810,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_New_Size( FT_Face face, - FT_Size* asize ) + FT_Size *asize ) { FT_Error error; FT_Memory memory; @@ -2178,7 +2178,7 @@ FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, - FT_Vector* kerning ) + FT_Vector *akerning ) { FT_Error error = FT_Err_Ok; FT_Driver driver; @@ -2188,32 +2188,32 @@ if ( !face ) return FT_Err_Invalid_Face_Handle; - if ( !kerning ) + if ( !akerning ) return FT_Err_Invalid_Argument; driver = face->driver; memory = driver->root.memory; - kerning->x = 0; - kerning->y = 0; + akerning->x = 0; + akerning->y = 0; if ( driver->clazz->get_kerning ) { error = driver->clazz->get_kerning( face, left_glyph, right_glyph, - kerning ); + akerning ); if ( !error ) { if ( kern_mode != ft_kerning_unscaled ) { - kerning->x = FT_MulFix( kerning->x, face->size->metrics.x_scale ); - kerning->y = FT_MulFix( kerning->y, face->size->metrics.y_scale ); + 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 ) { - kerning->x = ( kerning->x + 32 ) & -64; - kerning->y = ( kerning->y + 32 ) & -64; + akerning->x = ( akerning->x + 32 ) & -64; + akerning->y = ( akerning->y + 32 ) & -64; } } } @@ -3203,7 +3203,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_New_Library( FT_Memory memory, - FT_Library* alibrary ) + FT_Library *alibrary ) { FT_Library library = 0; FT_Error error; diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 1477ec3da..440530aac 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -274,30 +274,30 @@ FT_Memory memory, FT_UInt numPoints, FT_Int numContours, - FT_Outline* outline ) + FT_Outline *anoutline ) { FT_Error error; - if ( !outline || !memory ) + if ( !anoutline || !memory ) return FT_Err_Invalid_Argument; - *outline = null_outline; + *anoutline = null_outline; - if ( ALLOC_ARRAY( outline->points, numPoints * 2L, FT_Pos ) || - ALLOC_ARRAY( outline->tags, numPoints, FT_Byte ) || - ALLOC_ARRAY( outline->contours, numContours, FT_UShort ) ) + if ( ALLOC_ARRAY( anoutline->points, numPoints * 2L, FT_Pos ) || + ALLOC_ARRAY( anoutline->tags, numPoints, FT_Byte ) || + ALLOC_ARRAY( anoutline->contours, numContours, FT_UShort ) ) goto Fail; - outline->n_points = (FT_UShort)numPoints; - outline->n_contours = (FT_Short)numContours; - outline->flags |= ft_outline_owner; + anoutline->n_points = (FT_UShort)numPoints; + anoutline->n_contours = (FT_Short)numContours; + anoutline->flags |= ft_outline_owner; return FT_Err_Ok; Fail: - outline->flags |= ft_outline_owner; - FT_Outline_Done_Internal( memory, outline ); + anoutline->flags |= ft_outline_owner; + FT_Outline_Done_Internal( memory, anoutline ); return error; } @@ -338,13 +338,13 @@ FT_EXPORT_DEF( FT_Error ) FT_Outline_New( FT_Library library, FT_UInt numPoints, FT_Int numContours, - FT_Outline* outline ) + FT_Outline *anoutline ) { if ( !library ) return FT_Err_Invalid_Library_Handle; return FT_Outline_New_Internal( library->memory, numPoints, - numContours, outline ); + numContours, anoutline ); } @@ -368,7 +368,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_Outline_Copy( FT_Outline* source, - FT_Outline* target ) + FT_Outline *target ) { FT_Int is_owner; @@ -484,12 +484,12 @@ /* Yes. */ /* */ FT_EXPORT_DEF( void ) FT_Outline_Get_CBox( FT_Outline* outline, - FT_BBox* cbox ) + FT_BBox *acbox ) { FT_Pos xMin, yMin, xMax, yMax; - if ( outline && cbox ) + if ( outline && acbox ) { if ( outline->n_points == 0 ) { @@ -522,10 +522,10 @@ if ( y > yMax ) yMax = y; } } - cbox->xMin = xMin; - cbox->xMax = xMax; - cbox->yMin = yMin; - cbox->yMax = yMax; + acbox->xMin = xMin; + acbox->xMax = xMax; + acbox->yMin = yMin; + acbox->yMax = yMax; } } @@ -747,20 +747,20 @@ /* */ FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_Bitmap( FT_Library library, FT_Outline* outline, - FT_Bitmap* bitmap ) + FT_Bitmap *abitmap ) { FT_Raster_Params params; - if ( !bitmap ) + if ( !abitmap ) return FT_Err_Invalid_Argument; /* other checks are delayed to FT_Outline_Render() */ - params.target = bitmap; + params.target = abitmap; params.flags = 0; - if ( bitmap->pixel_mode == ft_pixel_mode_grays ) + if ( abitmap->pixel_mode == ft_pixel_mode_grays ) params.flags |= ft_raster_flag_aa; return FT_Outline_Render( library, outline, ¶ms ); diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 8ae15baa6..357df3b2a 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -231,12 +231,12 @@ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname, - FT_Stream stream ) + FT_Stream astream ) { FILE* file; - if ( !stream ) + if ( !astream ) return FT_Err_Invalid_Stream_Handle; file = fopen( filepathname, "rb" ); @@ -249,19 +249,19 @@ } fseek( file, 0, SEEK_END ); - stream->size = ftell( file ); + astream->size = ftell( file ); fseek( file, 0, SEEK_SET ); - stream->descriptor.pointer = file; - stream->pathname.pointer = (char*)filepathname; - stream->pos = 0; + astream->descriptor.pointer = file; + astream->pathname.pointer = (char*)filepathname; + astream->pos = 0; - stream->read = ft_io_stream; - stream->close = ft_close_stream; + astream->read = ft_io_stream; + astream->close = ft_close_stream; FT_TRACE1(( "FT_New_Stream:" )); FT_TRACE1(( " opened `%s' (%d bytes) successfully\n", - filepathname, stream->size )); + filepathname, astream->size )); return FT_Err_Ok; } diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c index a6a013e8b..c26c74d50 100644 --- a/src/cache/ftcchunk.c +++ b/src/cache/ftcchunk.c @@ -106,7 +106,7 @@ FT_EXPORT_DEF( FT_Error ) FTC_ChunkSet_New( FTC_Chunk_Cache cache, FT_Pointer type, - FTC_ChunkSet* aset ) + FTC_ChunkSet *aset ) { FT_Error error; FT_Memory memory = cache->root.memory; @@ -206,8 +206,8 @@ FT_EXPORT_DEF( FT_Error ) FTC_ChunkSet_Lookup_Node( FTC_ChunkSet cset, FT_UInt glyph_index, - FTC_ChunkNode* anode, - FT_UInt* aindex ) + FTC_ChunkNode *anode, + FT_UInt *anindex ) { FTC_Chunk_Cache cache = cset->cache; FTC_Manager manager = cache->root.manager; @@ -252,8 +252,8 @@ } } - *anode = node; - *aindex = glyph_index - chunk_index * chunk_size; + *anode = node; + *anindex = glyph_index - chunk_index * chunk_size; } Exit: diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 503fc8e2e..bbe2b620c 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -131,7 +131,7 @@ FT_EXPORT_DEF( FT_Error ) FTC_GlyphSet_New( FTC_Glyph_Cache cache, FT_Pointer type, - FTC_GlyphSet* aset ) + FTC_GlyphSet *aset ) { FT_Error error; FT_Memory memory = cache->root.memory; @@ -228,7 +228,7 @@ FT_EXPORT_DEF( FT_Error ) FTC_GlyphSet_Lookup_Node( FTC_GlyphSet gset, FT_UInt glyph_index, - FTC_GlyphNode* anode ) + FTC_GlyphNode *anode ) { FTC_Glyph_Cache cache = gset->cache; FTC_Manager manager = cache->root.manager; diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index fd1880f73..f6fa4bfe1 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -262,7 +262,7 @@ FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_New( FTC_Manager manager, - FTC_Image_Cache* acache ) + FTC_Image_Cache *acache ) { return FTC_Manager_Register_Cache( manager, diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 15aa57bd2..f61ebc4a9 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -213,7 +213,7 @@ FT_ULong max_bytes, FTC_Face_Requester requester, FT_Pointer req_data, - FTC_Manager* amanager ) + FTC_Manager *amanager ) { FT_Error error; FT_Memory memory; @@ -319,7 +319,7 @@ FT_EXPORT( FT_Error ) FTC_Manager_Lookup_Face( FTC_Manager manager, FTC_FaceID face_id, - FT_Face* aface ) + FT_Face *aface ) { if ( !manager ) return FT_Err_Invalid_Cache_Handle; @@ -332,8 +332,8 @@ FT_EXPORT( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager, FTC_Font font, - FT_Face* aface, - FT_Size* asize ) + FT_Face *aface, + FT_Size *asize ) { FTC_FontRequest req; FT_Error error; @@ -428,7 +428,7 @@ FT_EXPORT( FT_Error ) FTC_Manager_Register_Cache( FTC_Manager manager, FTC_Cache_Class* clazz, - FTC_Cache* acache ) + FTC_Cache *acache ) { FT_Error error = FT_Err_Invalid_Argument; diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 83fbf34ad..209f3d30d 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -355,7 +355,7 @@ FT_EXPORT_DEF( FT_Error ) FTC_SBit_Cache_New( FTC_Manager manager, - FTC_SBit_Cache* acache ) + FTC_SBit_Cache *acache ) { return FTC_Manager_Register_Cache( manager, @@ -367,21 +367,21 @@ FT_EXPORT( FT_Error ) FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache, FTC_Image_Desc* desc, FT_UInt gindex, - FTC_SBit* asbit ) + FTC_SBit *ansbit ) { FT_Error error; FTC_ChunkNode node; FT_UInt cindex; /* argument checks delayed to FTC_Chunk_Cache_Lookup */ - if (!asbit) + if (!ansbit) return FT_Err_Invalid_Argument; - *asbit = 0; - error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex, - &node, &cindex ); + *ansbit = 0; + error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex, + &node, &cindex ); if (!error) - *asbit = (FTC_SBit)node->elements + cindex; + *ansbit = (FTC_SBit)node->elements + cindex; return error; } diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c index 0d1c0251f..7a41db6b8 100644 --- a/src/cache/ftlru.c +++ b/src/cache/ftlru.c @@ -41,16 +41,16 @@ FT_Pointer user_data, FT_Memory memory, FT_Bool pre_alloc, - FT_Lru* alru ) + FT_Lru *anlru ) { FT_Error error; FT_Lru lru; - if ( !alru ) + if ( !anlru ) return FT_Err_Invalid_Argument; - *alru = 0; + *anlru = 0; if ( !ALLOC( lru, sizeof ( *lru ) ) ) { if ( pre_alloc ) @@ -72,7 +72,7 @@ lru->memory = memory; lru->user_data = user_data; - *alru = lru; + *anlru = lru; } Exit: @@ -132,7 +132,7 @@ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup_Node( FT_Lru lru, FT_LruKey key, - FT_LruNode* anode ) + FT_LruNode *anode ) { FT_Error error = 0; FT_ListNode node; @@ -258,7 +258,7 @@ FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup( FT_Lru lru, FT_LruKey key, - FT_Pointer* aobject ) + FT_Pointer *anobject ) { FT_Error error; FT_LruNode node; @@ -266,13 +266,13 @@ /* check for valid `lru' and `key' delayed to FT_Lru_Lookup_Node() */ - if ( !aobject ) + if ( !anobject ) return FT_Err_Invalid_Argument; - *aobject = 0; + *anobject = 0; error = FT_Lru_Lookup_Node( lru, key, &node ); if ( !error ) - *aobject = node->root.data; + *anobject = node->root.data; return error; } diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 17a4b976d..a2d28c056 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -172,7 +172,7 @@ #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - /* see `ttload.h` */ + /* see `ttload.h' */ TT_Load_Bitmap_Header, /* see `ttsbit.h' */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index a1ed6c9b9..28e885c51 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -267,38 +267,37 @@ /* Load tables */ - /* we now support two SFNT-based bitmapped font formats. */ - /* they are recognized easily as they do not include a "glyf" */ - /* table.. */ + /* We now support two SFNT-based bitmapped font formats. They */ + /* are recognized easily as they do not include a `glyf' */ + /* table. */ /* */ - /* the first format comes from Apple, and uses a table named */ - /* "bhed" instead of "head" to store the font header (using */ - /* the same format). it also doesn't include horizontal and */ - /* vertical metrics tables (i.e. "hhea" and "vhea" tables) */ + /* The first format comes from Apple, and uses a table named */ + /* `bhed' instead of `head' to store the font header (using */ + /* the same format). It also doesn't include horizontal and */ + /* vertical metrics tables (i.e. `hhea' and `vhea' tables are */ + /* missing). */ /* */ - /* the other format comes from Microsoft, and is used with */ - /* WinCE / PocketPC. It's standard, except that it doesn't */ - /* contain outlines.. */ + /* The other format comes from Microsoft, and is used with */ + /* WinCE/PocketPC. It looks like a standard TTF, except that */ + /* it doesn't contain outlines. */ /* */ - /* do we have outlines in there ?? */ - has_outline = (TT_LookUp_Table( face, TTAG_glyf ) != 0); + /* do we have outlines in there? */ + has_outline = ( TT_LookUp_Table( face, TTAG_glyf ) != 0 ); is_apple_sbit = 0; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - /* - * if this font doesn't contain outlines, we'll try to load - * a "bhed" table in it.. - */ + /* if this font doesn't contain outlines, we try to load */ + /* a `bhed' table */ if ( !has_outline ) - is_apple_sbit = !LOAD_(bitmap_header); + is_apple_sbit = !LOAD_( bitmap_header ); -#endif +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - /* load the font header ("head" table) if this isn't an Apple */ - /* sbit font file.. */ - if ( !is_apple_sbit && LOAD_(header) ) + /* load the font header (`head' table) if this isn't an Apple */ + /* sbit font file */ + if ( !is_apple_sbit && LOAD_( header ) ) goto Exit; /* load other tables */ @@ -309,20 +308,20 @@ goto Exit; /* do not load the metrics headers and tables if this is an Apple */ - /* sbit font file.. */ + /* sbit font file */ if ( !is_apple_sbit ) { - /* load the "hhea" and "hmtx" tables at once */ + /* load the `hhea' and `hmtx' tables at once */ error = sfnt->load_metrics( face, stream, 0 ); - if (error) + if ( error ) goto Exit; - /* try to load the "vhea" and "vmtx" tables at once */ + /* try to load the `vhea' and `vmtx' tables at once */ error = sfnt->load_metrics( face, stream, 1 ); - if (error) + if ( error ) goto Exit; - if ( LOAD_(os2) ) + if ( LOAD_( os2 ) ) goto Exit; } diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 5d8ffcc53..66d2f260e 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -517,21 +517,26 @@ return error; } + FT_LOCAL_DEF FT_Error TT_Load_Header( TT_Face face, - FT_Stream stream ) + FT_Stream stream ) { return TT_Load_Generic_Header( face, stream, TTAG_head ); } + #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + FT_LOCAL_DEF FT_Error TT_Load_Bitmap_Header( TT_Face face, - FT_Stream stream ) + FT_Stream stream ) { return TT_Load_Generic_Header( face, stream, TTAG_bhed ); } -#endif + +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + /*************************************************************************/ /* */ diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h index 92c1da079..181119189 100644 --- a/src/sfnt/ttload.h +++ b/src/sfnt/ttload.h @@ -121,10 +121,13 @@ FT_Stream stream ); #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + FT_LOCAL FT_Error TT_Load_Bitmap_Header( TT_Face face, - FT_Stream stream ); -#endif + FT_Stream stream ); + +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + #ifdef __cplusplus } diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 0a783d1f8..505e44ed3 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -629,27 +629,29 @@ FT_LOCAL_DEF - FT_Error TT_Set_SBit_Strike( TT_Face face, - FT_Int x_ppem, - FT_Int y_ppem, - FT_ULong* astrike_index ) + FT_Error TT_Set_SBit_Strike( TT_Face face, + FT_Int x_ppem, + FT_Int y_ppem, + FT_ULong *astrike_index ) { - FT_Int i; + FT_Int i; + if ( x_ppem < 0 || x_ppem > 255 || - y_ppem < 1 || y_ppem > 255 ) + y_ppem < 1 || y_ppem > 255 ) return TT_Err_Invalid_PPem; for ( i = 0; i < face->num_sbit_strikes; i++ ) { - if ( ( face->sbit_strikes[i].y_ppem == y_ppem ) && - ( ( x_ppem == 0 ) || - ( face->sbit_strikes[i].x_ppem == x_ppem ))) + if ( ( face->sbit_strikes[i].y_ppem == y_ppem ) && + ( ( x_ppem == 0 ) || + ( face->sbit_strikes[i].x_ppem == x_ppem ) ) ) { - *astrike_index = i; - return TT_Err_Ok; + *astrike_index = i; + return TT_Err_Ok; } } + return TT_Err_Invalid_PPem; } @@ -665,10 +667,12 @@ /* */ /* */ /* glyph_index :: The glyph index. */ + /* */ /* strike :: The source/current sbit strike. */ /* */ /* */ /* arange :: The sbit range containing the glyph index. */ + /* */ /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ /* */ /* */ @@ -766,12 +770,16 @@ /* */ /* */ /* face :: The target face object. */ + /* */ /* glyph_index :: The glyph index. */ - /* strike_index :: The current strike index. */ + /* */ + /* strike_index :: The current strike index. */ /* */ /* */ /* arange :: The SBit range containing the glyph index. */ + /* */ /* astrike :: The SBit strike containing the glyph index. */ + /* */ /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ /* */ /* */ @@ -781,21 +789,23 @@ static FT_Error Find_SBit_Image( TT_Face face, FT_UInt glyph_index, - FT_ULong strike_index, - TT_SBit_Range** arange, - TT_SBit_Strike** astrike, - FT_ULong* aglyph_offset ) + FT_ULong strike_index, + TT_SBit_Range* *arange, + TT_SBit_Strike* *astrike, + FT_ULong *aglyph_offset ) { - FT_Error error; + FT_Error error; TT_SBit_Strike* strike; - if ( !face->sbit_strikes || ( face->num_sbit_strikes <= (FT_Int)strike_index ) ) + + if ( !face->sbit_strikes || + ( face->num_sbit_strikes <= (FT_Int)strike_index ) ) goto Fail; strike = &face->sbit_strikes[strike_index]; error = Find_SBit_Range( glyph_index, strike, - arange, aglyph_offset ); + arange, aglyph_offset ); if ( error ) goto Fail; @@ -921,8 +931,8 @@ /* Crops a bitmap to its tightest bounding box, and adjusts its */ /* metrics. */ /* */ - /* */ - /* image :: The input glyph slot. */ + /* */ + /* map :: The bitmap. */ /* */ /* metrics :: The corresponding metrics structure. */ /* */ @@ -1366,21 +1376,21 @@ /* returns its metrics. */ /* */ /* */ - /* face :: The target face object. */ + /* face :: The target face object. */ /* */ /* strike_index :: The current strike index. */ /* */ - /* glyph_index :: The current glyph index. */ + /* glyph_index :: The current glyph index. */ /* */ - /* load_flags :: The glyph load flags (the code checks for the flag */ - /* FT_LOAD_CROP_BITMAP */ + /* load_flags :: The glyph load flags (the code checks for the flag */ + /* FT_LOAD_CROP_BITMAP). */ /* */ - /* stream :: The input stream. */ + /* stream :: The input stream. */ /* */ /* */ - /* map :: The target pixmap. */ + /* map :: The target pixmap. */ /* */ - /* metrics :: A big sbit metrics structure for the glyph image. */ + /* metrics :: A big sbit metrics structure for the glyph image. */ /* */ /* */ /* FreeType error code. 0 means success. Returns an error if no */ @@ -1391,12 +1401,12 @@ /* */ FT_LOCAL_DEF FT_Error TT_Load_SBit_Image( TT_Face face, - FT_ULong strike_index, + FT_ULong strike_index, FT_UInt glyph_index, FT_UInt load_flags, FT_Stream stream, - FT_Bitmap* map, - TT_SBit_Metrics* metrics ) + FT_Bitmap *map, + TT_SBit_Metrics *metrics ) { FT_Error error; FT_Memory memory = stream->memory; diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h index daaa34b5d..ce941b886 100644 --- a/src/sfnt/ttsbit.h +++ b/src/sfnt/ttsbit.h @@ -45,10 +45,10 @@ FT_LOCAL - FT_Error TT_Set_SBit_Strike( TT_Face face, - FT_Int x_ppem, - FT_Int y_ppem, - FT_ULong *astrike_index ); + FT_Error TT_Set_SBit_Strike( TT_Face face, + FT_Int x_ppem, + FT_Int y_ppem, + FT_ULong *astrike_index ); FT_LOCAL FT_Error TT_Load_SBit_Image( TT_Face face, @@ -60,7 +60,6 @@ TT_SBit_Metrics *metrics ); - #ifdef __cplusplus } #endif diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 91d63ee28..b414e2b3a 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1345,15 +1345,13 @@ glyph->num_subglyphs = 0; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - /* - * try to load embedded bitmap if any - * - * XXX: The convention should be emphasized in - * the documents. Because some application - * developpers confuse. - */ + + /* try to load embedded bitmap if any */ + /* */ + /* XXX: The convention should be emphasized in */ + /* the documents because it can be confusing. */ if ( size && - size->strike_index != 0xFFFF && + size->strike_index != 0xFFFF && sfnt->load_sbits && ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index c8f414db6..e45d81f20 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -453,7 +453,8 @@ size->ttmetrics.valid = FALSE; return error; -#if defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER) || defined(TT_CONFIG_OPTION_EMBEDDED_BITMAPS) +#if defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) || \ + defined( TT_CONFIG_OPTION_EMBEDDED_BITMAPS ) Fail_Exec: if ( !size->debug ) @@ -526,11 +527,11 @@ /*************************************************************************/ /* */ /* */ - /* TT_Reset_Size */ + /* Reset_Outline_Size */ /* */ /* */ - /* Resets a TrueType size when resolutions and character dimensions */ - /* have been changed. */ + /* Resets a TrueType outline size when resolutions and character */ + /* dimensions have been changed. */ /* */ /* */ /* size :: A handle to the target size object. */ @@ -575,21 +576,19 @@ } /* Compute root ascender, descender, test height, and max_advance */ - { - metrics->ascender = ( FT_MulFix( face->root.ascender, - metrics->y_scale ) + 32 ) & -64; - metrics->descender = ( FT_MulFix( face->root.descender, - metrics->y_scale ) + 32 ) & -64; - metrics->height = ( FT_MulFix( face->root.height, - metrics->y_scale ) + 32 ) & -64; - metrics->max_advance = ( FT_MulFix( face->root.max_advance_width, - metrics->x_scale ) + 32 ) & -64; - } + metrics->ascender = ( FT_MulFix( face->root.ascender, + metrics->y_scale ) + 32 ) & -64; + metrics->descender = ( FT_MulFix( face->root.descender, + metrics->y_scale ) + 32 ) & -64; + metrics->height = ( FT_MulFix( face->root.height, + metrics->y_scale ) + 32 ) & -64; + metrics->max_advance = ( FT_MulFix( face->root.max_advance_width, + metrics->x_scale ) + 32 ) & -64; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - /* set to "invalid" by default */ + /* set to `invalid' by default */ size->strike_index = 0xFFFF; #endif @@ -673,7 +672,21 @@ return error; } + #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + + /*************************************************************************/ + /* */ + /* */ + /* Reset_SBit_Size */ + /* */ + /* */ + /* Resets a TrueType sbit size when resolutions and character */ + /* dimensions have been changed. */ + /* */ + /* */ + /* size :: A handle to the target size object. */ + /* */ static FT_Error Reset_SBit_Size( TT_Size size ) { @@ -685,9 +698,10 @@ FT_Size_Metrics* sbit_metrics; SFNT_Interface* sfnt; + metrics = &size->root.metrics; - if (size->strike_index != 0xFFFF) + if ( size->strike_index != 0xFFFF ) return TT_Err_Ok; face = (TT_Face)size->root.face; @@ -696,31 +710,31 @@ sbit_metrics = &size->strike_metrics; error = sfnt->set_sbit_strike(face, - metrics->x_ppem, metrics->y_ppem, - &strike_index); + metrics->x_ppem, metrics->y_ppem, + &strike_index); - if (!error) + if ( !error ) { TT_SBit_Strike* strike = face->sbit_strikes + strike_index; - sbit_metrics->x_ppem = metrics->x_ppem; - sbit_metrics->y_ppem = metrics->y_ppem; + sbit_metrics->x_ppem = metrics->x_ppem; + sbit_metrics->y_ppem = metrics->y_ppem; #if 0 /* * sbit_metrics->?_scale * are not used now. */ - sbit_metrics->x_scale = 1 << 16; - sbit_metrics->y_scale = 1 << 16; + sbit_metrics->x_scale = 1 << 16; + sbit_metrics->y_scale = 1 << 16; #endif - sbit_metrics->ascender = strike->hori.ascender << 6; - sbit_metrics->descender = strike->hori.descender << 6; + sbit_metrics->ascender = strike->hori.ascender << 6; + sbit_metrics->descender = strike->hori.descender << 6; /* XXX: Is this correct? */ - sbit_metrics->height = sbit_metrics->ascender - - sbit_metrics->descender; + sbit_metrics->height = sbit_metrics->ascender - + sbit_metrics->descender; /* XXX: Is this correct? */ sbit_metrics->max_advance = ( strike->hori.min_origin_SB + @@ -743,8 +757,10 @@ return error; } + #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + /*************************************************************************/ /* */ /* */ @@ -760,40 +776,46 @@ FT_LOCAL_DEF FT_Error TT_Reset_Size( TT_Size size ) { - FT_Face face; + FT_Face face; FT_Error error = TT_Err_Ok; + face = size->root.face; if ( face->face_flags & FT_FACE_FLAG_SCALABLE ) { if ( !size->ttmetrics.valid ) - error = Reset_Outline_Size( size ); + error = Reset_Outline_Size( size ); if ( error ) - return error; + return error; } #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + if ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) { FT_Size_Metrics* sbit_metrics; + if ( size->strike_index == 0xFFFF ) error = Reset_SBit_Size( size ); sbit_metrics = &size->strike_metrics; - if ((!error) && !( face->face_flags & FT_FACE_FLAG_SCALABLE )) - size->root.metrics = *sbit_metrics; + if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) ) + size->root.metrics = *sbit_metrics; } -#endif - if (face->face_flags & FT_FACE_FLAG_SCALABLE) + +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + + if ( face->face_flags & FT_FACE_FLAG_SCALABLE ) return TT_Err_Ok; else return error; } + /*************************************************************************/ /* */ /* */ diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index ebc47c1cc..9fa331e38 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -305,7 +305,6 @@ } TT_Size_Metrics; - /*************************************************************************/ /* */ /* TrueType size class. */ @@ -317,8 +316,10 @@ TT_Size_Metrics ttmetrics; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - FT_UInt strike_index; /* 0xFFFF to indicate invalid */ - FT_Size_Metrics strike_metrics; /* current strike's metrics */ + + FT_UInt strike_index; /* 0xFFFF to indicate invalid */ + FT_Size_Metrics strike_metrics; /* current strike's metrics */ + #endif #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER