Formatting.

Fixing documentation.
This commit is contained in:
Werner Lemberg 2000-07-19 06:25:56 +00:00
parent c8f9cf37d3
commit e1bbc017ce
6 changed files with 540 additions and 462 deletions

View File

@ -4,11 +4,11 @@
/* */ /* */
/* OpenType error ID definitions (specification only). */ /* OpenType error ID definitions (specification only). */
/* */ /* */
/* Copyright 1996-1999 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -19,6 +19,7 @@
#ifndef T2ERRORS_H #ifndef T2ERRORS_H
#define T2ERRORS_H #define T2ERRORS_H
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Error codes declaration */ /* Error codes declaration */
@ -32,31 +33,31 @@
/* Success is always 0. */ /* Success is always 0. */
#define T2_Err_Ok FT_Err_Ok #define T2_Err_Ok FT_Err_Ok
/* High level API errors. */ /* High level API errors. */
#define T2_Err_Invalid_File_Format FT_Err_Invalid_File_Format #define T2_Err_Invalid_File_Format FT_Err_Invalid_File_Format
#define T2_Err_Invalid_Argument FT_Err_Invalid_Argument #define T2_Err_Invalid_Argument FT_Err_Invalid_Argument
#define T2_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle #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_Face_Handle FT_Err_Invalid_Face_Handle
#define T2_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_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_Glyph_Handle FT_Err_Invalid_Slot_Handle
#define T2_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_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_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. */ /* Internal errors. */
#define T2_Err_Out_Of_Memory FT_Err_Out_Of_Memory #define T2_Err_Out_Of_Memory FT_Err_Out_Of_Memory
#define T2_Err_Unlisted_Object FT_Err_Unlisted_Object #define T2_Err_Unlisted_Object FT_Err_Unlisted_Object
/* General glyph outline errors. */ /* 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. */ /* Bytecode interpreter error codes. */
@ -65,55 +66,56 @@
/* broken font file, a broken glyph within a font */ /* broken font file, a broken glyph within a font */
/* file, or a bug in the interpreter! */ /* file, or a bug in the interpreter! */
#define T2_Err_Invalid_Opcode 0x500 #define T2_Err_Invalid_Opcode 0x500
#define T2_Err_Too_Few_Arguments 0x501 #define T2_Err_Too_Few_Arguments 0x501
#define T2_Err_Stack_Overflow 0x502 #define T2_Err_Stack_Overflow 0x502
#define T2_Err_Code_Overflow 0x503 #define T2_Err_Code_Overflow 0x503
#define T2_Err_Bad_Argument 0x504 #define T2_Err_Bad_Argument 0x504
#define T2_Err_Divide_By_Zero 0x505 #define T2_Err_Divide_By_Zero 0x505
#define T2_Err_Storage_Overflow 0x506 #define T2_Err_Storage_Overflow 0x506
#define T2_Err_Cvt_Overflow 0x507 #define T2_Err_Cvt_Overflow 0x507
#define T2_Err_Invalid_Reference 0x508 #define T2_Err_Invalid_Reference 0x508
#define T2_Err_Invalid_Distance 0x509 #define T2_Err_Invalid_Distance 0x509
#define T2_Err_Interpolate_Twilight 0x50A #define T2_Err_Interpolate_Twilight 0x50A
#define T2_Err_Debug_OpCode 0x50B #define T2_Err_Debug_OpCode 0x50B
#define T2_Err_ENDF_In_Exec_Stream 0x50C #define T2_Err_ENDF_In_Exec_Stream 0x50C
#define T2_Err_Out_Of_CodeRanges 0x50D #define T2_Err_Out_Of_CodeRanges 0x50D
#define T2_Err_Nested_DEFS 0x50E #define T2_Err_Nested_DEFS 0x50E
#define T2_Err_Invalid_CodeRange 0x50F #define T2_Err_Invalid_CodeRange 0x50F
#define T2_Err_Invalid_Displacement 0x510 #define T2_Err_Invalid_Displacement 0x510
#define T2_Err_Execution_Too_Long 0x511 #define T2_Err_Execution_Too_Long 0x511
#define T2_Err_Too_Many_Instruction_Defs 0x512 #define T2_Err_Too_Many_Instruction_Defs 0x512
#define T2_Err_Too_Many_Function_Defs 0x513 #define T2_Err_Too_Many_Function_Defs 0x513
/* Other TrueType specific error codes. */ /* Other TrueType specific error codes. */
#define T2_Err_Table_Missing 0x520 #define T2_Err_Table_Missing 0x520
#define T2_Err_Too_Many_Extensions 0x521 #define T2_Err_Too_Many_Extensions 0x521
#define T2_Err_Extensions_Unsupported 0x522 #define T2_Err_Extensions_Unsupported 0x522
#define T2_Err_Invalid_Extension_Id 0x523 #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_Max_Profile_Missing 0x530
#define T2_Err_Header_Table_Missing 0x531 #define T2_Err_Header_Table_Missing 0x531
#define T2_Err_Horiz_Header_Missing 0x532 #define T2_Err_Horiz_Header_Missing 0x532
#define T2_Err_Locations_Missing 0x533 #define T2_Err_Locations_Missing 0x533
#define T2_Err_Name_Table_Missing 0x534 #define T2_Err_Name_Table_Missing 0x534
#define T2_Err_CMap_Table_Missing 0x535 #define T2_Err_CMap_Table_Missing 0x535
#define T2_Err_Hmtx_Table_Missing 0x536 #define T2_Err_Hmtx_Table_Missing 0x536
#define T2_Err_OS2_Table_Missing 0x537 #define T2_Err_OS2_Table_Missing 0x537
#define T2_Err_Post_Table_Missing 0x538 #define T2_Err_Post_Table_Missing 0x538
#define T2_Err_Invalid_Horiz_Metrics 0x540 #define T2_Err_Invalid_Horiz_Metrics 0x540
#define T2_Err_Invalid_CharMap_Format 0x541 #define T2_Err_Invalid_CharMap_Format 0x541
#define T2_Err_Invalid_PPem 0x542 #define T2_Err_Invalid_PPem 0x542
#define T2_Err_Invalid_Vert_Metrics 0x543 #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 */ /* END */

View File

