From e1bbc017cea48cca5a878c690a15bc36b4b911d4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 19 Jul 2000 06:25:56 +0000 Subject: [PATCH] Formatting. Fixing documentation. --- include/freetype/internal/t2errors.h | 112 +++--- include/freetype/internal/t2types.h | 228 +++++------ include/freetype/internal/tterrors.h | 75 ++-- include/freetype/internal/tttypes.h | 555 +++++++++++++++------------ src/sfnt/sfobjs.c | 6 +- src/sfnt/ttload.c | 26 +- 6 files changed, 540 insertions(+), 462 deletions(-) diff --git a/include/freetype/internal/t2errors.h b/include/freetype/internal/t2errors.h index 4f8e1929c..d68522001 100644 --- a/include/freetype/internal/t2errors.h +++ b/include/freetype/internal/t2errors.h @@ -4,11 +4,11 @@ /* */ /* OpenType error ID definitions (specification only). */ /* */ -/* Copyright 1996-1999 by */ +/* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ @@ -19,6 +19,7 @@ #ifndef T2ERRORS_H #define T2ERRORS_H + /*************************************************************************/ /* */ /* Error codes declaration */ @@ -32,31 +33,31 @@ /* Success is always 0. */ -#define T2_Err_Ok FT_Err_Ok +#define T2_Err_Ok FT_Err_Ok /* High level API errors. */ -#define T2_Err_Invalid_File_Format FT_Err_Invalid_File_Format -#define T2_Err_Invalid_Argument FT_Err_Invalid_Argument -#define T2_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle -#define T2_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define T2_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle -#define T2_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle -#define T2_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle -#define T2_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index +#define T2_Err_Invalid_File_Format FT_Err_Invalid_File_Format +#define T2_Err_Invalid_Argument FT_Err_Invalid_Argument +#define T2_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle +#define T2_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle +#define T2_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle +#define T2_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle +#define T2_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle +#define T2_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index -#define T2_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature +#define T2_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature -#define T2_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle +#define T2_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle /* Internal errors. */ -#define T2_Err_Out_Of_Memory FT_Err_Out_Of_Memory -#define T2_Err_Unlisted_Object FT_Err_Unlisted_Object +#define T2_Err_Out_Of_Memory FT_Err_Out_Of_Memory +#define T2_Err_Unlisted_Object FT_Err_Unlisted_Object /* General glyph outline errors. */ -#define T2_Err_Invalid_Composite FT_Err_Invalid_Composite +#define T2_Err_Invalid_Composite FT_Err_Invalid_Composite /* Bytecode interpreter error codes. */ @@ -65,55 +66,56 @@ /* broken font file, a broken glyph within a font */ /* file, or a bug in the interpreter! */ -#define T2_Err_Invalid_Opcode 0x500 -#define T2_Err_Too_Few_Arguments 0x501 -#define T2_Err_Stack_Overflow 0x502 -#define T2_Err_Code_Overflow 0x503 -#define T2_Err_Bad_Argument 0x504 -#define T2_Err_Divide_By_Zero 0x505 -#define T2_Err_Storage_Overflow 0x506 -#define T2_Err_Cvt_Overflow 0x507 -#define T2_Err_Invalid_Reference 0x508 -#define T2_Err_Invalid_Distance 0x509 -#define T2_Err_Interpolate_Twilight 0x50A -#define T2_Err_Debug_OpCode 0x50B -#define T2_Err_ENDF_In_Exec_Stream 0x50C -#define T2_Err_Out_Of_CodeRanges 0x50D -#define T2_Err_Nested_DEFS 0x50E -#define T2_Err_Invalid_CodeRange 0x50F -#define T2_Err_Invalid_Displacement 0x510 -#define T2_Err_Execution_Too_Long 0x511 +#define T2_Err_Invalid_Opcode 0x500 +#define T2_Err_Too_Few_Arguments 0x501 +#define T2_Err_Stack_Overflow 0x502 +#define T2_Err_Code_Overflow 0x503 +#define T2_Err_Bad_Argument 0x504 +#define T2_Err_Divide_By_Zero 0x505 +#define T2_Err_Storage_Overflow 0x506 +#define T2_Err_Cvt_Overflow 0x507 +#define T2_Err_Invalid_Reference 0x508 +#define T2_Err_Invalid_Distance 0x509 +#define T2_Err_Interpolate_Twilight 0x50A +#define T2_Err_Debug_OpCode 0x50B +#define T2_Err_ENDF_In_Exec_Stream 0x50C +#define T2_Err_Out_Of_CodeRanges 0x50D +#define T2_Err_Nested_DEFS 0x50E +#define T2_Err_Invalid_CodeRange 0x50F +#define T2_Err_Invalid_Displacement 0x510 +#define T2_Err_Execution_Too_Long 0x511 #define T2_Err_Too_Many_Instruction_Defs 0x512 #define T2_Err_Too_Many_Function_Defs 0x513 /* Other TrueType specific error codes. */ -#define T2_Err_Table_Missing 0x520 -#define T2_Err_Too_Many_Extensions 0x521 -#define T2_Err_Extensions_Unsupported 0x522 -#define T2_Err_Invalid_Extension_Id 0x523 +#define T2_Err_Table_Missing 0x520 +#define T2_Err_Too_Many_Extensions 0x521 +#define T2_Err_Extensions_Unsupported 0x522 +#define T2_Err_Invalid_Extension_Id 0x523 -#define T2_Err_No_Vertical_Data 0x524 +#define T2_Err_No_Vertical_Data 0x524 -#define T2_Err_Max_Profile_Missing 0x530 -#define T2_Err_Header_Table_Missing 0x531 -#define T2_Err_Horiz_Header_Missing 0x532 -#define T2_Err_Locations_Missing 0x533 -#define T2_Err_Name_Table_Missing 0x534 -#define T2_Err_CMap_Table_Missing 0x535 -#define T2_Err_Hmtx_Table_Missing 0x536 -#define T2_Err_OS2_Table_Missing 0x537 -#define T2_Err_Post_Table_Missing 0x538 +#define T2_Err_Max_Profile_Missing 0x530 +#define T2_Err_Header_Table_Missing 0x531 +#define T2_Err_Horiz_Header_Missing 0x532 +#define T2_Err_Locations_Missing 0x533 +#define T2_Err_Name_Table_Missing 0x534 +#define T2_Err_CMap_Table_Missing 0x535 +#define T2_Err_Hmtx_Table_Missing 0x536 +#define T2_Err_OS2_Table_Missing 0x537 +#define T2_Err_Post_Table_Missing 0x538 -#define T2_Err_Invalid_Horiz_Metrics 0x540 -#define T2_Err_Invalid_CharMap_Format 0x541 -#define T2_Err_Invalid_PPem 0x542 -#define T2_Err_Invalid_Vert_Metrics 0x543 +#define T2_Err_Invalid_Horiz_Metrics 0x540 +#define T2_Err_Invalid_CharMap_Format 0x541 +#define T2_Err_Invalid_PPem 0x542 +#define T2_Err_Invalid_Vert_Metrics 0x543 -#define T2_Err_Could_Not_Find_Context 0x550 +#define T2_Err_Could_Not_Find_Context 0x550 -#endif /* FTERRID_H */ + +#endif /* T2ERRORS_H */ /* END */ diff --git a/include/freetype/internal/t2types.h b/include/freetype/internal/t2types.h index 0480d45b6..033f315e9 100644 --- a/include/freetype/internal/t2types.h +++ b/include/freetype/internal/t2types.h @@ -5,14 +5,11 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* This code is used by the OpenType/CFF driver. */ -/* */ -/* */ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ @@ -27,25 +24,29 @@ #include - /************************************************************************* - * - * - * CFF_Index - * - * - * A structure used to model a CFF Index table - * - * - * count :: number of elements in index - * off_size :: size in bytes of object offsets in index - * data_offset :: position of first data byte in the index's bytes - * - * total_size :: total_size of index in bytes - * bytes :: when the index is loaded in memory, its bytes - * file_offset :: position of index in file. The offset table starts - * at file_offset + 3 - */ - typedef struct CFF_Index_ + /*************************************************************************/ + /* */ + /* */ + /* CFF_Index */ + /* */ + /* */ + /* A structure used to model a CFF Index table. */ + /* */ + /* */ + /* stream :: XXX */ + /* */ + /* count :: The number of elements in the index. */ + /* */ + /* off_size :: The size in bytes of object offsets in index. */ + /* */ + /* data_offset :: The position of first data byte in the index's */ + /* bytes. */ + /* */ + /* offsets :: XXX */ + /* */ + /* bytes :: If the index is loaded in memory, its bytes. */ + /* */ + typedef struct CFF_Index_ { FT_Stream stream; FT_UInt count; @@ -58,93 +59,92 @@ } CFF_Index; - typedef struct CFF_Font_Dict_ + typedef struct CFF_Font_Dict_ { - FT_UInt version; - FT_UInt notice; - FT_UInt copyright; - FT_UInt full_name; - FT_UInt family_name; - FT_UInt weight; - FT_Bool is_fixed_pitch; - FT_Fixed italic_angle; - FT_Pos underline_position; - FT_Pos underline_thickness; - FT_Int paint_type; - FT_Int charstring_type; - FT_Matrix font_matrix; - FT_ULong unique_id; - FT_BBox font_bbox; - FT_Pos stroke_width; - FT_ULong charset_offset; - FT_ULong encoding_offset; - FT_ULong charstrings_offset; - FT_ULong private_offset; - FT_ULong private_size; - FT_Long synthetic_base; - FT_UInt embedded_postscript; - FT_UInt base_font_name; - FT_UInt postscript; + FT_UInt version; + FT_UInt notice; + FT_UInt copyright; + FT_UInt full_name; + FT_UInt family_name; + FT_UInt weight; + FT_Bool is_fixed_pitch; + FT_Fixed italic_angle; + FT_Pos underline_position; + FT_Pos underline_thickness; + FT_Int paint_type; + FT_Int charstring_type; + FT_Matrix font_matrix; + FT_ULong unique_id; + FT_BBox font_bbox; + FT_Pos stroke_width; + FT_ULong charset_offset; + FT_ULong encoding_offset; + FT_ULong charstrings_offset; + FT_ULong private_offset; + FT_ULong private_size; + FT_Long synthetic_base; + FT_UInt embedded_postscript; + FT_UInt base_font_name; + FT_UInt postscript; - /* these should only be used for the top-level font dict */ - FT_UInt cid_registry; - FT_UInt cid_ordering; - FT_ULong cid_supplement; + /* these should only be used for the top-level font dictionary */ + FT_UInt cid_registry; + FT_UInt cid_ordering; + FT_ULong cid_supplement; - FT_Long cid_font_version; - FT_Long cid_font_revision; - FT_Long cid_font_type; - FT_Long cid_count; - FT_ULong cid_uid_base; - FT_ULong cid_fd_array_offset; - FT_ULong cid_fd_select_offset; - FT_UInt cid_font_name; + FT_Long cid_font_version; + FT_Long cid_font_revision; + FT_Long cid_font_type; + FT_Long cid_count; + FT_ULong cid_uid_base; + FT_ULong cid_fd_array_offset; + FT_ULong cid_fd_select_offset; + FT_UInt cid_font_name; } CFF_Font_Dict; - - typedef struct CFF_Private_ + typedef struct CFF_Private_ { - FT_Byte num_blue_values; - FT_Byte num_other_blues; - FT_Byte num_family_blues; - FT_Byte num_family_other_blues; + FT_Byte num_blue_values; + FT_Byte num_other_blues; + FT_Byte num_family_blues; + FT_Byte num_family_other_blues; - FT_Pos blue_values[14]; - FT_Pos other_blues[10]; - FT_Pos family_blues[14]; - FT_Pos family_other_blues[10]; + FT_Pos blue_values[14]; + FT_Pos other_blues[10]; + FT_Pos family_blues[14]; + FT_Pos family_other_blues[10]; - FT_Fixed blue_scale; - FT_Pos blue_shift; - FT_Pos blue_fuzz; - FT_Pos standard_width; - FT_Pos standard_height; + FT_Fixed blue_scale; + FT_Pos blue_shift; + FT_Pos blue_fuzz; + FT_Pos standard_width; + FT_Pos standard_height; - FT_Byte num_snap_widths; - FT_Byte num_snap_heights; - FT_Pos snap_widths[13]; - FT_Pos snap_heights[13]; - FT_Bool force_bold; - FT_Fixed force_bold_threshold; - FT_Int lenIV; - FT_Int language_group; - FT_Fixed expansion_factor; - FT_Long initial_random_seed; - FT_ULong local_subrs_offset; - FT_Pos default_width; - FT_Pos nominal_width; + FT_Byte num_snap_widths; + FT_Byte num_snap_heights; + FT_Pos snap_widths[13]; + FT_Pos snap_heights[13]; + FT_Bool force_bold; + FT_Fixed force_bold_threshold; + FT_Int lenIV; + FT_Int language_group; + FT_Fixed expansion_factor; + FT_Long initial_random_seed; + FT_ULong local_subrs_offset; + FT_Pos default_width; + FT_Pos nominal_width; } CFF_Private; - typedef struct CFF_FD_Select_ + typedef struct CFF_FD_Select_ { FT_Byte format; FT_UInt range_count; - /* that's the table, taken from the file 'as is' */ + /* that's the table, taken from the file `as is' */ FT_Byte* data; FT_UInt data_size; @@ -156,10 +156,9 @@ } CFF_FD_Select; - - /* a SubFont packs a font dict and a private dict together. They're */ - /* needed to support CID-keyde CFF fonts.. */ - typedef struct CFF_SubFont_ + /* A SubFont packs a font dict and a private dict together. They are */ + /* needed to support CID-keyed CFF fonts. */ + typedef struct CFF_SubFont_ { CFF_Font_Dict font_dict; CFF_Private private_dict; @@ -174,30 +173,31 @@ /* maximum number of sub-fonts in a CID-keyed file */ #define CFF_MAX_CID_FONTS 16 - typedef struct CFF_Font_ + + typedef struct CFF_Font_ { - FT_Stream stream; - FT_Memory memory; - FT_UInt num_faces; - FT_UInt num_glyphs; + FT_Stream stream; + FT_Memory memory; + FT_UInt num_faces; + FT_UInt num_glyphs; - FT_Byte version_major; - FT_Byte version_minor; - FT_Byte header_size; - FT_Byte absolute_offsize; + FT_Byte version_major; + FT_Byte version_minor; + FT_Byte header_size; + FT_Byte absolute_offsize; - CFF_Index name_index; - CFF_Index top_dict_index; - CFF_Index string_index; - CFF_Index global_subrs_index; + CFF_Index name_index; + CFF_Index top_dict_index; + CFF_Index string_index; + CFF_Index global_subrs_index; /* we don't load the Encoding and CharSet tables */ - CFF_Index charstrings_index; - CFF_Index font_dict_index; - CFF_Index private_index; - CFF_Index local_subrs_index; + CFF_Index charstrings_index; + CFF_Index font_dict_index; + CFF_Index private_index; + CFF_Index local_subrs_index; FT_String* font_name; FT_UInt num_global_subrs; @@ -205,7 +205,7 @@ CFF_SubFont top_font; FT_UInt num_subfonts; - CFF_SubFont* subfonts[ CFF_MAX_CID_FONTS ]; + CFF_SubFont* subfonts[CFF_MAX_CID_FONTS]; CFF_FD_Select fd_select; diff --git a/include/freetype/internal/tterrors.h b/include/freetype/internal/tterrors.h index bb8c0fcd5..b53e9f3da 100644 --- a/include/freetype/internal/tterrors.h +++ b/include/freetype/internal/tterrors.h @@ -7,8 +7,8 @@ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ @@ -33,32 +33,32 @@ /* Success is always 0. */ -#define TT_Err_Ok FT_Err_Ok +#define TT_Err_Ok FT_Err_Ok /* High level API errors. */ -#define TT_Err_Invalid_File_Format FT_Err_Invalid_File_Format -#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument -#define TT_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle -#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle -#define TT_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle -#define TT_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle -#define TT_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle -#define TT_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index +#define TT_Err_Invalid_File_Format FT_Err_Invalid_File_Format +#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument +#define TT_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle +#define TT_Err_Invalid_Face_Handle FT_Err_Invalid_Face_Handle +#define TT_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_Handle +#define TT_Err_Invalid_Glyph_Handle FT_Err_Invalid_Slot_Handle +#define TT_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_Handle +#define TT_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index -#define TT_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature +#define TT_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature -#define TT_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle +#define TT_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle /* Internal errors. */ -#define TT_Err_Out_Of_Memory FT_Err_Out_Of_Memory -#define TT_Err_Unlisted_Object FT_Err_Unlisted_Object +#define TT_Err_Out_Of_Memory FT_Err_Out_Of_Memory +#define TT_Err_Unlisted_Object FT_Err_Unlisted_Object /* General glyph outline errors. */ -#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints -#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite +#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints +#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite /* Bytecode interpreter error codes. */ @@ -90,31 +90,32 @@ /* Other TrueType specific error codes. */ -#define TT_Err_Table_Missing 0x420 -#define TT_Err_Too_Many_Extensions 0x421 -#define TT_Err_Extensions_Unsupported 0x422 -#define TT_Err_Invalid_Extension_Id 0x423 +#define TT_Err_Table_Missing 0x420 +#define TT_Err_Too_Many_Extensions 0x421 +#define TT_Err_Extensions_Unsupported 0x422 +#define TT_Err_Invalid_Extension_Id 0x423 -#define TT_Err_No_Vertical_Data 0x424 +#define TT_Err_No_Vertical_Data 0x424 -#define TT_Err_Max_Profile_Missing 0x430 -#define TT_Err_Header_Table_Missing 0x431 -#define TT_Err_Horiz_Header_Missing 0x432 -#define TT_Err_Locations_Missing 0x433 -#define TT_Err_Name_Table_Missing 0x434 -#define TT_Err_CMap_Table_Missing 0x435 -#define TT_Err_Hmtx_Table_Missing 0x436 -#define TT_Err_OS2_Table_Missing 0x437 -#define TT_Err_Post_Table_Missing 0x438 +#define TT_Err_Max_Profile_Missing 0x430 +#define TT_Err_Header_Table_Missing 0x431 +#define TT_Err_Horiz_Header_Missing 0x432 +#define TT_Err_Locations_Missing 0x433 +#define TT_Err_Name_Table_Missing 0x434 +#define TT_Err_CMap_Table_Missing 0x435 +#define TT_Err_Hmtx_Table_Missing 0x436 +#define TT_Err_OS2_Table_Missing 0x437 +#define TT_Err_Post_Table_Missing 0x438 -#define TT_Err_Invalid_Horiz_Metrics 0x440 -#define TT_Err_Invalid_CharMap_Format 0x441 -#define TT_Err_Invalid_PPem 0x442 -#define TT_Err_Invalid_Vert_Metrics 0x443 +#define TT_Err_Invalid_Horiz_Metrics 0x440 +#define TT_Err_Invalid_CharMap_Format 0x441 +#define TT_Err_Invalid_PPem 0x442 +#define TT_Err_Invalid_Vert_Metrics 0x443 -#define TT_Err_Could_Not_Find_Context 0x450 +#define TT_Err_Could_Not_Find_Context 0x450 -#endif /* FTERRID_H */ + +#endif /* TTERRORS_H */ /* END */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 8381ded51..1fd43ceb5 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -5,14 +5,11 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* This code is shared by all TrueType and OpenType drivers. */ -/* */ -/* */ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ @@ -51,19 +48,22 @@ /* */ /* */ /* tag :: Must be `ttc ' to indicate a TrueType collection. */ + /* */ /* version :: The version number. */ + /* */ /* count :: The number of faces in the collection. The */ /* specification says this should be an unsigned long, but */ /* we use a signed long since we need the value -1 for */ /* specific purposes. */ + /* */ /* offsets :: The offsets of the font headers, one per face. */ /* */ typedef struct TTC_Header_ { - FT_ULong Tag; + FT_ULong tag; FT_Fixed version; - FT_Long DirCount; - FT_ULong* TableDirectory; + FT_Long count; + FT_ULong* offsets; } TTC_Header; @@ -77,11 +77,15 @@ /* SFNT file format header. */ /* */ /* */ - /* format_tag :: font format tag.. */ - /* num_tables :: number of tables in file */ - /* search_range :: must be 16*(max power of 2 <= num_tables) */ - /* entry_selector :: log2 of search_range/16 */ - /* range_shift :: must be num_tables*16 - search_range */ + /* format_tag :: The font format tag. */ + /* */ + /* num_tables :: The number of tables in file. */ + /* */ + /* search_range :: Must be 16*(max power of 2 <= num_tables). */ + /* */ + /* entry_selector :: Must be log2 of search_range/16. */ + /* */ + /* range_shift :: Must be num_tables*16 - search_range. */ /* */ typedef struct SFNT_Header_ { @@ -93,6 +97,7 @@ } SFNT_Header; + /*************************************************************************/ /* */ /* */ @@ -104,10 +109,13 @@ /* */ /* */ /* version :: The version number; starts with 0x00010000. */ + /* */ /* numTables :: The number of tables. */ /* */ /* searchRange :: Unused. */ + /* */ /* entrySelector :: Unused. */ + /* */ /* rangeShift :: Unused. */ /* */ /* */ @@ -115,8 +123,8 @@ /* */ typedef struct TT_TableDir_ { - FT_Fixed version; /* should be 0x10000 */ - FT_UShort numTables; /* number of tables */ + FT_Fixed version; /* should be 0x10000 */ + FT_UShort numTables; /* number of tables */ FT_UShort searchRange; /* These parameters are only used */ FT_UShort entrySelector; /* for a dichotomy search in the */ @@ -135,9 +143,12 @@ /* */ /* */ /* Tag :: A four-bytes tag describing the table. */ + /* */ /* CheckSum :: The table checksum. This value can be ignored. */ + /* */ /* Offset :: The offset of the table from the start of the TrueType */ /* font in its resource. */ + /* */ /* Length :: The table length (in bytes). */ /* */ typedef struct TT_Table_ @@ -161,6 +172,7 @@ /* */ /* */ /* tableVersionNumber :: The version number. */ + /* */ /* numCMaps :: The number of charmaps in the font. */ /* */ /* */ @@ -189,7 +201,7 @@ /* encodingID :: A platform-specific ID used to indicate which source */ /* encoding is used in this charmap. */ /* */ - /* offset :: The offset of the charmap relative to the start of */ + /* offset :: The offset of the charmap relative to the start of */ /* the `cmap' table. */ /* */ /* */ @@ -215,6 +227,7 @@ /* */ /* */ /* advance :: The advance width or height for the glyph. */ + /* */ /* bearing :: The left-side or top-side bearing for the glyph. */ /* */ typedef struct TT_LongMetrics_ @@ -362,7 +375,9 @@ /* */ /* */ /* version :: The version number. */ + /* */ /* numRanges :: The number of gasp ranges in table. */ + /* */ /* gaspRanges :: An array of gasp ranges. */ /* */ typedef struct TT_Gasp_ @@ -381,7 +396,7 @@ /* */ /* */ /* A small structure used to model the pre-computed widths of a given */ - /* size. They're found in the `hdmx' table. */ + /* size. They are found in the `hdmx' table. */ /* */ /* */ /* ppem :: The pixels per EM value at which these metrics apply. */ @@ -402,7 +417,7 @@ /*************************************************************************/ /* */ /* */ - /* TT_HdmxRec */ + /* TT_Hdmx */ /* */ /* */ /* A structure used to model the `hdmx' table, which contains */ @@ -410,7 +425,9 @@ /* */ /* */ /* version :: The version number. */ + /* */ /* num_records :: The number of hdmx records. */ + /* */ /* records :: An array of hdmx records. */ /* */ typedef struct TT_Hdmx_ @@ -434,7 +451,9 @@ /* */ /* */ /* left :: The index of the left glyph in pair. */ + /* */ /* right :: The index of the right glyph in pair. */ + /* */ /* value :: The kerning distance. A positive value spaces the */ /* glyphs, a negative one makes them closer. */ /* */ @@ -446,18 +465,20 @@ } TT_Kern_0_Pair; + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*** ***/ /*** ***/ - /*** EMBEDDED BITMAPS SUPPORT ***/ + /*** EMBEDDED BITMAPS SUPPORT ***/ /*** ***/ /*** ***/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ + /*************************************************************************/ /* */ /* */ @@ -512,15 +533,15 @@ /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */ /* */ /* */ - /* height :: The glyph height in pixels. */ + /* height :: The glyph height in pixels. */ /* */ - /* width :: The glyph width in pixels. */ + /* width :: The glyph width in pixels. */ /* */ - /* bearingX :: The left-side bearing. */ + /* bearingX :: The left-side bearing. */ /* */ - /* bearingY :: The top-side bearing. */ + /* bearingY :: The top-side bearing. */ /* */ - /* advance :: The advance width or height. */ + /* advance :: The advance width or height. */ /* */ typedef struct TT_SBit_Small_Metrics_ { @@ -582,6 +603,9 @@ /* */ /* vertBearingX - width */ /* */ + /* pads :: Unused (to make the size of the record */ + /* a multiple of 32 bits. */ + /* */ typedef struct TT_SBit_Line_Metrics_ { FT_Char ascender; @@ -692,23 +716,23 @@ /* */ typedef struct TT_SBit_Strike_ { - FT_Int num_ranges; - TT_SBit_Range* sbit_ranges; - FT_ULong ranges_offset; + FT_Int num_ranges; + TT_SBit_Range* sbit_ranges; + FT_ULong ranges_offset; - FT_ULong color_ref; + FT_ULong color_ref; - TT_SBit_Line_Metrics hori; - TT_SBit_Line_Metrics vert; + TT_SBit_Line_Metrics hori; + TT_SBit_Line_Metrics vert; - FT_UShort start_glyph; - FT_UShort end_glyph; + FT_UShort start_glyph; + FT_UShort end_glyph; - FT_Byte x_ppem; - FT_Byte y_ppem; + FT_Byte x_ppem; + FT_Byte y_ppem; - FT_Byte bit_depth; - FT_Char flags; + FT_Byte bit_depth; + FT_Char flags; } TT_SBit_Strike; @@ -723,7 +747,9 @@ /* */ /* */ /* glyph_code :: The element's glyph index. */ + /* */ /* x_offset :: The element's left bearing. */ + /* */ /* y_offset :: The element's top bearing. */ /* */ typedef struct TT_SBit_Component_ @@ -771,6 +797,7 @@ } TT_SBit_Scale; + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -783,6 +810,7 @@ /*************************************************************************/ /*************************************************************************/ + /*************************************************************************/ /* */ /* */ @@ -862,6 +890,7 @@ } TT_Post_Names; + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -874,7 +903,9 @@ /*************************************************************************/ /*************************************************************************/ + /* format 0 */ + typedef struct TT_CMap0_ { FT_Byte* glyphIdArray; @@ -883,6 +914,7 @@ /* format 2 */ + typedef struct TT_CMap2SubHeader_ { FT_UShort firstCode; /* first valid low byte */ @@ -895,7 +927,7 @@ typedef struct TT_CMap2_ { - FT_UShort* subHeaderKeys; + FT_UShort* subHeaderKeys; /* high byte mapping table */ /* value = subHeader index * 8 */ @@ -907,6 +939,7 @@ /* format 4 */ + typedef struct TT_CMap4Segment_ { FT_UShort endCount; @@ -919,21 +952,22 @@ typedef struct TT_CMap4_ { - FT_UShort segCountX2; /* number of segments * 2 */ - FT_UShort searchRange; /* these parameters can be used */ - FT_UShort entrySelector; /* for a binary search */ - FT_UShort rangeShift; + FT_UShort segCountX2; /* number of segments * 2 */ + FT_UShort searchRange; /* these parameters can be used */ + FT_UShort entrySelector; /* for a binary search */ + FT_UShort rangeShift; TT_CMap4Segment* segments; FT_UShort* glyphIdArray; FT_UShort numGlyphId; /* control value */ - TT_CMap4Segment* last_segment; /* last used segment, this is a small */ + TT_CMap4Segment* last_segment; /* last used segment; this is a small */ /* cache to potentially increase speed */ } TT_CMap4; /* format 6 */ + typedef struct TT_CMap6_ { FT_UShort firstCode; /* first character code of subrange */ @@ -943,12 +977,15 @@ } TT_CMap6; + typedef struct TT_CMapTable_ TT_CMapTable; + typedef FT_UInt (*TT_CharMap_Func)( TT_CMapTable* charmap, FT_ULong char_code ); + /* charmap table */ struct TT_CMapTable_ { @@ -979,16 +1016,17 @@ /* TT_CharMapRec */ /* */ /* */ - /* The TrueType character map object type. */ + /* The TrueType character map object type. */ /* */ /* */ /* root :: The parent character map structure. */ + /* */ /* cmap :: The used character map. */ /* */ typedef struct TT_CharMapRec_ { - FT_CharMapRec root; - TT_CMapTable cmap; + FT_CharMapRec root; + TT_CMapTable cmap; } TT_CharMapRec; @@ -1011,12 +1049,13 @@ /* This structure/class is defined here because it is common to the */ /* following formats: TTF, OpenType-TT, and OpenType-CFF. */ /* */ - /* Note however that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */ + /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */ /* are not shared between font drivers, and are thus defined normally in */ - /* `drivers/truetype/ttobjs.h'. */ + /* `ttobjs.h'. */ /* */ /*************************************************************************/ + /*************************************************************************/ /* */ /* */ @@ -1031,7 +1070,7 @@ /* The TT_Face structure is also used as a `parent class' for the */ /* OpenType-CFF class (T2_Face). */ /* */ - typedef struct TT_FaceRec_* TT_Face; + typedef struct TT_FaceRec_* TT_Face; /*************************************************************************/ @@ -1051,6 +1090,7 @@ /* forward declaration */ typedef struct TT_Loader_ TT_Loader; + /*************************************************************************/ /* */ /* */ @@ -1060,86 +1100,96 @@ /* Seeks a stream to the start of a given TrueType table. */ /* */ /* */ - /* face :: A handle to the target face object. */ - /* tag :: a 4-byte tag used to name the table */ - /* stream :: The input stream. */ + /* face :: A handle to the target face object. */ + /* */ + /* tag :: A 4-byte tag used to name the table. */ + /* */ + /* stream :: The input stream. */ /* */ /* */ - /* length :: length of table in bytes. Set to 0 when not needed */ + /* length :: The length of the table in bytes. Set to 0 if not */ + /* needed. */ /* */ /* */ - /* TrueType error code. 0 means success. */ + /* FreeType error code. 0 means success. */ /* */ /* */ - /* The stream cursor must be at the font file's origin */ + /* The stream cursor must be at the font file's origin. */ /* */ typedef FT_Error (*TT_Goto_Table_Func)( TT_Face face, FT_ULong tag, FT_Stream stream, - FT_ULong *length ); + FT_ULong* length ); + /*************************************************************************/ /* */ /* */ - /* TT_Access_Glyph_Frame */ + /* TT_Access_Glyph_Frame_Func */ /* */ /* */ - /* Seeks a stream to the start of a given glyph element, and */ - /* opens a frame for it.. */ + /* Seeks a stream to the start of a given glyph element, and opens a */ + /* frame for it. */ /* */ /* */ - /* loader :: the current TrueType glyph loader object */ - /* glyph index :: index of glyph to access */ - /* offset :: offset of glyph according to locations table */ - /* byte_count :: size of frame in bytes */ + /* loader :: The current TrueType glyph loader object. */ + /* */ + /* glyph index :: The index of the glyph to access. */ + /* */ + /* offset :: The offset of the glyph according to the */ + /* `locations' table. */ + /* */ + /* byte_count :: The size of the frame in bytes. */ /* */ /* */ - /* TrueType error code. 0 means success. */ + /* FreeType error code. 0 means success. */ /* */ /* */ /* This function is normally equivalent to FILE_Seek(offset) */ - /* followed by ACCESS_Frame(byte_count) with the loader's stream */ - /* but alternative formats (compressed ones) might use something */ - /* different.. */ + /* followed by ACCESS_Frame(byte_count) with the loader's stream, but */ + /* alternative formats (e.g. compressed ones) might use something */ + /* different. */ /* */ typedef FT_Error (*TT_Access_Glyph_Frame_Func)( TT_Loader* loader, FT_UInt glyph_index, FT_ULong offset, FT_UInt byte_count ); + /*************************************************************************/ /* */ /* */ - /* TT_Load_Glyph_Element */ + /* TT_Load_Glyph_Element_Func */ /* */ /* */ /* Reads one glyph element (its header, a simple glyph, or a */ - /* composite) from the loader's current stream frame.. */ + /* composite) from the loader's current stream frame. */ /* */ /* */ - /* loader :: the current TrueType glyph loader object */ + /* loader :: The current TrueType glyph loader object. */ /* */ /* */ - /* TrueType error code. 0 means success. */ + /* FreeType error code. 0 means success. */ /* */ typedef FT_Error (*TT_Load_Glyph_Element_Func)( TT_Loader* loader ); + /*************************************************************************/ /* */ /* */ - /* TT_Forget_Frame_Element */ + /* TT_Forget_Glyph_Frame_Func */ /* */ /* */ - /* Closes the current loader stream frame for the glyph.. */ + /* Closes the current loader stream frame for the glyph. */ /* */ /* */ - /* loader :: the current TrueType glyph loader object */ + /* loader :: The current TrueType glyph loader object. */ /* */ typedef - void (*TT_Forget_Glyph_Frame_Func)( TT_Loader* loader ); + void (*TT_Forget_Glyph_Frame_Func)( TT_Loader* loader ); @@ -1155,153 +1205,175 @@ /* point-size independent data found in a TrueType font file. */ /* */ /* */ - /* root :: The base FT_Face structure, managed by the */ - /* base layer. */ + /* root :: The base FT_Face structure, managed by the */ + /* base layer. */ /* */ - /* ttcHeader :: The TrueType collection header, used when the */ - /* file is a `ttc' rather than a `ttf'. For */ - /* ordinary font files, the field */ - /* `ttcHeader.DirCount' is set to 0. */ + /* ttc_header :: The TrueType collection header, used when */ + /* the file is a `ttc' rather than a `ttf'. */ + /* For ordinary font files, the field */ + /* `ttc_header.count' is set to 0. */ /* */ - /* num_tables :: The number of TrueType tables in this font */ - /* file. */ + /* format_tag :: The font format tag. */ /* */ - /* dir_tables :: The directory of TrueType tables for this */ - /* font file. */ + /* num_tables :: The number of TrueType tables in this font */ + /* file. */ /* */ - /* header :: The font's font header (`head' table). Read */ - /* on font opening. */ + /* dir_tables :: The directory of TrueType tables for this */ + /* font file. */ /* */ - /* horizontal :: The font's horizontal header (`hhea' table). */ - /* This field also contains the associated */ - /* horizontal metrics table (`hmtx'). */ + /* header :: The font's font header (`head' table). */ + /* Read on font opening. */ /* */ - /* max_profile :: The font's maximum profile table. Read on */ - /* font opening. Note that some maximum values */ - /* cannot be taken directly from this table. We */ - /* thus define additional fields below to hold */ - /* the computed maxima. */ + /* horizontal :: The font's horizontal header (`hhea' */ + /* table). This field also contains the */ + /* associated horizontal metrics table */ + /* (`hmtx'). */ /* */ - /* max_components :: The maximum number of glyph components */ - /* required to load any composite glyph from */ - /* this font. Used to size the load stack. */ + /* max_profile :: The font's maximum profile table. Read on */ + /* font opening. Note that some maximum */ + /* values cannot be taken directly from this */ + /* table. We thus define additional fields */ + /* below to hold the computed maxima. */ /* */ - /* vertical_info :: A boolean which is set when the font file */ - /* contains vertical metrics. If not, the value */ - /* of the `vertical' field is undefined. */ + /* max_components :: The maximum number of glyph components */ + /* required to load any composite glyph from */ + /* this font. Used to size the load stack. */ /* */ - /* vertical :: The font's vertical header (`vhea' table). */ - /* This field also contains the associated */ - /* vertical metrics table (`vmtx'), if found. */ - /* IMPORTANT: The contents of this field is */ - /* undefined if the `verticalInfo' field is */ - /* unset. */ + /* vertical_info :: A boolean which is set when the font file */ + /* contains vertical metrics. If not, the */ + /* value of the `vertical' field is */ + /* undefined. */ /* */ - /* num_names :: The number of name records within this */ - /* TrueType font. */ + /* vertical :: The font's vertical header (`vhea' table). */ + /* This field also contains the associated */ + /* vertical metrics table (`vmtx'), if found. */ + /* IMPORTANT: The contents of this field is */ + /* undefined if the `verticalInfo' field is */ + /* unset. */ /* */ - /* name_table :: The table of name records (`name'). */ + /* num_names :: The number of name records within this */ + /* TrueType font. */ /* */ - /* os2 :: The font's OS/2 table (`OS/2'). */ + /* name_table :: The table of name records (`name'). */ /* */ - /* postscript :: The font's PostScript table (`post' table). */ - /* The PostScript glyph names are not loaded by */ - /* the driver on face opening. See the `ttpost' */ - /* module for more details. */ + /* os2 :: The font's OS/2 table (`OS/2'). */ /* */ - /* num_charmaps :: The number of character mappings in the font. */ + /* postscript :: The font's PostScript table (`post' */ + /* table). The PostScript glyph names are */ + /* not loaded by the driver on face opening. */ + /* See the `ttpost' module for more details. */ /* */ - /* charmaps :: The array of charmap objects for this font */ - /* file. Note that this field is a typeless */ - /* pointer. The Reason is that the format of */ - /* charmaps varies with the underlying font */ - /* format and cannot be determined here. */ + /* num_charmaps :: The number of character mappings in the */ + /* font. */ /* */ - /* goto_face :: a function called by each TrueType table */ - /* loader to position a stream's cursor to the */ - /* start of a given table according to its tag. */ - /* it defaults to TT_Goto_Face but can be */ - /* different for strange formats (e.g. Type 42) */ + /* charmaps :: The array of charmap objects for this font */ + /* file. Note that this field is a typeless */ + /* pointer. The Reason is that the format of */ + /* charmaps varies with the underlying font */ + /* format and cannot be determined here. */ /* */ - /* sfnt :: a pointer to the SFNT `driver' interface. */ + /* goto_table :: A function called by each TrueType table */ + /* loader to position a stream's cursor to */ + /* the start of a given table according to */ + /* its tag. It defaults to TT_Goto_Face but */ + /* can be different for strange formats (e.g. */ + /* Type 42). */ /* */ - /* hdmx :: The face's horizontal device metrics (`hdmx' */ - /* table). This table is optional in */ - /* TrueType/OpenType fonts. */ + /* access_glyph_frame :: XXX */ /* */ - /* gasp :: The grid-fitting and scaling properties table */ - /* (`gasp'). This table is optional in */ - /* TrueType/OpenType fonts. */ + /* read_glyph_header :: XXX */ /* */ - /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */ - /* sizes, embedded in this font. */ + /* read_simple_glyph :: XXX */ /* */ - /* sbit_strikes :: An array of sbit strikes embedded in this */ - /* font. This table is optional in a */ - /* TrueType/OpenType font. */ + /* read_composite_glyph :: XXX */ /* */ - /* num_sbit_scales :: The number of sbit scales for this font. */ + /* forget_glyph_frame :: XXX */ /* */ - /* sbit_scales :: Array of sbit scales embedded in this font. */ - /* This table is optional in a TrueType/OpenType */ - /* font. */ + /* sfnt :: A pointer to the SFNT `driver' interface. */ /* */ - /* postscript_names :: A table used to store the Postscript names of */ - /* the glyphs for this font. See the file */ - /* `ttconfig.h' for comments on the */ - /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */ + /* psnames :: A pointer to the `PSNames' module */ + /* interface. */ /* */ - /* num_locations :: The number of glyph locations in this */ - /* TrueType file. This should be identical to */ - /* the number of glyphs. Ignored for Type 2 */ - /* fonts. */ + /* hdmx :: The face's horizontal device metrics */ + /* (`hdmx' table). This table is optional in */ + /* TrueType/OpenType fonts. */ /* */ - /* glyph_locations :: An array of longs. These are offsets to */ - /* glyph data within the `glyf' table. Ignored */ - /* for Type 2 font faces. */ + /* gasp :: The grid-fitting and scaling properties */ + /* table (`gasp'). This table is optional in */ + /* TrueType/OpenType fonts. */ /* */ - /* font_program_size :: Size in bytecodes of the face's font program. */ - /* 0 if none defined. Ignored for Type 2 fonts. */ + /* pclt :: XXX */ /* */ - /* font_program :: The face's font program (bytecode stream) */ - /* executed at load time, also used during glyph */ - /* rendering. Comes from the `fpgm' table. */ - /* Ignored for Type 2 font fonts. */ + /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */ + /* sizes, embedded in this font. */ /* */ - /* cvt_program_size :: Size in bytecodes of the face's cvt program. */ - /* Ignored for Type 2 fonts. */ + /* sbit_strikes :: An array of sbit strikes embedded in this */ + /* font. This table is optional in a */ + /* TrueType/OpenType font. */ /* */ - /* cvt_program :: The face's cvt program (bytecode stream) */ - /* executed each time an instance/size is */ - /* changed/reset. Comes from the `prep' table. */ - /* Ignored for Type 2 fonts. */ + /* num_sbit_scales :: The number of sbit scales for this font. */ /* */ - /* cvt_size :: Size of the control value table (in entries). */ - /* Ignored for Type 2 fonts. */ + /* sbit_scales :: Array of sbit scales embedded in this */ + /* font. This table is optional in a */ + /* TrueType/OpenType font. */ /* */ - /* cvt :: The face's original control value table. */ - /* Coordinates are expressed in unscaled font */ - /* units. Comes from the `cvt ` table. Ignored */ - /* for Type 2 fonts. */ + /* postscript_names :: A table used to store the Postscript names */ + /* of the glyphs for this font. See the */ + /* file `ttconfig.h' for comments on the */ + /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */ /* */ - /* num_kern_pairs :: The number of kerning pairs present in the */ - /* font file. The engine only loads the first */ - /* horizontal format 0 kern table it finds in */ - /* the font file. You should use the `ttxkern' */ - /* structures if you want to access other */ - /* kerning tables. Ignored for Type 2 fonts. */ + /* num_locations :: The number of glyph locations in this */ + /* TrueType file. This should be */ + /* identical to the number of glyphs. */ + /* Ignored for Type 2 fonts. */ /* */ - /* kern_table_index :: The index of the kerning table in the font */ - /* kerning directory. Only used by the ttxkern */ - /* extension to avoid data duplication. Ignored */ - /* for Type 2 fonts. */ + /* glyph_locations :: An array of longs. These are offsets to */ + /* glyph data within the `glyf' table. */ + /* Ignored for Type 2 font faces. */ /* */ - /* kern_pairs :: Array of kerning pairs, if any. Ignored for */ - /* Type 2 fonts. */ + /* font_program_size :: Size in bytecodes of the face's font */ + /* program. 0 if none defined. Ignored for */ + /* Type 2 fonts. */ /* */ - /* interpreter :: Pointer to the TrueType bytecode interpreter */ - /* this field is also used to hook the debugger */ - /* in `ttdebug' */ + /* font_program :: The face's font program (bytecode stream) */ + /* executed at load time, also used during */ + /* glyph rendering. Comes from the `fpgm' */ + /* table. Ignored for Type 2 font fonts. */ + /* */ + /* cvt_program_size :: The size in bytecodes of the face's cvt */ + /* program. Ignored for Type 2 fonts. */ + /* */ + /* cvt_program :: The face's cvt program (bytecode stream) */ + /* executed each time an instance/size is */ + /* changed/reset. Comes from the `prep' */ + /* table. Ignored for Type 2 fonts. */ + /* */ + /* cvt_size :: Size of the control value table (in */ + /* entries). Ignored for Type 2 fonts. */ + /* */ + /* cvt :: The face's original control value table. */ + /* Coordinates are expressed in unscaled font */ + /* units. Comes from the `cvt ' table. */ + /* Ignored for Type 2 fonts. */ + /* */ + /* num_kern_pairs :: The number of kerning pairs present in the */ + /* font file. The engine only loads the */ + /* first horizontal format 0 kern table it */ + /* finds in the font file. You should use */ + /* the `ttxkern' structures if you want to */ + /* access other kerning tables. Ignored */ + /* for Type 2 fonts. */ + /* */ + /* kern_table_index :: The index of the kerning table in the font */ + /* kerning directory. Only used by the */ + /* ttxkern extension to avoid data */ + /* duplication. Ignored for Type 2 fonts. */ + /* */ + /* interpreter :: A pointer to the TrueType bytecode */ + /* interpreters field is also used to hook */ + /* the debugger in `ttdebug'. */ + /* */ + /* extra :: XXX */ /* */ typedef struct TT_FaceRec_ { @@ -1331,11 +1403,7 @@ FT_Int num_charmaps; TT_CharMap charmaps; /* array of TT_CharMapRec */ - /* a pointer to the function used to seek a stream to the start of */ - /* a given TrueType table. This should default to the function */ - /* TT_Goto_Table defined in `ttload.h', but some font drivers */ - /* might need something different, e.g. Type 42 fonts */ - TT_Goto_Table_Func goto_table; + TT_Goto_Table_Func goto_table; TT_Access_Glyph_Frame_Func access_glyph_frame; TT_Load_Glyph_Element_Func read_glyph_header; @@ -1376,6 +1444,7 @@ /* postscript names table */ TT_Post_Names postscript_names; + /***********************************************************************/ /* */ /* TrueType-specific fields (ignored by the OTF-Type2 driver) */ @@ -1403,10 +1472,11 @@ FT_Int kern_table_index; TT_Kern_0_Pair* kern_pairs; - /* a pointer to the bytecode interpreter to use. This is also */ - /* used to hook the debugger for the `ttdebug' utility.. */ + /* A pointer to the bytecode interpreter to use. This is also */ + /* used to hook the debugger for the `ttdebug' utility. */ TT_Interpreter interpreter; + /***********************************************************************/ /* */ /* Other tables or fields. This is used by derivative formats like */ @@ -1419,30 +1489,35 @@ } TT_FaceRec; - - - /************************************************************************ - * - * - * TT_GlyphZone - * - * - * A glyph zone is used to load, scale and hint glyph outline - * coordinates. - * - * - * memory :: handle to memory manager - * max_points :: max size in points of zone - * max_contours :: max size in contours of zone - * n_points :: current number of points in zone - * n_contours :: current number of contours in zone - * org :: original glyph coordinates (font units/scaled) - * cur :: current glyph coordinates (scaled/hinted) - * tags :: point control tags - * contours :: contour end points - * - ***********************************************************************/ - + /*************************************************************************/ + /* */ + /* */ + /* TT_GlyphZone */ + /* */ + /* */ + /* A glyph zone is used to load, scale and hint glyph outline */ + /* coordinates. */ + /* */ + /* */ + /* memory :: A handle to the memory manager. */ + /* */ + /* max_points :: The maximal size in points of the zone. */ + /* */ + /* max_contours :: Max size in links contours of thez one. */ + /* */ + /* n_points :: The current number of points in the zone. */ + /* */ + /* n_contours :: The current number of contours in the zone. */ + /* */ + /* org :: The original glyph coordinates (font */ + /* units/scaled). */ + /* */ + /* cur :: The current glyph coordinates (scaled/hinted). */ + /* */ + /* tags :: The point control tags. */ + /* */ + /* contours :: The contours end points. */ + /* */ typedef struct TT_GlyphZone_ { FT_Memory memory; @@ -1460,43 +1535,43 @@ } TT_GlyphZone; - /* handle to execution context */ + /* handle to execution context */ typedef struct TT_ExecContextRec_* TT_ExecContext; - /* glyph loader structure */ + /* glyph loader structure */ struct TT_Loader_ { - FT_Face face; - FT_Size size; - FT_GlyphSlot glyph; - FT_GlyphLoader* gloader; + FT_Face face; + FT_Size size; + FT_GlyphSlot glyph; + FT_GlyphLoader* gloader; - FT_ULong load_flags; - FT_UInt glyph_index; + FT_ULong load_flags; + FT_UInt glyph_index; - FT_Stream stream; - FT_Int byte_len; + FT_Stream stream; + FT_Int byte_len; - FT_Short n_contours; - FT_BBox bbox; - FT_Int left_bearing; - FT_Int advance; - FT_Bool preserve_pps; - FT_Vector pp1; - FT_Vector pp2; + FT_Short n_contours; + FT_BBox bbox; + FT_Int left_bearing; + FT_Int advance; + FT_Bool preserve_pps; + FT_Vector pp1; + FT_Vector pp2; - FT_ULong glyf_offset; + FT_ULong glyf_offset; /* the zone where we load our glyphs */ - TT_GlyphZone base; - TT_GlyphZone zone; + TT_GlyphZone base; + TT_GlyphZone zone; - TT_ExecContext exec; - FT_Byte* instructions; - FT_ULong ins_pos; + TT_ExecContext exec; + FT_Byte* instructions; + FT_ULong ins_pos; /* for possible extensibility in other formats */ - void* other; + void* other; }; diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 76d037015..3557ffbdc 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -232,7 +232,7 @@ if ( error ) goto Exit; - face->root.num_faces = face->ttc_header.DirCount; + face->root.num_faces = face->ttc_header.count; if ( face->root.num_faces < 1 ) face->root.num_faces = 1; @@ -493,8 +493,8 @@ face->num_kern_pairs = 0; /* freeing the collection table */ - FREE( face->ttc_header.TableDirectory ); - face->ttc_header.DirCount = 0; + FREE( face->ttc_header.offsets ); + face->ttc_header.count = 0; /* freeing table directory */ FREE( face->dir_tables ); diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 40b2ecfa1..e7871874d 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -184,17 +184,17 @@ const FT_Frame_Field ttc_header_fields[] = { FT_FRAME_START( 8 ), - FT_FRAME_LONG( TTC_Header, version ), - FT_FRAME_LONG( TTC_Header, DirCount ), + FT_FRAME_LONG( TTC_Header, version ), + FT_FRAME_LONG( TTC_Header, count ), FT_FRAME_END }; FT_TRACE2(( "TT_Load_SFNT_Header: %08p, %ld\n", face, face_index )); - face->ttc_header.Tag = 0; + face->ttc_header.tag = 0; face->ttc_header.version = 0; - face->ttc_header.DirCount = 0; + face->ttc_header.count = 0; face->num_tables = 0; @@ -217,27 +217,27 @@ goto Exit; /* now read the offsets of each font in the file */ - if ( ALLOC_ARRAY( face->ttc_header.TableDirectory, - face->ttc_header.DirCount, - FT_ULong ) || - ACCESS_Frame( face->ttc_header.DirCount * 4L ) ) + if ( ALLOC_ARRAY( face->ttc_header.offsets, + face->ttc_header.count, + FT_ULong ) || + ACCESS_Frame( face->ttc_header.count * 4L ) ) goto Exit; - for ( n = 0; n < face->ttc_header.DirCount; n++ ) - face->ttc_header.TableDirectory[n] = GET_ULong(); + for ( n = 0; n < face->ttc_header.count; n++ ) + face->ttc_header.offsets[n] = GET_ULong(); FORGET_Frame(); /* check face index */ - if ( face_index >= face->ttc_header.DirCount ) + if ( face_index >= face->ttc_header.count ) { error = TT_Err_Bad_Argument; goto Exit; } /* seek to the appropriate TrueType file, then read tag */ - if ( FILE_Seek( face->ttc_header.TableDirectory[face_index] ) || - READ_Long( format_tag ) ) + if ( FILE_Seek( face->ttc_header.offsets[face_index] ) || + READ_Long( format_tag ) ) goto Exit; }