michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* tttables.h */ michael@0: /* */ michael@0: /* Basic SFNT/TrueType tables definitions and interface */ michael@0: /* (specification only). */ michael@0: /* */ michael@0: /* Copyright 1996-2005, 2008-2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __TTTABLES_H__ michael@0: #define __TTTABLES_H__ michael@0: michael@0: michael@0: #include michael@0: #include FT_FREETYPE_H michael@0: michael@0: #ifdef FREETYPE_H michael@0: #error "freetype.h of FreeType 1 has been loaded!" michael@0: #error "Please fix the directory search order for header files" michael@0: #error "so that freetype.h of FreeType 2 is found first." michael@0: #endif michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /*
*/ michael@0: /* truetype_tables */ michael@0: /* */ michael@0: /* */ michael@0: /* TrueType Tables */ michael@0: /* */ michael@0: /* <Abstract> */ michael@0: /* TrueType specific table types and functions. */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* This section contains the definition of TrueType-specific tables */ michael@0: /* as well as some routines used to access and process them. */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_Header */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType font header table. All */ michael@0: /* fields follow the TrueType specification. */ michael@0: /* */ michael@0: typedef struct TT_Header_ michael@0: { michael@0: FT_Fixed Table_Version; michael@0: FT_Fixed Font_Revision; michael@0: michael@0: FT_Long CheckSum_Adjust; michael@0: FT_Long Magic_Number; michael@0: michael@0: FT_UShort Flags; michael@0: FT_UShort Units_Per_EM; michael@0: michael@0: FT_Long Created [2]; michael@0: FT_Long Modified[2]; michael@0: michael@0: FT_Short xMin; michael@0: FT_Short yMin; michael@0: FT_Short xMax; michael@0: FT_Short yMax; michael@0: michael@0: FT_UShort Mac_Style; michael@0: FT_UShort Lowest_Rec_PPEM; michael@0: michael@0: FT_Short Font_Direction; michael@0: FT_Short Index_To_Loc_Format; michael@0: FT_Short Glyph_Data_Format; michael@0: michael@0: } TT_Header; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_HoriHeader */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType horizontal header, the `hhea' */ michael@0: /* table, as well as the corresponding horizontal metrics table, */ michael@0: /* i.e., the `hmtx' table. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* Version :: The table version. */ michael@0: /* */ michael@0: /* Ascender :: The font's ascender, i.e., the distance */ michael@0: /* from the baseline to the top-most of all */ michael@0: /* glyph points found in the font. */ michael@0: /* */ michael@0: /* This value is invalid in many fonts, as */ michael@0: /* it is usually set by the font designer, */ michael@0: /* and often reflects only a portion of the */ michael@0: /* glyphs found in the font (maybe ASCII). */ michael@0: /* */ michael@0: /* You should use the `sTypoAscender' field */ michael@0: /* of the OS/2 table instead if you want */ michael@0: /* the correct one. */ michael@0: /* */ michael@0: /* Descender :: The font's descender, i.e., the distance */ michael@0: /* from the baseline to the bottom-most of */ michael@0: /* all glyph points found in the font. It */ michael@0: /* is negative. */ michael@0: /* */ michael@0: /* This value is invalid in many fonts, as */ michael@0: /* it is usually set by the font designer, */ michael@0: /* and often reflects only a portion of the */ michael@0: /* glyphs found in the font (maybe ASCII). */ michael@0: /* */ michael@0: /* You should use the `sTypoDescender' */ michael@0: /* field of the OS/2 table instead if you */ michael@0: /* want the correct one. */ michael@0: /* */ michael@0: /* Line_Gap :: The font's line gap, i.e., the distance */ michael@0: /* to add to the ascender and descender to */ michael@0: /* get the BTB, i.e., the */ michael@0: /* baseline-to-baseline distance for the */ michael@0: /* font. */ michael@0: /* */ michael@0: /* advance_Width_Max :: This field is the maximum of all advance */ michael@0: /* widths found in the font. It can be */ michael@0: /* used to compute the maximum width of an */ michael@0: /* arbitrary string of text. */ michael@0: /* */ michael@0: /* min_Left_Side_Bearing :: The minimum left side bearing of all */ michael@0: /* glyphs within the font. */ michael@0: /* */ michael@0: /* min_Right_Side_Bearing :: The minimum right side bearing of all */ michael@0: /* glyphs within the font. */ michael@0: /* */ michael@0: /* xMax_Extent :: The maximum horizontal extent (i.e., the */ michael@0: /* `width' of a glyph's bounding box) for */ michael@0: /* all glyphs in the font. */ michael@0: /* */ michael@0: /* caret_Slope_Rise :: The rise coefficient of the cursor's */ michael@0: /* slope of the cursor (slope=rise/run). */ michael@0: /* */ michael@0: /* caret_Slope_Run :: The run coefficient of the cursor's */ michael@0: /* slope. */ michael@0: /* */ michael@0: /* Reserved :: 8~reserved bytes. */ michael@0: /* */ michael@0: /* metric_Data_Format :: Always~0. */ michael@0: /* */ michael@0: /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ michael@0: /* table -- this value can be smaller than */ michael@0: /* the total number of glyphs in the font. */ michael@0: /* */ michael@0: /* long_metrics :: A pointer into the `hmtx' table. */ michael@0: /* */ michael@0: /* short_metrics :: A pointer into the `hmtx' table. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ michael@0: /* be identical except for the names of their fields, */ michael@0: /* which are different. */ michael@0: /* */ michael@0: /* This ensures that a single function in the `ttload' */ michael@0: /* module is able to read both the horizontal and vertical */ michael@0: /* headers. */ michael@0: /* */ michael@0: typedef struct TT_HoriHeader_ michael@0: { michael@0: FT_Fixed Version; michael@0: FT_Short Ascender; michael@0: FT_Short Descender; michael@0: FT_Short Line_Gap; michael@0: michael@0: FT_UShort advance_Width_Max; /* advance width maximum */ michael@0: michael@0: FT_Short min_Left_Side_Bearing; /* minimum left-sb */ michael@0: FT_Short min_Right_Side_Bearing; /* minimum right-sb */ michael@0: FT_Short xMax_Extent; /* xmax extents */ michael@0: FT_Short caret_Slope_Rise; michael@0: FT_Short caret_Slope_Run; michael@0: FT_Short caret_Offset; michael@0: michael@0: FT_Short Reserved[4]; michael@0: michael@0: FT_Short metric_Data_Format; michael@0: FT_UShort number_Of_HMetrics; michael@0: michael@0: /* The following fields are not defined by the TrueType specification */ michael@0: /* but they are used to connect the metrics header to the relevant */ michael@0: /* `HMTX' table. */ michael@0: michael@0: void* long_metrics; michael@0: void* short_metrics; michael@0: michael@0: } TT_HoriHeader; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_VertHeader */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType vertical header, the `vhea' */ michael@0: /* table, as well as the corresponding vertical metrics table, i.e., */ michael@0: /* the `vmtx' table. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* Version :: The table version. */ michael@0: /* */ michael@0: /* Ascender :: The font's ascender, i.e., the distance */ michael@0: /* from the baseline to the top-most of */ michael@0: /* all glyph points found in the font. */ michael@0: /* */ michael@0: /* This value is invalid in many fonts, as */ michael@0: /* it is usually set by the font designer, */ michael@0: /* and often reflects only a portion of */ michael@0: /* the glyphs found in the font (maybe */ michael@0: /* ASCII). */ michael@0: /* */ michael@0: /* You should use the `sTypoAscender' */ michael@0: /* field of the OS/2 table instead if you */ michael@0: /* want the correct one. */ michael@0: /* */ michael@0: /* Descender :: The font's descender, i.e., the */ michael@0: /* distance from the baseline to the */ michael@0: /* bottom-most of all glyph points found */ michael@0: /* in the font. It is negative. */ michael@0: /* */ michael@0: /* This value is invalid in many fonts, as */ michael@0: /* it is usually set by the font designer, */ michael@0: /* and often reflects only a portion of */ michael@0: /* the glyphs found in the font (maybe */ michael@0: /* ASCII). */ michael@0: /* */ michael@0: /* You should use the `sTypoDescender' */ michael@0: /* field of the OS/2 table instead if you */ michael@0: /* want the correct one. */ michael@0: /* */ michael@0: /* Line_Gap :: The font's line gap, i.e., the distance */ michael@0: /* to add to the ascender and descender to */ michael@0: /* get the BTB, i.e., the */ michael@0: /* baseline-to-baseline distance for the */ michael@0: /* font. */ michael@0: /* */ michael@0: /* advance_Height_Max :: This field is the maximum of all */ michael@0: /* advance heights found in the font. It */ michael@0: /* can be used to compute the maximum */ michael@0: /* height of an arbitrary string of text. */ michael@0: /* */ michael@0: /* min_Top_Side_Bearing :: The minimum top side bearing of all */ michael@0: /* glyphs within the font. */ michael@0: /* */ michael@0: /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ michael@0: /* glyphs within the font. */ michael@0: /* */ michael@0: /* yMax_Extent :: The maximum vertical extent (i.e., the */ michael@0: /* `height' of a glyph's bounding box) for */ michael@0: /* all glyphs in the font. */ michael@0: /* */ michael@0: /* caret_Slope_Rise :: The rise coefficient of the cursor's */ michael@0: /* slope of the cursor (slope=rise/run). */ michael@0: /* */ michael@0: /* caret_Slope_Run :: The run coefficient of the cursor's */ michael@0: /* slope. */ michael@0: /* */ michael@0: /* caret_Offset :: The cursor's offset for slanted fonts. */ michael@0: /* This value is `reserved' in vmtx */ michael@0: /* version 1.0. */ michael@0: /* */ michael@0: /* Reserved :: 8~reserved bytes. */ michael@0: /* */ michael@0: /* metric_Data_Format :: Always~0. */ michael@0: /* */ michael@0: /* number_Of_HMetrics :: Number of VMetrics entries in the */ michael@0: /* `vmtx' table -- this value can be */ michael@0: /* smaller than the total number of glyphs */ michael@0: /* in the font. */ michael@0: /* */ michael@0: /* long_metrics :: A pointer into the `vmtx' table. */ michael@0: /* */ michael@0: /* short_metrics :: A pointer into the `vmtx' table. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ michael@0: /* be identical except for the names of their fields, */ michael@0: /* which are different. */ michael@0: /* */ michael@0: /* This ensures that a single function in the `ttload' */ michael@0: /* module is able to read both the horizontal and vertical */ michael@0: /* headers. */ michael@0: /* */ michael@0: typedef struct TT_VertHeader_ michael@0: { michael@0: FT_Fixed Version; michael@0: FT_Short Ascender; michael@0: FT_Short Descender; michael@0: FT_Short Line_Gap; michael@0: michael@0: FT_UShort advance_Height_Max; /* advance height maximum */ michael@0: michael@0: FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */ michael@0: FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ michael@0: FT_Short yMax_Extent; /* xmax or ymax extents */ michael@0: FT_Short caret_Slope_Rise; michael@0: FT_Short caret_Slope_Run; michael@0: FT_Short caret_Offset; michael@0: michael@0: FT_Short Reserved[4]; michael@0: michael@0: FT_Short metric_Data_Format; michael@0: FT_UShort number_Of_VMetrics; michael@0: michael@0: /* The following fields are not defined by the TrueType specification */ michael@0: /* but they're used to connect the metrics header to the relevant */ michael@0: /* `HMTX' or `VMTX' table. */ michael@0: michael@0: void* long_metrics; michael@0: void* short_metrics; michael@0: michael@0: } TT_VertHeader; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_OS2 */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType OS/2 table. All fields */ michael@0: /* comply to the OpenType specification. */ michael@0: /* */ michael@0: /* Note that we now support old Mac fonts that do not include an OS/2 */ michael@0: /* table. In this case, the `version' field is always set to 0xFFFF. */ michael@0: /* */ michael@0: typedef struct TT_OS2_ michael@0: { michael@0: FT_UShort version; /* 0x0001 - more or 0xFFFF */ michael@0: FT_Short xAvgCharWidth; michael@0: FT_UShort usWeightClass; michael@0: FT_UShort usWidthClass; michael@0: FT_Short fsType; michael@0: FT_Short ySubscriptXSize; michael@0: FT_Short ySubscriptYSize; michael@0: FT_Short ySubscriptXOffset; michael@0: FT_Short ySubscriptYOffset; michael@0: FT_Short ySuperscriptXSize; michael@0: FT_Short ySuperscriptYSize; michael@0: FT_Short ySuperscriptXOffset; michael@0: FT_Short ySuperscriptYOffset; michael@0: FT_Short yStrikeoutSize; michael@0: FT_Short yStrikeoutPosition; michael@0: FT_Short sFamilyClass; michael@0: michael@0: FT_Byte panose[10]; michael@0: michael@0: FT_ULong ulUnicodeRange1; /* Bits 0-31 */ michael@0: FT_ULong ulUnicodeRange2; /* Bits 32-63 */ michael@0: FT_ULong ulUnicodeRange3; /* Bits 64-95 */ michael@0: FT_ULong ulUnicodeRange4; /* Bits 96-127 */ michael@0: michael@0: FT_Char achVendID[4]; michael@0: michael@0: FT_UShort fsSelection; michael@0: FT_UShort usFirstCharIndex; michael@0: FT_UShort usLastCharIndex; michael@0: FT_Short sTypoAscender; michael@0: FT_Short sTypoDescender; michael@0: FT_Short sTypoLineGap; michael@0: FT_UShort usWinAscent; michael@0: FT_UShort usWinDescent; michael@0: michael@0: /* only version 1 and higher: */ michael@0: michael@0: FT_ULong ulCodePageRange1; /* Bits 0-31 */ michael@0: FT_ULong ulCodePageRange2; /* Bits 32-63 */ michael@0: michael@0: /* only version 2 and higher: */ michael@0: michael@0: FT_Short sxHeight; michael@0: FT_Short sCapHeight; michael@0: FT_UShort usDefaultChar; michael@0: FT_UShort usBreakChar; michael@0: FT_UShort usMaxContext; michael@0: michael@0: /* only version 5 and higher: */ michael@0: michael@0: FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ michael@0: FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ michael@0: michael@0: } TT_OS2; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_Postscript */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType PostScript table. All fields */ michael@0: /* comply to the TrueType specification. This structure does not */ michael@0: /* reference the PostScript glyph names, which can be nevertheless */ michael@0: /* accessed with the `ttpost' module. */ michael@0: /* */ michael@0: typedef struct TT_Postscript_ michael@0: { michael@0: FT_Fixed FormatType; michael@0: FT_Fixed italicAngle; michael@0: FT_Short underlinePosition; michael@0: FT_Short underlineThickness; michael@0: FT_ULong isFixedPitch; michael@0: FT_ULong minMemType42; michael@0: FT_ULong maxMemType42; michael@0: FT_ULong minMemType1; michael@0: FT_ULong maxMemType1; michael@0: michael@0: /* Glyph names follow in the file, but we don't */ michael@0: /* load them by default. See the ttpost.c file. */ michael@0: michael@0: } TT_Postscript; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_PCLT */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* A structure used to model a TrueType PCLT table. All fields */ michael@0: /* comply to the TrueType specification. */ michael@0: /* */ michael@0: typedef struct TT_PCLT_ michael@0: { michael@0: FT_Fixed Version; michael@0: FT_ULong FontNumber; michael@0: FT_UShort Pitch; michael@0: FT_UShort xHeight; michael@0: FT_UShort Style; michael@0: FT_UShort TypeFamily; michael@0: FT_UShort CapHeight; michael@0: FT_UShort SymbolSet; michael@0: FT_Char TypeFace[16]; michael@0: FT_Char CharacterComplement[8]; michael@0: FT_Char FileName[6]; michael@0: FT_Char StrokeWeight; michael@0: FT_Char WidthType; michael@0: FT_Byte SerifStyle; michael@0: FT_Byte Reserved; michael@0: michael@0: } TT_PCLT; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Struct> */ michael@0: /* TT_MaxProfile */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* The maximum profile is a table containing many max values, which */ michael@0: /* can be used to pre-allocate arrays. This ensures that no memory */ michael@0: /* allocation occurs during a glyph load. */ michael@0: /* */ michael@0: /* <Fields> */ michael@0: /* version :: The version number. */ michael@0: /* */ michael@0: /* numGlyphs :: The number of glyphs in this TrueType */ michael@0: /* font. */ michael@0: /* */ michael@0: /* maxPoints :: The maximum number of points in a */ michael@0: /* non-composite TrueType glyph. See also */ michael@0: /* the structure element */ michael@0: /* `maxCompositePoints'. */ michael@0: /* */ michael@0: /* maxContours :: The maximum number of contours in a */ michael@0: /* non-composite TrueType glyph. See also */ michael@0: /* the structure element */ michael@0: /* `maxCompositeContours'. */ michael@0: /* */ michael@0: /* maxCompositePoints :: The maximum number of points in a */ michael@0: /* composite TrueType glyph. See also the */ michael@0: /* structure element `maxPoints'. */ michael@0: /* */ michael@0: /* maxCompositeContours :: The maximum number of contours in a */ michael@0: /* composite TrueType glyph. See also the */ michael@0: /* structure element `maxContours'. */ michael@0: /* */ michael@0: /* maxZones :: The maximum number of zones used for */ michael@0: /* glyph hinting. */ michael@0: /* */ michael@0: /* maxTwilightPoints :: The maximum number of points in the */ michael@0: /* twilight zone used for glyph hinting. */ michael@0: /* */ michael@0: /* maxStorage :: The maximum number of elements in the */ michael@0: /* storage area used for glyph hinting. */ michael@0: /* */ michael@0: /* maxFunctionDefs :: The maximum number of function */ michael@0: /* definitions in the TrueType bytecode for */ michael@0: /* this font. */ michael@0: /* */ michael@0: /* maxInstructionDefs :: The maximum number of instruction */ michael@0: /* definitions in the TrueType bytecode for */ michael@0: /* this font. */ michael@0: /* */ michael@0: /* maxStackElements :: The maximum number of stack elements used */ michael@0: /* during bytecode interpretation. */ michael@0: /* */ michael@0: /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ michael@0: /* used for glyph hinting. */ michael@0: /* */ michael@0: /* maxComponentElements :: The maximum number of simple (i.e., non- */ michael@0: /* composite) glyphs in a composite glyph. */ michael@0: /* */ michael@0: /* maxComponentDepth :: The maximum nesting depth of composite */ michael@0: /* glyphs. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* This structure is only used during font loading. */ michael@0: /* */ michael@0: typedef struct TT_MaxProfile_ michael@0: { michael@0: FT_Fixed version; michael@0: FT_UShort numGlyphs; michael@0: FT_UShort maxPoints; michael@0: FT_UShort maxContours; michael@0: FT_UShort maxCompositePoints; michael@0: FT_UShort maxCompositeContours; michael@0: FT_UShort maxZones; michael@0: FT_UShort maxTwilightPoints; michael@0: FT_UShort maxStorage; michael@0: FT_UShort maxFunctionDefs; michael@0: FT_UShort maxInstructionDefs; michael@0: FT_UShort maxStackElements; michael@0: FT_UShort maxSizeOfInstructions; michael@0: FT_UShort maxComponentElements; michael@0: FT_UShort maxComponentDepth; michael@0: michael@0: } TT_MaxProfile; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Enum> */ michael@0: /* FT_Sfnt_Tag */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* An enumeration used to specify the index of an SFNT table. */ michael@0: /* Used in the @FT_Get_Sfnt_Table API function. */ michael@0: /* */ michael@0: typedef enum FT_Sfnt_Tag_ michael@0: { michael@0: ft_sfnt_head = 0, /* TT_Header */ michael@0: ft_sfnt_maxp = 1, /* TT_MaxProfile */ michael@0: ft_sfnt_os2 = 2, /* TT_OS2 */ michael@0: ft_sfnt_hhea = 3, /* TT_HoriHeader */ michael@0: ft_sfnt_vhea = 4, /* TT_VertHeader */ michael@0: ft_sfnt_post = 5, /* TT_Postscript */ michael@0: ft_sfnt_pclt = 6, /* TT_PCLT */ michael@0: michael@0: sfnt_max /* internal end mark */ michael@0: michael@0: } FT_Sfnt_Tag; michael@0: michael@0: /* */ michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_Sfnt_Table */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Return a pointer to a given SFNT table within a face. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* face :: A handle to the source. */ michael@0: /* */ michael@0: /* tag :: The index of the SFNT table. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* A type-less pointer to the table. This will be~0 in case of */ michael@0: /* error, or if the corresponding table was not found *OR* loaded */ michael@0: /* from the file. */ michael@0: /* */ michael@0: /* Use a typecast according to `tag' to access the structure */ michael@0: /* elements. */ michael@0: /* */ michael@0: /* <Note> */ michael@0: /* The table is owned by the face object and disappears with it. */ michael@0: /* */ michael@0: /* This function is only useful to access SFNT tables that are loaded */ michael@0: /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ michael@0: /* a list. */ michael@0: /* */ michael@0: /* Here an example how to access the `vhea' table: */ michael@0: /* */ michael@0: /* { */ michael@0: /* TT_VertHeader* vert_header; */ michael@0: /* */ michael@0: /* */ michael@0: /* vert_header = */ michael@0: /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ michael@0: /* } */ michael@0: /* */ michael@0: FT_EXPORT( void* ) michael@0: FT_Get_Sfnt_Table( FT_Face face, michael@0: FT_Sfnt_Tag tag ); michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @function: michael@0: * FT_Load_Sfnt_Table michael@0: * michael@0: * @description: michael@0: * Load any font table into client memory. michael@0: * michael@0: * @input: michael@0: * face :: michael@0: * A handle to the source face. michael@0: * michael@0: * tag :: michael@0: * The four-byte tag of the table to load. Use the value~0 if you want michael@0: * to access the whole font file. Otherwise, you can use one of the michael@0: * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new michael@0: * one with @FT_MAKE_TAG. michael@0: * michael@0: * offset :: michael@0: * The starting offset in the table (or file if tag == 0). michael@0: * michael@0: * @output: michael@0: * buffer :: michael@0: * The target buffer address. The client must ensure that the memory michael@0: * array is big enough to hold the data. michael@0: * michael@0: * @inout: michael@0: * length :: michael@0: * If the `length' parameter is NULL, then try to load the whole table. michael@0: * Return an error code if it fails. michael@0: * michael@0: * Else, if `*length' is~0, exit immediately while returning the michael@0: * table's (or file) full size in it. michael@0: * michael@0: * Else the number of bytes to read from the table or file, from the michael@0: * starting offset. michael@0: * michael@0: * @return: michael@0: * FreeType error code. 0~means success. michael@0: * michael@0: * @note: michael@0: * If you need to determine the table's length you should first call this michael@0: * function with `*length' set to~0, as in the following example: michael@0: * michael@0: * { michael@0: * FT_ULong length = 0; michael@0: * michael@0: * michael@0: * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); michael@0: * if ( error ) { ... table does not exist ... } michael@0: * michael@0: * buffer = malloc( length ); michael@0: * if ( buffer == NULL ) { ... not enough memory ... } michael@0: * michael@0: * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); michael@0: * if ( error ) { ... could not load table ... } michael@0: * } michael@0: * michael@0: * Note that structures like @TT_Header or @TT_OS2 can't be used with michael@0: * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that michael@0: * those structures depend on the processor architecture, with varying michael@0: * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). michael@0: * michael@0: */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Load_Sfnt_Table( FT_Face face, michael@0: FT_ULong tag, michael@0: FT_Long offset, michael@0: FT_Byte* buffer, michael@0: FT_ULong* length ); michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @function: michael@0: * FT_Sfnt_Table_Info michael@0: * michael@0: * @description: michael@0: * Return information on an SFNT table. michael@0: * michael@0: * @input: michael@0: * face :: michael@0: * A handle to the source face. michael@0: * michael@0: * table_index :: michael@0: * The index of an SFNT table. The function returns michael@0: * FT_Err_Table_Missing for an invalid value. michael@0: * michael@0: * @inout: michael@0: * tag :: michael@0: * The name tag of the SFNT table. If the value is NULL, `table_index' michael@0: * is ignored, and `length' returns the number of SFNT tables in the michael@0: * font. michael@0: * michael@0: * @output: michael@0: * length :: michael@0: * The length of the SFNT table (or the number of SFNT tables, depending michael@0: * on `tag'). michael@0: * michael@0: * @return: michael@0: * FreeType error code. 0~means success. michael@0: * michael@0: * @note: michael@0: * While parsing fonts, FreeType handles SFNT tables with length zero as michael@0: * missing. michael@0: * michael@0: */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Sfnt_Table_Info( FT_Face face, michael@0: FT_UInt table_index, michael@0: FT_ULong *tag, michael@0: FT_ULong *length ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_CMap_Language_ID */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Return TrueType/sfnt specific cmap language ID. Definitions of */ michael@0: /* language ID values are in `ttnameid.h'. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* charmap :: */ michael@0: /* The target charmap. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* The language ID of `charmap'. If `charmap' doesn't belong to a */ michael@0: /* TrueType/sfnt face, just return~0 as the default value. */ michael@0: /* */ michael@0: /* For a format~14 cmap (to access Unicode IVS), the return value is */ michael@0: /* 0xFFFFFFFF. */ michael@0: /* */ michael@0: FT_EXPORT( FT_ULong ) michael@0: FT_Get_CMap_Language_ID( FT_CharMap charmap ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* <Function> */ michael@0: /* FT_Get_CMap_Format */ michael@0: /* */ michael@0: /* <Description> */ michael@0: /* Return TrueType/sfnt specific cmap format. */ michael@0: /* */ michael@0: /* <Input> */ michael@0: /* charmap :: */ michael@0: /* The target charmap. */ michael@0: /* */ michael@0: /* <Return> */ michael@0: /* The format of `charmap'. If `charmap' doesn't belong to a */ michael@0: /* TrueType/sfnt face, return -1. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Long ) michael@0: FT_Get_CMap_Format( FT_CharMap charmap ); michael@0: michael@0: /* */ michael@0: michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __TTTABLES_H__ */ michael@0: michael@0: michael@0: /* END */