@ -5,14 +5,11 @@
/* Basic OpenType/CFF type definitions and interface (specification */ /* Basic OpenType/CFF type definitions and interface (specification */
/* only). */ /* only). */
/* */ /* */
/* This code is used by the OpenType/CFF driver. */
/* */
/* */
/* Copyright 1996-2000 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -27,25 +24,29 @@
#include <freetype/freetype.h> #include <freetype/freetype.h>
/************************************************************************* /*************************************************************************/
* /* */
* <Struct> /* <Struct> */
* CFF_Index /* CFF_Index */
* /* */
* <Description> /* <Description> */
* A structure used to model a CFF Index table /* A structure used to model a CFF Index table. */
* /* */
* <Fields> /* <Fields> */
* count :: number of elements in index /* stream :: XXX */
* off_size :: size in bytes of object offsets in index /* */
* data_offset :: position of first data byte in the index's bytes /* count :: The number of elements in the index. */
* /* */
* total_size :: total_size of index in bytes /* off_size :: The size in bytes of object offsets in index. */
* bytes :: when the index is loaded in memory, its bytes /* */
* file_offset :: position of index in file. The offset table starts /* data_offset :: The position of first data byte in the index's */
* at file_offset + 3 /* bytes. */
*/ /* */
typedef struct CFF_Index_ /* offsets :: XXX */
/* */
/* bytes :: If the index is loaded in memory, its bytes. */
/* */
typedef struct CFF_Index_
{ {
FT_Stream stream; FT_Stream stream;
FT_UInt count; FT_UInt count;
@ -58,93 +59,92 @@
} CFF_Index; } CFF_Index;
typedef struct CFF_Font_Dict_ typedef struct CFF_Font_Dict_
{ {
FT_UInt version; FT_UInt version;
FT_UInt notice; FT_UInt notice;
FT_UInt copyright; FT_UInt copyright;
FT_UInt full_name; FT_UInt full_name;
FT_UInt family_name; FT_UInt family_name;
FT_UInt weight; FT_UInt weight;
FT_Bool is_fixed_pitch; FT_Bool is_fixed_pitch;
FT_Fixed italic_angle; FT_Fixed italic_angle;
FT_Pos underline_position; FT_Pos underline_position;
FT_Pos underline_thickness; FT_Pos underline_thickness;
FT_Int paint_type; FT_Int paint_type;
FT_Int charstring_type; FT_Int charstring_type;
FT_Matrix font_matrix; FT_Matrix font_matrix;
FT_ULong unique_id; FT_ULong unique_id;
FT_BBox font_bbox; FT_BBox font_bbox;
FT_Pos stroke_width; FT_Pos stroke_width;
FT_ULong charset_offset; FT_ULong charset_offset;
FT_ULong encoding_offset; FT_ULong encoding_offset;
FT_ULong charstrings_offset; FT_ULong charstrings_offset;
FT_ULong private_offset; FT_ULong private_offset;
FT_ULong private_size; FT_ULong private_size;
FT_Long synthetic_base; FT_Long synthetic_base;
FT_UInt embedded_postscript; FT_UInt embedded_postscript;
FT_UInt base_font_name; FT_UInt base_font_name;
FT_UInt postscript; FT_UInt postscript;
/* these should only be used for the top-level font dict */ /* these should only be used for the top-level font dictionary */
FT_UInt cid_registry; FT_UInt cid_registry;
FT_UInt cid_ordering; FT_UInt cid_ordering;
FT_ULong cid_supplement; FT_ULong cid_supplement;
FT_Long cid_font_version; FT_Long cid_font_version;
FT_Long cid_font_revision; FT_Long cid_font_revision;
FT_Long cid_font_type; FT_Long cid_font_type;
FT_Long cid_count; FT_Long cid_count;
FT_ULong cid_uid_base; FT_ULong cid_uid_base;
FT_ULong cid_fd_array_offset; FT_ULong cid_fd_array_offset;
FT_ULong cid_fd_select_offset; FT_ULong cid_fd_select_offset;
FT_UInt cid_font_name; FT_UInt cid_font_name;
} CFF_Font_Dict; } CFF_Font_Dict;
typedef struct CFF_Private_
typedef struct CFF_Private_
{ {
FT_Byte num_blue_values; FT_Byte num_blue_values;
FT_Byte num_other_blues; FT_Byte num_other_blues;
FT_Byte num_family_blues; FT_Byte num_family_blues;
FT_Byte num_family_other_blues; FT_Byte num_family_other_blues;
FT_Pos blue_values[14]; FT_Pos blue_values[14];
FT_Pos other_blues[10]; FT_Pos other_blues[10];
FT_Pos family_blues[14]; FT_Pos family_blues[14];
FT_Pos family_other_blues[10]; FT_Pos family_other_blues[10];
FT_Fixed blue_scale; FT_Fixed blue_scale;
FT_Pos blue_shift; FT_Pos blue_shift;
FT_Pos blue_fuzz; FT_Pos blue_fuzz;
FT_Pos standard_width; FT_Pos standard_width;
FT_Pos standard_height; FT_Pos standard_height;
FT_Byte num_snap_widths; FT_Byte num_snap_widths;
FT_Byte num_snap_heights; FT_Byte num_snap_heights;
FT_Pos snap_widths[13]; FT_Pos snap_widths[13];
FT_Pos snap_heights[13]; FT_Pos snap_heights[13];
FT_Bool force_bold; FT_Bool force_bold;
FT_Fixed force_bold_threshold; FT_Fixed force_bold_threshold;
FT_Int lenIV; FT_Int lenIV;
FT_Int language_group; FT_Int language_group;
FT_Fixed expansion_factor; FT_Fixed expansion_factor;
FT_Long initial_random_seed; FT_Long initial_random_seed;
FT_ULong local_subrs_offset; FT_ULong local_subrs_offset;
FT_Pos default_width; FT_Pos default_width;
FT_Pos nominal_width; FT_Pos nominal_width;
} CFF_Private; } CFF_Private;
typedef struct CFF_FD_Select_ typedef struct CFF_FD_Select_
{ {
FT_Byte format; FT_Byte format;
FT_UInt range_count; 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_Byte* data;
FT_UInt data_size; FT_UInt data_size;
@ -156,10 +156,9 @@
} CFF_FD_Select; } CFF_FD_Select;
/* A SubFont packs a font dict and a private dict together. They are */
/* a SubFont packs a font dict and a private dict together. They're */ /* needed to support CID-keyed CFF fonts. */
/* needed to support CID-keyde CFF fonts.. */ typedef struct CFF_SubFont_
typedef struct CFF_SubFont_
{ {
CFF_Font_Dict font_dict; CFF_Font_Dict font_dict;
CFF_Private private_dict; CFF_Private private_dict;
@ -174,30 +173,31 @@
/* maximum number of sub-fonts in a CID-keyed file */ /* maximum number of sub-fonts in a CID-keyed file */
#define CFF_MAX_CID_FONTS 16 #define CFF_MAX_CID_FONTS 16
typedef struct CFF_Font_
typedef struct CFF_Font_
{ {
FT_Stream stream; FT_Stream stream;
FT_Memory memory; FT_Memory memory;
FT_UInt num_faces; FT_UInt num_faces;
FT_UInt num_glyphs; FT_UInt num_glyphs;
FT_Byte version_major; FT_Byte version_major;
FT_Byte version_minor; FT_Byte version_minor;
FT_Byte header_size; FT_Byte header_size;
FT_Byte absolute_offsize; FT_Byte absolute_offsize;
CFF_Index name_index; CFF_Index name_index;
CFF_Index top_dict_index; CFF_Index top_dict_index;
CFF_Index string_index; CFF_Index string_index;
CFF_Index global_subrs_index; CFF_Index global_subrs_index;
/* we don't load the Encoding and CharSet tables */ /* we don't load the Encoding and CharSet tables */
CFF_Index charstrings_index; CFF_Index charstrings_index;
CFF_Index font_dict_index; CFF_Index font_dict_index;
CFF_Index private_index; CFF_Index private_index;
CFF_Index local_subrs_index; CFF_Index local_subrs_index;
FT_String* font_name; FT_String* font_name;
FT_UInt num_global_subrs; FT_UInt num_global_subrs;
@ -205,7 +205,7 @@
CFF_SubFont top_font; CFF_SubFont top_font;
FT_UInt num_subfonts; FT_UInt num_subfonts;
CFF_SubFont* subfonts[ CFF_MAX_CID_FONTS ]; CFF_SubFont* subfonts[CFF_MAX_CID_FONTS];
CFF_FD_Select fd_select; CFF_FD_Select fd_select;

View File

@ -7,8 +7,8 @@
/* Copyright 1996-2000 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -33,32 +33,32 @@
/* Success is always 0. */ /* Success is always 0. */
#define TT_Err_Ok FT_Err_Ok #define TT_Err_Ok FT_Err_Ok
/* High level API errors. */ /* High level API errors. */
#define TT_Err_Invalid_File_Format FT_Err_Invalid_File_Format #define TT_Err_Invalid_File_Format FT_Err_Invalid_File_Format
#define TT_Err_Invalid_Argument FT_Err_Invalid_Argument #define TT_Err_Invalid_Argument FT_Err_Invalid_Argument
#define TT_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle #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_Face_Handle FT_Err_Invalid_Face_Handle
#define TT_Err_Invalid_Instance_Handle FT_Err_Invalid_Size_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_Glyph_Handle FT_Err_Invalid_Slot_Handle
#define TT_Err_Invalid_CharMap_Handle FT_Err_Invalid_CharMap_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_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. */ /* Internal errors. */
#define TT_Err_Out_Of_Memory FT_Err_Out_Of_Memory #define TT_Err_Out_Of_Memory FT_Err_Out_Of_Memory
#define TT_Err_Unlisted_Object FT_Err_Unlisted_Object #define TT_Err_Unlisted_Object FT_Err_Unlisted_Object
/* General glyph outline errors. */ /* General glyph outline errors. */
#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints #define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints
#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite #define TT_Err_Invalid_Composite FT_Err_Invalid_Composite
/* Bytecode interpreter error codes. */ /* Bytecode interpreter error codes. */
@ -90,31 +90,32 @@
/* Other TrueType specific error codes. */ /* Other TrueType specific error codes. */
#define TT_Err_Table_Missing 0x420 #define TT_Err_Table_Missing 0x420
#define TT_Err_Too_Many_Extensions 0x421 #define TT_Err_Too_Many_Extensions 0x421
#define TT_Err_Extensions_Unsupported 0x422 #define TT_Err_Extensions_Unsupported 0x422
#define TT_Err_Invalid_Extension_Id 0x423 #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_Max_Profile_Missing 0x430
#define TT_Err_Header_Table_Missing 0x431 #define TT_Err_Header_Table_Missing 0x431
#define TT_Err_Horiz_Header_Missing 0x432 #define TT_Err_Horiz_Header_Missing 0x432
#define TT_Err_Locations_Missing 0x433 #define TT_Err_Locations_Missing 0x433
#define TT_Err_Name_Table_Missing 0x434 #define TT_Err_Name_Table_Missing 0x434
#define TT_Err_CMap_Table_Missing 0x435 #define TT_Err_CMap_Table_Missing 0x435
#define TT_Err_Hmtx_Table_Missing 0x436 #define TT_Err_Hmtx_Table_Missing 0x436
#define TT_Err_OS2_Table_Missing 0x437 #define TT_Err_OS2_Table_Missing 0x437
#define TT_Err_Post_Table_Missing 0x438 #define TT_Err_Post_Table_Missing 0x438
#define TT_Err_Invalid_Horiz_Metrics 0x440 #define TT_Err_Invalid_Horiz_Metrics 0x440
#define TT_Err_Invalid_CharMap_Format 0x441 #define TT_Err_Invalid_CharMap_Format 0x441
#define TT_Err_Invalid_PPem 0x442 #define TT_Err_Invalid_PPem 0x442
#define TT_Err_Invalid_Vert_Metrics 0x443 #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 */ /* END */

View File

@ -5,14 +5,11 @@
/* Basic SFNT/TrueType type definitions and interface (specification */ /* Basic SFNT/TrueType type definitions and interface (specification */
/* only). */ /* only). */
/* */ /* */
/* This code is shared by all TrueType and OpenType drivers. */
/* */
/* */
/* Copyright 1996-2000 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
@ -51,19 +48,22 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* tag :: Must be `ttc ' to indicate a TrueType collection. */ /* tag :: Must be `ttc ' to indicate a TrueType collection. */
/* */
/* version :: The version number. */ /* version :: The version number. */
/* */
/* count :: The number of faces in the collection. The */ /* count :: The number of faces in the collection. The */
/* specification says this should be an unsigned long, but */ /* specification says this should be an unsigned long, but */
/* we use a signed long since we need the value -1 for */ /* we use a signed long since we need the value -1 for */
/* specific purposes. */ /* specific purposes. */
/* */
/* offsets :: The offsets of the font headers, one per face. */ /* offsets :: The offsets of the font headers, one per face. */
/* */ /* */
typedef struct TTC_Header_ typedef struct TTC_Header_
{ {
FT_ULong Tag; FT_ULong tag;
FT_Fixed version; FT_Fixed version;
FT_Long DirCount; FT_Long count;
FT_ULong* TableDirectory; FT_ULong* offsets;
} TTC_Header; } TTC_Header;
@ -77,11 +77,15 @@
/* SFNT file format header. */ /* SFNT file format header. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* format_tag :: font format tag.. */ /* format_tag :: The font format tag. */
/* num_tables :: number of tables in file */ /* */
/* search_range :: must be 16*(max power of 2 <= num_tables) */ /* num_tables :: The number of tables in file. */
/* entry_selector :: log2 of search_range/16 */ /* */
/* range_shift :: must be num_tables*16 - search_range */ /* 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_ typedef struct SFNT_Header_
{ {
@ -93,6 +97,7 @@
} SFNT_Header; } SFNT_Header;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
@ -104,10 +109,13 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* version :: The version number; starts with 0x00010000. */ /* version :: The version number; starts with 0x00010000. */
/* */
/* numTables :: The number of tables. */ /* numTables :: The number of tables. */
/* */ /* */
/* searchRange :: Unused. */ /* searchRange :: Unused. */
/* */
/* entrySelector :: Unused. */ /* entrySelector :: Unused. */
/* */
/* rangeShift :: Unused. */ /* rangeShift :: Unused. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -115,8 +123,8 @@
/* */ /* */
typedef struct TT_TableDir_ typedef struct TT_TableDir_
{ {
FT_Fixed version; /* should be 0x10000 */ FT_Fixed version; /* should be 0x10000 */
FT_UShort numTables; /* number of tables */ FT_UShort numTables; /* number of tables */
FT_UShort searchRange; /* These parameters are only used */ FT_UShort searchRange; /* These parameters are only used */
FT_UShort entrySelector; /* for a dichotomy search in the */ FT_UShort entrySelector; /* for a dichotomy search in the */
@ -135,9 +143,12 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* Tag :: A four-bytes tag describing the table. */ /* Tag :: A four-bytes tag describing the table. */
/* */
/* CheckSum :: The table checksum. This value can be ignored. */ /* CheckSum :: The table checksum. This value can be ignored. */
/* */
/* Offset :: The offset of the table from the start of the TrueType */ /* Offset :: The offset of the table from the start of the TrueType */
/* font in its resource. */ /* font in its resource. */
/* */
/* Length :: The table length (in bytes). */ /* Length :: The table length (in bytes). */
/* */ /* */
typedef struct TT_Table_ typedef struct TT_Table_
@ -161,6 +172,7 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* tableVersionNumber :: The version number. */ /* tableVersionNumber :: The version number. */
/* */
/* numCMaps :: The number of charmaps in the font. */ /* numCMaps :: The number of charmaps in the font. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -189,7 +201,7 @@
/* encodingID :: A platform-specific ID used to indicate which source */ /* encodingID :: A platform-specific ID used to indicate which source */
/* encoding is used in this charmap. */ /* 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. */ /* the `cmap' table. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -215,6 +227,7 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* advance :: The advance width or height for the glyph. */ /* advance :: The advance width or height for the glyph. */
/* */
/* bearing :: The left-side or top-side bearing for the glyph. */ /* bearing :: The left-side or top-side bearing for the glyph. */
/* */ /* */
typedef struct TT_LongMetrics_ typedef struct TT_LongMetrics_
@ -362,7 +375,9 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* version :: The version number. */ /* version :: The version number. */
/* */
/* numRanges :: The number of gasp ranges in table. */ /* numRanges :: The number of gasp ranges in table. */
/* */
/* gaspRanges :: An array of gasp ranges. */ /* gaspRanges :: An array of gasp ranges. */
/* */ /* */
typedef struct TT_Gasp_ typedef struct TT_Gasp_
@ -381,7 +396,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A small structure used to model the pre-computed widths of a given */ /* 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. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* ppem :: The pixels per EM value at which these metrics apply. */ /* ppem :: The pixels per EM value at which these metrics apply. */
@ -402,7 +417,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
/* TT_HdmxRec */ /* TT_Hdmx */
/* */ /* */
/* <Description> */ /* <Description> */
/* A structure used to model the `hdmx' table, which contains */ /* A structure used to model the `hdmx' table, which contains */
@ -410,7 +425,9 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* version :: The version number. */ /* version :: The version number. */
/* */
/* num_records :: The number of hdmx records. */ /* num_records :: The number of hdmx records. */
/* */
/* records :: An array of hdmx records. */ /* records :: An array of hdmx records. */
/* */ /* */
typedef struct TT_Hdmx_ typedef struct TT_Hdmx_
@ -434,7 +451,9 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* left :: The index of the left glyph in pair. */ /* left :: The index of the left glyph in pair. */
/* */
/* right :: The index of the right glyph in pair. */ /* right :: The index of the right glyph in pair. */
/* */
/* value :: The kerning distance. A positive value spaces the */ /* value :: The kerning distance. A positive value spaces the */
/* glyphs, a negative one makes them closer. */ /* glyphs, a negative one makes them closer. */
/* */ /* */
@ -446,18 +465,20 @@
} TT_Kern_0_Pair; } TT_Kern_0_Pair;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*** ***/ /*** ***/
/*** ***/ /*** ***/
/*** EMBEDDED BITMAPS SUPPORT ***/ /*** EMBEDDED BITMAPS SUPPORT ***/
/*** ***/ /*** ***/
/*** ***/ /*** ***/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
@ -512,15 +533,15 @@
/* `EBDT' (Microsoft) or the `bdat' (Apple) table. */ /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* 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_ typedef struct TT_SBit_Small_Metrics_
{ {
@ -582,6 +603,9 @@
/* */ /* */
/* vertBearingX - width */ /* vertBearingX - width */
/* */ /* */
/* pads :: Unused (to make the size of the record */
/* a multiple of 32 bits. */
/* */
typedef struct TT_SBit_Line_Metrics_ typedef struct TT_SBit_Line_Metrics_
{ {
FT_Char ascender; FT_Char ascender;
@ -692,23 +716,23 @@
/* */ /* */
typedef struct TT_SBit_Strike_ typedef struct TT_SBit_Strike_
{ {
FT_Int num_ranges; FT_Int num_ranges;
TT_SBit_Range* sbit_ranges; TT_SBit_Range* sbit_ranges;
FT_ULong ranges_offset; FT_ULong ranges_offset;
FT_ULong color_ref; FT_ULong color_ref;
TT_SBit_Line_Metrics hori; TT_SBit_Line_Metrics hori;
TT_SBit_Line_Metrics vert; TT_SBit_Line_Metrics vert;
FT_UShort start_glyph; FT_UShort start_glyph;
FT_UShort end_glyph; FT_UShort end_glyph;
FT_Byte x_ppem; FT_Byte x_ppem;
FT_Byte y_ppem; FT_Byte y_ppem;
FT_Byte bit_depth; FT_Byte bit_depth;
FT_Char flags; FT_Char flags;
} TT_SBit_Strike; } TT_SBit_Strike;
@ -723,7 +747,9 @@
/* */ /* */
/* <Fields> */ /* <Fields> */
/* glyph_code :: The element's glyph index. */ /* glyph_code :: The element's glyph index. */
/* */
/* x_offset :: The element's left bearing. */ /* x_offset :: The element's left bearing. */
/* */
/* y_offset :: The element's top bearing. */ /* y_offset :: The element's top bearing. */
/* */ /* */
typedef struct TT_SBit_Component_ typedef struct TT_SBit_Component_
@ -771,6 +797,7 @@
} TT_SBit_Scale; } TT_SBit_Scale;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -783,6 +810,7 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
@ -862,6 +890,7 @@
} TT_Post_Names; } TT_Post_Names;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -874,7 +903,9 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* format 0 */ /* format 0 */
typedef struct TT_CMap0_ typedef struct TT_CMap0_
{ {
FT_Byte* glyphIdArray; FT_Byte* glyphIdArray;
@ -883,6 +914,7 @@
/* format 2 */ /* format 2 */
typedef struct TT_CMap2SubHeader_ typedef struct TT_CMap2SubHeader_
{ {
FT_UShort firstCode; /* first valid low byte */ FT_UShort firstCode; /* first valid low byte */
@ -895,7 +927,7 @@
typedef struct TT_CMap2_ typedef struct TT_CMap2_
{ {
FT_UShort* subHeaderKeys; FT_UShort* subHeaderKeys;
/* high byte mapping table */ /* high byte mapping table */
/* value = subHeader index * 8 */ /* value = subHeader index * 8 */
@ -907,6 +939,7 @@
/* format 4 */ /* format 4 */
typedef struct TT_CMap4Segment_ typedef struct TT_CMap4Segment_
{ {
FT_UShort endCount; FT_UShort endCount;
@ -919,21 +952,22 @@
typedef struct TT_CMap4_ typedef struct TT_CMap4_
{ {
FT_UShort segCountX2; /* number of segments * 2 */ FT_UShort segCountX2; /* number of segments * 2 */
FT_UShort searchRange; /* these parameters can be used */ FT_UShort searchRange; /* these parameters can be used */
FT_UShort entrySelector; /* for a binary search */ FT_UShort entrySelector; /* for a binary search */
FT_UShort rangeShift; FT_UShort rangeShift;
TT_CMap4Segment* segments; TT_CMap4Segment* segments;
FT_UShort* glyphIdArray; FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */ 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 */ /* cache to potentially increase speed */
} TT_CMap4; } TT_CMap4;
/* format 6 */ /* format 6 */
typedef struct TT_CMap6_ typedef struct TT_CMap6_
{ {
FT_UShort firstCode; /* first character code of subrange */ FT_UShort firstCode; /* first character code of subrange */
@ -943,12 +977,15 @@
} TT_CMap6; } TT_CMap6;
typedef struct TT_CMapTable_ TT_CMapTable; typedef struct TT_CMapTable_ TT_CMapTable;
typedef typedef
FT_UInt (*TT_CharMap_Func)( TT_CMapTable* charmap, FT_UInt (*TT_CharMap_Func)( TT_CMapTable* charmap,
FT_ULong char_code ); FT_ULong char_code );
/* charmap table */ /* charmap table */
struct TT_CMapTable_ struct TT_CMapTable_
{ {
@ -979,16 +1016,17 @@
/* TT_CharMapRec */ /* TT_CharMapRec */
/* */ /* */
/* <Description> */ /* <Description> */
/* The TrueType character map object type. */ /* The TrueType character map object type. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* root :: The parent character map structure. */ /* root :: The parent character map structure. */
/* */
/* cmap :: The used character map. */ /* cmap :: The used character map. */
/* */ /* */
typedef struct TT_CharMapRec_ typedef struct TT_CharMapRec_
{ {
FT_CharMapRec root; FT_CharMapRec root;
TT_CMapTable cmap; TT_CMapTable cmap;
} TT_CharMapRec; } TT_CharMapRec;
@ -1011,12 +1049,13 @@
/* This structure/class is defined here because it is common to the */ /* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */ /* 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 */ /* are not shared between font drivers, and are thus defined normally in */
/* `drivers/truetype/ttobjs.h'. */ /* `ttobjs.h'. */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Type> */ /* <Type> */
@ -1031,7 +1070,7 @@
/* The TT_Face structure is also used as a `parent class' for the */ /* The TT_Face structure is also used as a `parent class' for the */
/* OpenType-CFF class (T2_Face). */ /* OpenType-CFF class (T2_Face). */
/* */ /* */
typedef struct TT_FaceRec_* TT_Face; typedef struct TT_FaceRec_* TT_Face;
/*************************************************************************/ /*************************************************************************/
@ -1051,6 +1090,7 @@
/* forward declaration */ /* forward declaration */
typedef struct TT_Loader_ TT_Loader; typedef struct TT_Loader_ TT_Loader;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <FuncType> */ /* <FuncType> */
@ -1060,86 +1100,96 @@
/* Seeks a stream to the start of a given TrueType table. */ /* Seeks a stream to the start of a given TrueType table. */
/* */ /* */
/* <Input> */ /* <Input> */
/* face :: A handle to the target face object. */ /* face :: A handle to the target face object. */
/* tag :: a 4-byte tag used to name the table */ /* */
/* stream :: The input stream. */ /* tag :: A 4-byte tag used to name the table. */
/* */
/* stream :: The input stream. */
/* */ /* */
/* <Output> */ /* <Output> */
/* 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. */
/* */ /* */
/* <Return> */ /* <Return> */
/* TrueType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
/* <Note> */ /* <Note> */
/* The stream cursor must be at the font file's origin */ /* The stream cursor must be at the font file's origin. */
/* */ /* */
typedef typedef
FT_Error (*TT_Goto_Table_Func)( TT_Face face, FT_Error (*TT_Goto_Table_Func)( TT_Face face,
FT_ULong tag, FT_ULong tag,
FT_Stream stream, FT_Stream stream,
FT_ULong *length ); FT_ULong* length );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <FuncType> */ /* <FuncType> */
/* TT_Access_Glyph_Frame */ /* TT_Access_Glyph_Frame_Func */
/* */ /* */
/* <Description> */ /* <Description> */
/* Seeks a stream to the start of a given glyph element, and */ /* Seeks a stream to the start of a given glyph element, and opens a */
/* opens a frame for it.. */ /* frame for it. */
/* */ /* */
/* <Input> */ /* <Input> */
/* loader :: the current TrueType glyph loader object */ /* loader :: The current TrueType glyph loader object. */
/* glyph index :: index of glyph to access */ /* */
/* offset :: offset of glyph according to locations table */ /* glyph index :: The index of the glyph to access. */
/* byte_count :: size of frame in bytes */ /* */
/* offset :: The offset of the glyph according to the */
/* `locations' table. */
/* */
/* byte_count :: The size of the frame in bytes. */
/* */ /* */
/* <Return> */ /* <Return> */
/* TrueType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
/* <Note> */ /* <Note> */
/* This function is normally equivalent to FILE_Seek(offset) */ /* This function is normally equivalent to FILE_Seek(offset) */
/* followed by ACCESS_Frame(byte_count) with the loader's stream */ /* followed by ACCESS_Frame(byte_count) with the loader's stream, but */
/* but alternative formats (compressed ones) might use something */ /* alternative formats (e.g. compressed ones) might use something */
/* different.. */ /* different. */
/* */ /* */
typedef typedef
FT_Error (*TT_Access_Glyph_Frame_Func)( TT_Loader* loader, FT_Error (*TT_Access_Glyph_Frame_Func)( TT_Loader* loader,
FT_UInt glyph_index, FT_UInt glyph_index,
FT_ULong offset, FT_ULong offset,
FT_UInt byte_count ); FT_UInt byte_count );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <FuncType> */ /* <FuncType> */
/* TT_Load_Glyph_Element */ /* TT_Load_Glyph_Element_Func */
/* */ /* */
/* <Description> */ /* <Description> */
/* Reads one glyph element (its header, a simple glyph, or a */ /* 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. */
/* */ /* */
/* <Input> */ /* <Input> */
/* loader :: the current TrueType glyph loader object */ /* loader :: The current TrueType glyph loader object. */
/* */ /* */
/* <Return> */ /* <Return> */
/* TrueType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
typedef typedef
FT_Error (*TT_Load_Glyph_Element_Func)( TT_Loader* loader ); FT_Error (*TT_Load_Glyph_Element_Func)( TT_Loader* loader );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <FuncType> */ /* <FuncType> */
/* TT_Forget_Frame_Element */ /* TT_Forget_Glyph_Frame_Func */
/* */ /* */
/* <Description> */ /* <Description> */
/* Closes the current loader stream frame for the glyph.. */ /* Closes the current loader stream frame for the glyph. */
/* */ /* */
/* <Input> */ /* <Input> */
/* loader :: the current TrueType glyph loader object */ /* loader :: The current TrueType glyph loader object. */
/* */ /* */
typedef 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. */ /* point-size independent data found in a TrueType font file. */
/* */ /* */
/* <Fields> */ /* <Fields> */
/* root :: The base FT_Face structure, managed by the */ /* root :: The base FT_Face structure, managed by the */
/* base layer. */ /* base layer. */
/* */ /* */
/* ttcHeader :: The TrueType collection header, used when the */ /* ttc_header :: The TrueType collection header, used when */
/* file is a `ttc' rather than a `ttf'. For */ /* the file is a `ttc' rather than a `ttf'. */
/* ordinary font files, the field */ /* For ordinary font files, the field */
/* `ttcHeader.DirCount' is set to 0. */ /* `ttc_header.count' is set to 0. */
/* */ /* */
/* num_tables :: The number of TrueType tables in this font */ /* format_tag :: The font format tag. */
/* file. */
/* */ /* */
/* dir_tables :: The directory of TrueType tables for this */ /* num_tables :: The number of TrueType tables in this font */
/* font file. */ /* file. */
/* */ /* */
/* header :: The font's font header (`head' table). Read */ /* dir_tables :: The directory of TrueType tables for this */
/* on font opening. */ /* font file. */
/* */ /* */
/* horizontal :: The font's horizontal header (`hhea' table). */ /* header :: The font's font header (`head' table). */
/* This field also contains the associated */ /* Read on font opening. */
/* horizontal metrics table (`hmtx'). */
/* */ /* */
/* max_profile :: The font's maximum profile table. Read on */ /* horizontal :: The font's horizontal header (`hhea' */
/* font opening. Note that some maximum values */ /* table). This field also contains the */
/* cannot be taken directly from this table. We */ /* associated horizontal metrics table */
/* thus define additional fields below to hold */ /* (`hmtx'). */
/* the computed maxima. */
/* */ /* */
/* max_components :: The maximum number of glyph components */ /* max_profile :: The font's maximum profile table. Read on */
/* required to load any composite glyph from */ /* font opening. Note that some maximum */
/* this font. Used to size the load stack. */ /* 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 */ /* max_components :: The maximum number of glyph components */
/* contains vertical metrics. If not, the value */ /* required to load any composite glyph from */
/* of the `vertical' field is undefined. */ /* this font. Used to size the load stack. */
/* */ /* */
/* vertical :: The font's vertical header (`vhea' table). */ /* vertical_info :: A boolean which is set when the font file */
/* This field also contains the associated */ /* contains vertical metrics. If not, the */
/* vertical metrics table (`vmtx'), if found. */ /* value of the `vertical' field is */
/* IMPORTANT: The contents of this field is */ /* undefined. */
/* undefined if the `verticalInfo' field is */
/* unset. */
/* */ /* */
/* num_names :: The number of name records within this */ /* vertical :: The font's vertical header (`vhea' table). */
/* TrueType font. */ /* 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). */ /* os2 :: The font's OS/2 table (`OS/2'). */
/* The PostScript glyph names are not loaded by */
/* the driver on face opening. See the `ttpost' */
/* module for more details. */
/* */ /* */
/* 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 */ /* num_charmaps :: The number of character mappings in the */
/* file. Note that this field is a typeless */ /* font. */
/* pointer. The Reason is that the format of */
/* charmaps varies with the underlying font */
/* format and cannot be determined here. */
/* */ /* */
/* goto_face :: a function called by each TrueType table */ /* charmaps :: The array of charmap objects for this font */
/* loader to position a stream's cursor to the */ /* file. Note that this field is a typeless */
/* start of a given table according to its tag. */ /* pointer. The Reason is that the format of */
/* it defaults to TT_Goto_Face but can be */ /* charmaps varies with the underlying font */
/* different for strange formats (e.g. Type 42) */ /* 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' */ /* access_glyph_frame :: XXX */
/* table). This table is optional in */
/* TrueType/OpenType fonts. */
/* */ /* */
/* gasp :: The grid-fitting and scaling properties table */ /* read_glyph_header :: XXX */
/* (`gasp'). This table is optional in */
/* TrueType/OpenType fonts. */
/* */ /* */
/* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */ /* read_simple_glyph :: XXX */
/* sizes, embedded in this font. */
/* */ /* */
/* sbit_strikes :: An array of sbit strikes embedded in this */ /* read_composite_glyph :: XXX */
/* font. This table is optional in a */
/* TrueType/OpenType font. */
/* */ /* */
/* 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. */ /* sfnt :: A pointer to the SFNT `driver' interface. */
/* This table is optional in a TrueType/OpenType */
/* font. */
/* */ /* */
/* postscript_names :: A table used to store the Postscript names of */ /* psnames :: A pointer to the `PSNames' module */
/* the glyphs for this font. See the file */ /* interface. */
/* `ttconfig.h' for comments on the */
/* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
/* */ /* */
/* num_locations :: The number of glyph locations in this */ /* hdmx :: The face's horizontal device metrics */
/* TrueType file. This should be identical to */ /* (`hdmx' table). This table is optional in */
/* the number of glyphs. Ignored for Type 2 */ /* TrueType/OpenType fonts. */
/* fonts. */
/* */ /* */
/* glyph_locations :: An array of longs. These are offsets to */ /* gasp :: The grid-fitting and scaling properties */
/* glyph data within the `glyf' table. Ignored */ /* table (`gasp'). This table is optional in */
/* for Type 2 font faces. */ /* TrueType/OpenType fonts. */
/* */ /* */
/* font_program_size :: Size in bytecodes of the face's font program. */ /* pclt :: XXX */
/* 0 if none defined. Ignored for Type 2 fonts. */
/* */ /* */
/* font_program :: The face's font program (bytecode stream) */ /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */
/* executed at load time, also used during glyph */ /* sizes, embedded in this font. */
/* rendering. Comes from the `fpgm' table. */
/* Ignored for Type 2 font fonts. */
/* */ /* */
/* cvt_program_size :: Size in bytecodes of the face's cvt program. */ /* sbit_strikes :: An array of sbit strikes embedded in this */
/* Ignored for Type 2 fonts. */ /* font. This table is optional in a */
/* TrueType/OpenType font. */
/* */ /* */
/* cvt_program :: The face's cvt program (bytecode stream) */ /* num_sbit_scales :: The number of sbit scales for this font. */
/* 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). */ /* sbit_scales :: Array of sbit scales embedded in this */
/* Ignored for Type 2 fonts. */ /* font. This table is optional in a */
/* TrueType/OpenType font. */
/* */ /* */
/* cvt :: The face's original control value table. */ /* postscript_names :: A table used to store the Postscript names */
/* Coordinates are expressed in unscaled font */ /* of the glyphs for this font. See the */
/* units. Comes from the `cvt ` table. Ignored */ /* file `ttconfig.h' for comments on the */
/* for Type 2 fonts. */ /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
/* */ /* */
/* num_kern_pairs :: The number of kerning pairs present in the */ /* num_locations :: The number of glyph locations in this */
/* font file. The engine only loads the first */ /* TrueType file. This should be */
/* horizontal format 0 kern table it finds in */ /* identical to the number of glyphs. */
/* the font file. You should use the `ttxkern' */ /* Ignored for Type 2 fonts. */
/* 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 */ /* glyph_locations :: An array of longs. These are offsets to */
/* kerning directory. Only used by the ttxkern */ /* glyph data within the `glyf' table. */
/* extension to avoid data duplication. Ignored */ /* Ignored for Type 2 font faces. */
/* for Type 2 fonts. */
/* */ /* */
/* kern_pairs :: Array of kerning pairs, if any. Ignored for */ /* font_program_size :: Size in bytecodes of the face's font */
/* Type 2 fonts. */ /* program. 0 if none defined. Ignored for */
/* Type 2 fonts. */
/* */ /* */
/* interpreter :: Pointer to the TrueType bytecode interpreter */ /* font_program :: The face's font program (bytecode stream) */
/* this field is also used to hook the debugger */ /* executed at load time, also used during */
/* in `ttdebug' */ /* 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_ typedef struct TT_FaceRec_
{ {
@ -1331,11 +1403,7 @@
FT_Int num_charmaps; FT_Int num_charmaps;
TT_CharMap charmaps; /* array of TT_CharMapRec */ TT_CharMap charmaps; /* array of TT_CharMapRec */
/* a pointer to the function used to seek a stream to the start of */ TT_Goto_Table_Func goto_table;
/* 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_Access_Glyph_Frame_Func access_glyph_frame; TT_Access_Glyph_Frame_Func access_glyph_frame;
TT_Load_Glyph_Element_Func read_glyph_header; TT_Load_Glyph_Element_Func read_glyph_header;
@ -1376,6 +1444,7 @@
/* postscript names table */ /* postscript names table */
TT_Post_Names postscript_names; TT_Post_Names postscript_names;
/***********************************************************************/ /***********************************************************************/
/* */ /* */
/* TrueType-specific fields (ignored by the OTF-Type2 driver) */ /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
@ -1403,10 +1472,11 @@
FT_Int kern_table_index; FT_Int kern_table_index;
TT_Kern_0_Pair* kern_pairs; TT_Kern_0_Pair* kern_pairs;
/* a pointer to the bytecode interpreter to use. This is also */ /* A pointer to the bytecode interpreter to use. This is also */
/* used to hook the debugger for the `ttdebug' utility.. */ /* used to hook the debugger for the `ttdebug' utility. */
TT_Interpreter interpreter; TT_Interpreter interpreter;
/***********************************************************************/ /***********************************************************************/
/* */ /* */
/* Other tables or fields. This is used by derivative formats like */ /* Other tables or fields. This is used by derivative formats like */
@ -1419,30 +1489,35 @@
} TT_FaceRec; } TT_FaceRec;
/*************************************************************************/
/* */
/************************************************************************ /* <Struct> */
* /* TT_GlyphZone */
* <Struct> /* */
* TT_GlyphZone /* <Description> */
* /* A glyph zone is used to load, scale and hint glyph outline */
* <Description> /* coordinates. */
* A glyph zone is used to load, scale and hint glyph outline /* */
* coordinates. /* <Fields> */
* /* memory :: A handle to the memory manager. */
* <Fields> /* */
* memory :: handle to memory manager /* max_points :: The maximal size in points of the zone. */
* max_points :: max size in points of zone /* */
* max_contours :: max size in contours of zone /* max_contours :: Max size in links contours of thez one. */
* n_points :: current number of points in zone /* */
* n_contours :: current number of contours in zone /* n_points :: The current number of points in the zone. */
* org :: original glyph coordinates (font units/scaled) /* */
* cur :: current glyph coordinates (scaled/hinted) /* n_contours :: The current number of contours in the zone. */
* tags :: point control tags /* */
* contours :: contour end points /* 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_ typedef struct TT_GlyphZone_
{ {
FT_Memory memory; FT_Memory memory;
@ -1460,43 +1535,43 @@
} TT_GlyphZone; } TT_GlyphZone;
/* handle to execution context */ /* handle to execution context */
typedef struct TT_ExecContextRec_* TT_ExecContext; typedef struct TT_ExecContextRec_* TT_ExecContext;
/* glyph loader structure */ /* glyph loader structure */
struct TT_Loader_ struct TT_Loader_
{ {
FT_Face face; FT_Face face;
FT_Size size; FT_Size size;
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
FT_GlyphLoader* gloader; FT_GlyphLoader* gloader;
FT_ULong load_flags; FT_ULong load_flags;
FT_UInt glyph_index; FT_UInt glyph_index;
FT_Stream stream; FT_Stream stream;
FT_Int byte_len; FT_Int byte_len;
FT_Short n_contours; FT_Short n_contours;
FT_BBox bbox; FT_BBox bbox;
FT_Int left_bearing; FT_Int left_bearing;
FT_Int advance; FT_Int advance;
FT_Bool preserve_pps; FT_Bool preserve_pps;
FT_Vector pp1; FT_Vector pp1;
FT_Vector pp2; FT_Vector pp2;
FT_ULong glyf_offset; FT_ULong glyf_offset;
/* the zone where we load our glyphs */ /* the zone where we load our glyphs */
TT_GlyphZone base; TT_GlyphZone base;
TT_GlyphZone zone; TT_GlyphZone zone;
TT_ExecContext exec; TT_ExecContext exec;
FT_Byte* instructions; FT_Byte* instructions;
FT_ULong ins_pos; FT_ULong ins_pos;
/* for possible extensibility in other formats */ /* for possible extensibility in other formats */
void* other; void* other;
}; };

View File

@ -232,7 +232,7 @@
if ( error ) if ( error )
goto Exit; goto Exit;
face->root.num_faces = face->ttc_header.DirCount; face->root.num_faces = face->ttc_header.count;
if ( face->root.num_faces < 1 ) if ( face->root.num_faces < 1 )
face->root.num_faces = 1; face->root.num_faces = 1;
@ -493,8 +493,8 @@
face->num_kern_pairs = 0; face->num_kern_pairs = 0;
/* freeing the collection table */ /* freeing the collection table */
FREE( face->ttc_header.TableDirectory ); FREE( face->ttc_header.offsets );
face->ttc_header.DirCount = 0; face->ttc_header.count = 0;
/* freeing table directory */ /* freeing table directory */
FREE( face->dir_tables ); FREE( face->dir_tables );

View File

@ -184,17 +184,17 @@
const FT_Frame_Field ttc_header_fields[] = const FT_Frame_Field ttc_header_fields[] =
{ {
FT_FRAME_START( 8 ), FT_FRAME_START( 8 ),
FT_FRAME_LONG( TTC_Header, version ), FT_FRAME_LONG( TTC_Header, version ),
FT_FRAME_LONG( TTC_Header, DirCount ), FT_FRAME_LONG( TTC_Header, count ),
FT_FRAME_END }; FT_FRAME_END };
FT_TRACE2(( "TT_Load_SFNT_Header: %08p, %ld\n", FT_TRACE2(( "TT_Load_SFNT_Header: %08p, %ld\n",
face, face_index )); face, face_index ));
face->ttc_header.Tag = 0; face->ttc_header.tag = 0;
face->ttc_header.version = 0; face->ttc_header.version = 0;
face->ttc_header.DirCount = 0; face->ttc_header.count = 0;
face->num_tables = 0; face->num_tables = 0;
@ -217,27 +217,27 @@
goto Exit; goto Exit;
/* now read the offsets of each font in the file */ /* now read the offsets of each font in the file */
if ( ALLOC_ARRAY( face->ttc_header.TableDirectory, if ( ALLOC_ARRAY( face->ttc_header.offsets,
face->ttc_header.DirCount, face->ttc_header.count,
FT_ULong ) || FT_ULong ) ||
ACCESS_Frame( face->ttc_header.DirCount * 4L ) ) ACCESS_Frame( face->ttc_header.count * 4L ) )
goto Exit; goto Exit;
for ( n = 0; n < face->ttc_header.DirCount; n++ ) for ( n = 0; n < face->ttc_header.count; n++ )
face->ttc_header.TableDirectory[n] = GET_ULong(); face->ttc_header.offsets[n] = GET_ULong();
FORGET_Frame(); FORGET_Frame();
/* check face index */ /* check face index */
if ( face_index >= face->ttc_header.DirCount ) if ( face_index >= face->ttc_header.count )
{ {
error = TT_Err_Bad_Argument; error = TT_Err_Bad_Argument;
goto Exit; goto Exit;
} }
/* seek to the appropriate TrueType file, then read tag */ /* seek to the appropriate TrueType file, then read tag */
if ( FILE_Seek( face->ttc_header.TableDirectory[face_index] ) || if ( FILE_Seek( face->ttc_header.offsets[face_index] ) ||
READ_Long( format_tag ) ) READ_Long( format_tag ) )
goto Exit; goto Exit;
} }