Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /***************************************************************************/ |
michael@0 | 2 | /* */ |
michael@0 | 3 | /* tttables.h */ |
michael@0 | 4 | /* */ |
michael@0 | 5 | /* Basic SFNT/TrueType tables definitions and interface */ |
michael@0 | 6 | /* (specification only). */ |
michael@0 | 7 | /* */ |
michael@0 | 8 | /* Copyright 1996-2005, 2008-2013 by */ |
michael@0 | 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
michael@0 | 10 | /* */ |
michael@0 | 11 | /* This file is part of the FreeType project, and may only be used, */ |
michael@0 | 12 | /* modified, and distributed under the terms of the FreeType project */ |
michael@0 | 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
michael@0 | 14 | /* this file you indicate that you have read the license and */ |
michael@0 | 15 | /* understand and accept it fully. */ |
michael@0 | 16 | /* */ |
michael@0 | 17 | /***************************************************************************/ |
michael@0 | 18 | |
michael@0 | 19 | |
michael@0 | 20 | #ifndef __TTTABLES_H__ |
michael@0 | 21 | #define __TTTABLES_H__ |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | #include <ft2build.h> |
michael@0 | 25 | #include FT_FREETYPE_H |
michael@0 | 26 | |
michael@0 | 27 | #ifdef FREETYPE_H |
michael@0 | 28 | #error "freetype.h of FreeType 1 has been loaded!" |
michael@0 | 29 | #error "Please fix the directory search order for header files" |
michael@0 | 30 | #error "so that freetype.h of FreeType 2 is found first." |
michael@0 | 31 | #endif |
michael@0 | 32 | |
michael@0 | 33 | |
michael@0 | 34 | FT_BEGIN_HEADER |
michael@0 | 35 | |
michael@0 | 36 | /*************************************************************************/ |
michael@0 | 37 | /* */ |
michael@0 | 38 | /* <Section> */ |
michael@0 | 39 | /* truetype_tables */ |
michael@0 | 40 | /* */ |
michael@0 | 41 | /* <Title> */ |
michael@0 | 42 | /* TrueType Tables */ |
michael@0 | 43 | /* */ |
michael@0 | 44 | /* <Abstract> */ |
michael@0 | 45 | /* TrueType specific table types and functions. */ |
michael@0 | 46 | /* */ |
michael@0 | 47 | /* <Description> */ |
michael@0 | 48 | /* This section contains the definition of TrueType-specific tables */ |
michael@0 | 49 | /* as well as some routines used to access and process them. */ |
michael@0 | 50 | /* */ |
michael@0 | 51 | /*************************************************************************/ |
michael@0 | 52 | |
michael@0 | 53 | |
michael@0 | 54 | /*************************************************************************/ |
michael@0 | 55 | /* */ |
michael@0 | 56 | /* <Struct> */ |
michael@0 | 57 | /* TT_Header */ |
michael@0 | 58 | /* */ |
michael@0 | 59 | /* <Description> */ |
michael@0 | 60 | /* A structure used to model a TrueType font header table. All */ |
michael@0 | 61 | /* fields follow the TrueType specification. */ |
michael@0 | 62 | /* */ |
michael@0 | 63 | typedef struct TT_Header_ |
michael@0 | 64 | { |
michael@0 | 65 | FT_Fixed Table_Version; |
michael@0 | 66 | FT_Fixed Font_Revision; |
michael@0 | 67 | |
michael@0 | 68 | FT_Long CheckSum_Adjust; |
michael@0 | 69 | FT_Long Magic_Number; |
michael@0 | 70 | |
michael@0 | 71 | FT_UShort Flags; |
michael@0 | 72 | FT_UShort Units_Per_EM; |
michael@0 | 73 | |
michael@0 | 74 | FT_Long Created [2]; |
michael@0 | 75 | FT_Long Modified[2]; |
michael@0 | 76 | |
michael@0 | 77 | FT_Short xMin; |
michael@0 | 78 | FT_Short yMin; |
michael@0 | 79 | FT_Short xMax; |
michael@0 | 80 | FT_Short yMax; |
michael@0 | 81 | |
michael@0 | 82 | FT_UShort Mac_Style; |
michael@0 | 83 | FT_UShort Lowest_Rec_PPEM; |
michael@0 | 84 | |
michael@0 | 85 | FT_Short Font_Direction; |
michael@0 | 86 | FT_Short Index_To_Loc_Format; |
michael@0 | 87 | FT_Short Glyph_Data_Format; |
michael@0 | 88 | |
michael@0 | 89 | } TT_Header; |
michael@0 | 90 | |
michael@0 | 91 | |
michael@0 | 92 | /*************************************************************************/ |
michael@0 | 93 | /* */ |
michael@0 | 94 | /* <Struct> */ |
michael@0 | 95 | /* TT_HoriHeader */ |
michael@0 | 96 | /* */ |
michael@0 | 97 | /* <Description> */ |
michael@0 | 98 | /* A structure used to model a TrueType horizontal header, the `hhea' */ |
michael@0 | 99 | /* table, as well as the corresponding horizontal metrics table, */ |
michael@0 | 100 | /* i.e., the `hmtx' table. */ |
michael@0 | 101 | /* */ |
michael@0 | 102 | /* <Fields> */ |
michael@0 | 103 | /* Version :: The table version. */ |
michael@0 | 104 | /* */ |
michael@0 | 105 | /* Ascender :: The font's ascender, i.e., the distance */ |
michael@0 | 106 | /* from the baseline to the top-most of all */ |
michael@0 | 107 | /* glyph points found in the font. */ |
michael@0 | 108 | /* */ |
michael@0 | 109 | /* This value is invalid in many fonts, as */ |
michael@0 | 110 | /* it is usually set by the font designer, */ |
michael@0 | 111 | /* and often reflects only a portion of the */ |
michael@0 | 112 | /* glyphs found in the font (maybe ASCII). */ |
michael@0 | 113 | /* */ |
michael@0 | 114 | /* You should use the `sTypoAscender' field */ |
michael@0 | 115 | /* of the OS/2 table instead if you want */ |
michael@0 | 116 | /* the correct one. */ |
michael@0 | 117 | /* */ |
michael@0 | 118 | /* Descender :: The font's descender, i.e., the distance */ |
michael@0 | 119 | /* from the baseline to the bottom-most of */ |
michael@0 | 120 | /* all glyph points found in the font. It */ |
michael@0 | 121 | /* is negative. */ |
michael@0 | 122 | /* */ |
michael@0 | 123 | /* This value is invalid in many fonts, as */ |
michael@0 | 124 | /* it is usually set by the font designer, */ |
michael@0 | 125 | /* and often reflects only a portion of the */ |
michael@0 | 126 | /* glyphs found in the font (maybe ASCII). */ |
michael@0 | 127 | /* */ |
michael@0 | 128 | /* You should use the `sTypoDescender' */ |
michael@0 | 129 | /* field of the OS/2 table instead if you */ |
michael@0 | 130 | /* want the correct one. */ |
michael@0 | 131 | /* */ |
michael@0 | 132 | /* Line_Gap :: The font's line gap, i.e., the distance */ |
michael@0 | 133 | /* to add to the ascender and descender to */ |
michael@0 | 134 | /* get the BTB, i.e., the */ |
michael@0 | 135 | /* baseline-to-baseline distance for the */ |
michael@0 | 136 | /* font. */ |
michael@0 | 137 | /* */ |
michael@0 | 138 | /* advance_Width_Max :: This field is the maximum of all advance */ |
michael@0 | 139 | /* widths found in the font. It can be */ |
michael@0 | 140 | /* used to compute the maximum width of an */ |
michael@0 | 141 | /* arbitrary string of text. */ |
michael@0 | 142 | /* */ |
michael@0 | 143 | /* min_Left_Side_Bearing :: The minimum left side bearing of all */ |
michael@0 | 144 | /* glyphs within the font. */ |
michael@0 | 145 | /* */ |
michael@0 | 146 | /* min_Right_Side_Bearing :: The minimum right side bearing of all */ |
michael@0 | 147 | /* glyphs within the font. */ |
michael@0 | 148 | /* */ |
michael@0 | 149 | /* xMax_Extent :: The maximum horizontal extent (i.e., the */ |
michael@0 | 150 | /* `width' of a glyph's bounding box) for */ |
michael@0 | 151 | /* all glyphs in the font. */ |
michael@0 | 152 | /* */ |
michael@0 | 153 | /* caret_Slope_Rise :: The rise coefficient of the cursor's */ |
michael@0 | 154 | /* slope of the cursor (slope=rise/run). */ |
michael@0 | 155 | /* */ |
michael@0 | 156 | /* caret_Slope_Run :: The run coefficient of the cursor's */ |
michael@0 | 157 | /* slope. */ |
michael@0 | 158 | /* */ |
michael@0 | 159 | /* Reserved :: 8~reserved bytes. */ |
michael@0 | 160 | /* */ |
michael@0 | 161 | /* metric_Data_Format :: Always~0. */ |
michael@0 | 162 | /* */ |
michael@0 | 163 | /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */ |
michael@0 | 164 | /* table -- this value can be smaller than */ |
michael@0 | 165 | /* the total number of glyphs in the font. */ |
michael@0 | 166 | /* */ |
michael@0 | 167 | /* long_metrics :: A pointer into the `hmtx' table. */ |
michael@0 | 168 | /* */ |
michael@0 | 169 | /* short_metrics :: A pointer into the `hmtx' table. */ |
michael@0 | 170 | /* */ |
michael@0 | 171 | /* <Note> */ |
michael@0 | 172 | /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ |
michael@0 | 173 | /* be identical except for the names of their fields, */ |
michael@0 | 174 | /* which are different. */ |
michael@0 | 175 | /* */ |
michael@0 | 176 | /* This ensures that a single function in the `ttload' */ |
michael@0 | 177 | /* module is able to read both the horizontal and vertical */ |
michael@0 | 178 | /* headers. */ |
michael@0 | 179 | /* */ |
michael@0 | 180 | typedef struct TT_HoriHeader_ |
michael@0 | 181 | { |
michael@0 | 182 | FT_Fixed Version; |
michael@0 | 183 | FT_Short Ascender; |
michael@0 | 184 | FT_Short Descender; |
michael@0 | 185 | FT_Short Line_Gap; |
michael@0 | 186 | |
michael@0 | 187 | FT_UShort advance_Width_Max; /* advance width maximum */ |
michael@0 | 188 | |
michael@0 | 189 | FT_Short min_Left_Side_Bearing; /* minimum left-sb */ |
michael@0 | 190 | FT_Short min_Right_Side_Bearing; /* minimum right-sb */ |
michael@0 | 191 | FT_Short xMax_Extent; /* xmax extents */ |
michael@0 | 192 | FT_Short caret_Slope_Rise; |
michael@0 | 193 | FT_Short caret_Slope_Run; |
michael@0 | 194 | FT_Short caret_Offset; |
michael@0 | 195 | |
michael@0 | 196 | FT_Short Reserved[4]; |
michael@0 | 197 | |
michael@0 | 198 | FT_Short metric_Data_Format; |
michael@0 | 199 | FT_UShort number_Of_HMetrics; |
michael@0 | 200 | |
michael@0 | 201 | /* The following fields are not defined by the TrueType specification */ |
michael@0 | 202 | /* but they are used to connect the metrics header to the relevant */ |
michael@0 | 203 | /* `HMTX' table. */ |
michael@0 | 204 | |
michael@0 | 205 | void* long_metrics; |
michael@0 | 206 | void* short_metrics; |
michael@0 | 207 | |
michael@0 | 208 | } TT_HoriHeader; |
michael@0 | 209 | |
michael@0 | 210 | |
michael@0 | 211 | /*************************************************************************/ |
michael@0 | 212 | /* */ |
michael@0 | 213 | /* <Struct> */ |
michael@0 | 214 | /* TT_VertHeader */ |
michael@0 | 215 | /* */ |
michael@0 | 216 | /* <Description> */ |
michael@0 | 217 | /* A structure used to model a TrueType vertical header, the `vhea' */ |
michael@0 | 218 | /* table, as well as the corresponding vertical metrics table, i.e., */ |
michael@0 | 219 | /* the `vmtx' table. */ |
michael@0 | 220 | /* */ |
michael@0 | 221 | /* <Fields> */ |
michael@0 | 222 | /* Version :: The table version. */ |
michael@0 | 223 | /* */ |
michael@0 | 224 | /* Ascender :: The font's ascender, i.e., the distance */ |
michael@0 | 225 | /* from the baseline to the top-most of */ |
michael@0 | 226 | /* all glyph points found in the font. */ |
michael@0 | 227 | /* */ |
michael@0 | 228 | /* This value is invalid in many fonts, as */ |
michael@0 | 229 | /* it is usually set by the font designer, */ |
michael@0 | 230 | /* and often reflects only a portion of */ |
michael@0 | 231 | /* the glyphs found in the font (maybe */ |
michael@0 | 232 | /* ASCII). */ |
michael@0 | 233 | /* */ |
michael@0 | 234 | /* You should use the `sTypoAscender' */ |
michael@0 | 235 | /* field of the OS/2 table instead if you */ |
michael@0 | 236 | /* want the correct one. */ |
michael@0 | 237 | /* */ |
michael@0 | 238 | /* Descender :: The font's descender, i.e., the */ |
michael@0 | 239 | /* distance from the baseline to the */ |
michael@0 | 240 | /* bottom-most of all glyph points found */ |
michael@0 | 241 | /* in the font. It is negative. */ |
michael@0 | 242 | /* */ |
michael@0 | 243 | /* This value is invalid in many fonts, as */ |
michael@0 | 244 | /* it is usually set by the font designer, */ |
michael@0 | 245 | /* and often reflects only a portion of */ |
michael@0 | 246 | /* the glyphs found in the font (maybe */ |
michael@0 | 247 | /* ASCII). */ |
michael@0 | 248 | /* */ |
michael@0 | 249 | /* You should use the `sTypoDescender' */ |
michael@0 | 250 | /* field of the OS/2 table instead if you */ |
michael@0 | 251 | /* want the correct one. */ |
michael@0 | 252 | /* */ |
michael@0 | 253 | /* Line_Gap :: The font's line gap, i.e., the distance */ |
michael@0 | 254 | /* to add to the ascender and descender to */ |
michael@0 | 255 | /* get the BTB, i.e., the */ |
michael@0 | 256 | /* baseline-to-baseline distance for the */ |
michael@0 | 257 | /* font. */ |
michael@0 | 258 | /* */ |
michael@0 | 259 | /* advance_Height_Max :: This field is the maximum of all */ |
michael@0 | 260 | /* advance heights found in the font. It */ |
michael@0 | 261 | /* can be used to compute the maximum */ |
michael@0 | 262 | /* height of an arbitrary string of text. */ |
michael@0 | 263 | /* */ |
michael@0 | 264 | /* min_Top_Side_Bearing :: The minimum top side bearing of all */ |
michael@0 | 265 | /* glyphs within the font. */ |
michael@0 | 266 | /* */ |
michael@0 | 267 | /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */ |
michael@0 | 268 | /* glyphs within the font. */ |
michael@0 | 269 | /* */ |
michael@0 | 270 | /* yMax_Extent :: The maximum vertical extent (i.e., the */ |
michael@0 | 271 | /* `height' of a glyph's bounding box) for */ |
michael@0 | 272 | /* all glyphs in the font. */ |
michael@0 | 273 | /* */ |
michael@0 | 274 | /* caret_Slope_Rise :: The rise coefficient of the cursor's */ |
michael@0 | 275 | /* slope of the cursor (slope=rise/run). */ |
michael@0 | 276 | /* */ |
michael@0 | 277 | /* caret_Slope_Run :: The run coefficient of the cursor's */ |
michael@0 | 278 | /* slope. */ |
michael@0 | 279 | /* */ |
michael@0 | 280 | /* caret_Offset :: The cursor's offset for slanted fonts. */ |
michael@0 | 281 | /* This value is `reserved' in vmtx */ |
michael@0 | 282 | /* version 1.0. */ |
michael@0 | 283 | /* */ |
michael@0 | 284 | /* Reserved :: 8~reserved bytes. */ |
michael@0 | 285 | /* */ |
michael@0 | 286 | /* metric_Data_Format :: Always~0. */ |
michael@0 | 287 | /* */ |
michael@0 | 288 | /* number_Of_HMetrics :: Number of VMetrics entries in the */ |
michael@0 | 289 | /* `vmtx' table -- this value can be */ |
michael@0 | 290 | /* smaller than the total number of glyphs */ |
michael@0 | 291 | /* in the font. */ |
michael@0 | 292 | /* */ |
michael@0 | 293 | /* long_metrics :: A pointer into the `vmtx' table. */ |
michael@0 | 294 | /* */ |
michael@0 | 295 | /* short_metrics :: A pointer into the `vmtx' table. */ |
michael@0 | 296 | /* */ |
michael@0 | 297 | /* <Note> */ |
michael@0 | 298 | /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */ |
michael@0 | 299 | /* be identical except for the names of their fields, */ |
michael@0 | 300 | /* which are different. */ |
michael@0 | 301 | /* */ |
michael@0 | 302 | /* This ensures that a single function in the `ttload' */ |
michael@0 | 303 | /* module is able to read both the horizontal and vertical */ |
michael@0 | 304 | /* headers. */ |
michael@0 | 305 | /* */ |
michael@0 | 306 | typedef struct TT_VertHeader_ |
michael@0 | 307 | { |
michael@0 | 308 | FT_Fixed Version; |
michael@0 | 309 | FT_Short Ascender; |
michael@0 | 310 | FT_Short Descender; |
michael@0 | 311 | FT_Short Line_Gap; |
michael@0 | 312 | |
michael@0 | 313 | FT_UShort advance_Height_Max; /* advance height maximum */ |
michael@0 | 314 | |
michael@0 | 315 | FT_Short min_Top_Side_Bearing; /* minimum left-sb or top-sb */ |
michael@0 | 316 | FT_Short min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */ |
michael@0 | 317 | FT_Short yMax_Extent; /* xmax or ymax extents */ |
michael@0 | 318 | FT_Short caret_Slope_Rise; |
michael@0 | 319 | FT_Short caret_Slope_Run; |
michael@0 | 320 | FT_Short caret_Offset; |
michael@0 | 321 | |
michael@0 | 322 | FT_Short Reserved[4]; |
michael@0 | 323 | |
michael@0 | 324 | FT_Short metric_Data_Format; |
michael@0 | 325 | FT_UShort number_Of_VMetrics; |
michael@0 | 326 | |
michael@0 | 327 | /* The following fields are not defined by the TrueType specification */ |
michael@0 | 328 | /* but they're used to connect the metrics header to the relevant */ |
michael@0 | 329 | /* `HMTX' or `VMTX' table. */ |
michael@0 | 330 | |
michael@0 | 331 | void* long_metrics; |
michael@0 | 332 | void* short_metrics; |
michael@0 | 333 | |
michael@0 | 334 | } TT_VertHeader; |
michael@0 | 335 | |
michael@0 | 336 | |
michael@0 | 337 | /*************************************************************************/ |
michael@0 | 338 | /* */ |
michael@0 | 339 | /* <Struct> */ |
michael@0 | 340 | /* TT_OS2 */ |
michael@0 | 341 | /* */ |
michael@0 | 342 | /* <Description> */ |
michael@0 | 343 | /* A structure used to model a TrueType OS/2 table. All fields */ |
michael@0 | 344 | /* comply to the OpenType specification. */ |
michael@0 | 345 | /* */ |
michael@0 | 346 | /* Note that we now support old Mac fonts that do not include an OS/2 */ |
michael@0 | 347 | /* table. In this case, the `version' field is always set to 0xFFFF. */ |
michael@0 | 348 | /* */ |
michael@0 | 349 | typedef struct TT_OS2_ |
michael@0 | 350 | { |
michael@0 | 351 | FT_UShort version; /* 0x0001 - more or 0xFFFF */ |
michael@0 | 352 | FT_Short xAvgCharWidth; |
michael@0 | 353 | FT_UShort usWeightClass; |
michael@0 | 354 | FT_UShort usWidthClass; |
michael@0 | 355 | FT_Short fsType; |
michael@0 | 356 | FT_Short ySubscriptXSize; |
michael@0 | 357 | FT_Short ySubscriptYSize; |
michael@0 | 358 | FT_Short ySubscriptXOffset; |
michael@0 | 359 | FT_Short ySubscriptYOffset; |
michael@0 | 360 | FT_Short ySuperscriptXSize; |
michael@0 | 361 | FT_Short ySuperscriptYSize; |
michael@0 | 362 | FT_Short ySuperscriptXOffset; |
michael@0 | 363 | FT_Short ySuperscriptYOffset; |
michael@0 | 364 | FT_Short yStrikeoutSize; |
michael@0 | 365 | FT_Short yStrikeoutPosition; |
michael@0 | 366 | FT_Short sFamilyClass; |
michael@0 | 367 | |
michael@0 | 368 | FT_Byte panose[10]; |
michael@0 | 369 | |
michael@0 | 370 | FT_ULong ulUnicodeRange1; /* Bits 0-31 */ |
michael@0 | 371 | FT_ULong ulUnicodeRange2; /* Bits 32-63 */ |
michael@0 | 372 | FT_ULong ulUnicodeRange3; /* Bits 64-95 */ |
michael@0 | 373 | FT_ULong ulUnicodeRange4; /* Bits 96-127 */ |
michael@0 | 374 | |
michael@0 | 375 | FT_Char achVendID[4]; |
michael@0 | 376 | |
michael@0 | 377 | FT_UShort fsSelection; |
michael@0 | 378 | FT_UShort usFirstCharIndex; |
michael@0 | 379 | FT_UShort usLastCharIndex; |
michael@0 | 380 | FT_Short sTypoAscender; |
michael@0 | 381 | FT_Short sTypoDescender; |
michael@0 | 382 | FT_Short sTypoLineGap; |
michael@0 | 383 | FT_UShort usWinAscent; |
michael@0 | 384 | FT_UShort usWinDescent; |
michael@0 | 385 | |
michael@0 | 386 | /* only version 1 and higher: */ |
michael@0 | 387 | |
michael@0 | 388 | FT_ULong ulCodePageRange1; /* Bits 0-31 */ |
michael@0 | 389 | FT_ULong ulCodePageRange2; /* Bits 32-63 */ |
michael@0 | 390 | |
michael@0 | 391 | /* only version 2 and higher: */ |
michael@0 | 392 | |
michael@0 | 393 | FT_Short sxHeight; |
michael@0 | 394 | FT_Short sCapHeight; |
michael@0 | 395 | FT_UShort usDefaultChar; |
michael@0 | 396 | FT_UShort usBreakChar; |
michael@0 | 397 | FT_UShort usMaxContext; |
michael@0 | 398 | |
michael@0 | 399 | /* only version 5 and higher: */ |
michael@0 | 400 | |
michael@0 | 401 | FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */ |
michael@0 | 402 | FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */ |
michael@0 | 403 | |
michael@0 | 404 | } TT_OS2; |
michael@0 | 405 | |
michael@0 | 406 | |
michael@0 | 407 | /*************************************************************************/ |
michael@0 | 408 | /* */ |
michael@0 | 409 | /* <Struct> */ |
michael@0 | 410 | /* TT_Postscript */ |
michael@0 | 411 | /* */ |
michael@0 | 412 | /* <Description> */ |
michael@0 | 413 | /* A structure used to model a TrueType PostScript table. All fields */ |
michael@0 | 414 | /* comply to the TrueType specification. This structure does not */ |
michael@0 | 415 | /* reference the PostScript glyph names, which can be nevertheless */ |
michael@0 | 416 | /* accessed with the `ttpost' module. */ |
michael@0 | 417 | /* */ |
michael@0 | 418 | typedef struct TT_Postscript_ |
michael@0 | 419 | { |
michael@0 | 420 | FT_Fixed FormatType; |
michael@0 | 421 | FT_Fixed italicAngle; |
michael@0 | 422 | FT_Short underlinePosition; |
michael@0 | 423 | FT_Short underlineThickness; |
michael@0 | 424 | FT_ULong isFixedPitch; |
michael@0 | 425 | FT_ULong minMemType42; |
michael@0 | 426 | FT_ULong maxMemType42; |
michael@0 | 427 | FT_ULong minMemType1; |
michael@0 | 428 | FT_ULong maxMemType1; |
michael@0 | 429 | |
michael@0 | 430 | /* Glyph names follow in the file, but we don't */ |
michael@0 | 431 | /* load them by default. See the ttpost.c file. */ |
michael@0 | 432 | |
michael@0 | 433 | } TT_Postscript; |
michael@0 | 434 | |
michael@0 | 435 | |
michael@0 | 436 | /*************************************************************************/ |
michael@0 | 437 | /* */ |
michael@0 | 438 | /* <Struct> */ |
michael@0 | 439 | /* TT_PCLT */ |
michael@0 | 440 | /* */ |
michael@0 | 441 | /* <Description> */ |
michael@0 | 442 | /* A structure used to model a TrueType PCLT table. All fields */ |
michael@0 | 443 | /* comply to the TrueType specification. */ |
michael@0 | 444 | /* */ |
michael@0 | 445 | typedef struct TT_PCLT_ |
michael@0 | 446 | { |
michael@0 | 447 | FT_Fixed Version; |
michael@0 | 448 | FT_ULong FontNumber; |
michael@0 | 449 | FT_UShort Pitch; |
michael@0 | 450 | FT_UShort xHeight; |
michael@0 | 451 | FT_UShort Style; |
michael@0 | 452 | FT_UShort TypeFamily; |
michael@0 | 453 | FT_UShort CapHeight; |
michael@0 | 454 | FT_UShort SymbolSet; |
michael@0 | 455 | FT_Char TypeFace[16]; |
michael@0 | 456 | FT_Char CharacterComplement[8]; |
michael@0 | 457 | FT_Char FileName[6]; |
michael@0 | 458 | FT_Char StrokeWeight; |
michael@0 | 459 | FT_Char WidthType; |
michael@0 | 460 | FT_Byte SerifStyle; |
michael@0 | 461 | FT_Byte Reserved; |
michael@0 | 462 | |
michael@0 | 463 | } TT_PCLT; |
michael@0 | 464 | |
michael@0 | 465 | |
michael@0 | 466 | /*************************************************************************/ |
michael@0 | 467 | /* */ |
michael@0 | 468 | /* <Struct> */ |
michael@0 | 469 | /* TT_MaxProfile */ |
michael@0 | 470 | /* */ |
michael@0 | 471 | /* <Description> */ |
michael@0 | 472 | /* The maximum profile is a table containing many max values, which */ |
michael@0 | 473 | /* can be used to pre-allocate arrays. This ensures that no memory */ |
michael@0 | 474 | /* allocation occurs during a glyph load. */ |
michael@0 | 475 | /* */ |
michael@0 | 476 | /* <Fields> */ |
michael@0 | 477 | /* version :: The version number. */ |
michael@0 | 478 | /* */ |
michael@0 | 479 | /* numGlyphs :: The number of glyphs in this TrueType */ |
michael@0 | 480 | /* font. */ |
michael@0 | 481 | /* */ |
michael@0 | 482 | /* maxPoints :: The maximum number of points in a */ |
michael@0 | 483 | /* non-composite TrueType glyph. See also */ |
michael@0 | 484 | /* the structure element */ |
michael@0 | 485 | /* `maxCompositePoints'. */ |
michael@0 | 486 | /* */ |
michael@0 | 487 | /* maxContours :: The maximum number of contours in a */ |
michael@0 | 488 | /* non-composite TrueType glyph. See also */ |
michael@0 | 489 | /* the structure element */ |
michael@0 | 490 | /* `maxCompositeContours'. */ |
michael@0 | 491 | /* */ |
michael@0 | 492 | /* maxCompositePoints :: The maximum number of points in a */ |
michael@0 | 493 | /* composite TrueType glyph. See also the */ |
michael@0 | 494 | /* structure element `maxPoints'. */ |
michael@0 | 495 | /* */ |
michael@0 | 496 | /* maxCompositeContours :: The maximum number of contours in a */ |
michael@0 | 497 | /* composite TrueType glyph. See also the */ |
michael@0 | 498 | /* structure element `maxContours'. */ |
michael@0 | 499 | /* */ |
michael@0 | 500 | /* maxZones :: The maximum number of zones used for */ |
michael@0 | 501 | /* glyph hinting. */ |
michael@0 | 502 | /* */ |
michael@0 | 503 | /* maxTwilightPoints :: The maximum number of points in the */ |
michael@0 | 504 | /* twilight zone used for glyph hinting. */ |
michael@0 | 505 | /* */ |
michael@0 | 506 | /* maxStorage :: The maximum number of elements in the */ |
michael@0 | 507 | /* storage area used for glyph hinting. */ |
michael@0 | 508 | /* */ |
michael@0 | 509 | /* maxFunctionDefs :: The maximum number of function */ |
michael@0 | 510 | /* definitions in the TrueType bytecode for */ |
michael@0 | 511 | /* this font. */ |
michael@0 | 512 | /* */ |
michael@0 | 513 | /* maxInstructionDefs :: The maximum number of instruction */ |
michael@0 | 514 | /* definitions in the TrueType bytecode for */ |
michael@0 | 515 | /* this font. */ |
michael@0 | 516 | /* */ |
michael@0 | 517 | /* maxStackElements :: The maximum number of stack elements used */ |
michael@0 | 518 | /* during bytecode interpretation. */ |
michael@0 | 519 | /* */ |
michael@0 | 520 | /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ |
michael@0 | 521 | /* used for glyph hinting. */ |
michael@0 | 522 | /* */ |
michael@0 | 523 | /* maxComponentElements :: The maximum number of simple (i.e., non- */ |
michael@0 | 524 | /* composite) glyphs in a composite glyph. */ |
michael@0 | 525 | /* */ |
michael@0 | 526 | /* maxComponentDepth :: The maximum nesting depth of composite */ |
michael@0 | 527 | /* glyphs. */ |
michael@0 | 528 | /* */ |
michael@0 | 529 | /* <Note> */ |
michael@0 | 530 | /* This structure is only used during font loading. */ |
michael@0 | 531 | /* */ |
michael@0 | 532 | typedef struct TT_MaxProfile_ |
michael@0 | 533 | { |
michael@0 | 534 | FT_Fixed version; |
michael@0 | 535 | FT_UShort numGlyphs; |
michael@0 | 536 | FT_UShort maxPoints; |
michael@0 | 537 | FT_UShort maxContours; |
michael@0 | 538 | FT_UShort maxCompositePoints; |
michael@0 | 539 | FT_UShort maxCompositeContours; |
michael@0 | 540 | FT_UShort maxZones; |
michael@0 | 541 | FT_UShort maxTwilightPoints; |
michael@0 | 542 | FT_UShort maxStorage; |
michael@0 | 543 | FT_UShort maxFunctionDefs; |
michael@0 | 544 | FT_UShort maxInstructionDefs; |
michael@0 | 545 | FT_UShort maxStackElements; |
michael@0 | 546 | FT_UShort maxSizeOfInstructions; |
michael@0 | 547 | FT_UShort maxComponentElements; |
michael@0 | 548 | FT_UShort maxComponentDepth; |
michael@0 | 549 | |
michael@0 | 550 | } TT_MaxProfile; |
michael@0 | 551 | |
michael@0 | 552 | |
michael@0 | 553 | /*************************************************************************/ |
michael@0 | 554 | /* */ |
michael@0 | 555 | /* <Enum> */ |
michael@0 | 556 | /* FT_Sfnt_Tag */ |
michael@0 | 557 | /* */ |
michael@0 | 558 | /* <Description> */ |
michael@0 | 559 | /* An enumeration used to specify the index of an SFNT table. */ |
michael@0 | 560 | /* Used in the @FT_Get_Sfnt_Table API function. */ |
michael@0 | 561 | /* */ |
michael@0 | 562 | typedef enum FT_Sfnt_Tag_ |
michael@0 | 563 | { |
michael@0 | 564 | ft_sfnt_head = 0, /* TT_Header */ |
michael@0 | 565 | ft_sfnt_maxp = 1, /* TT_MaxProfile */ |
michael@0 | 566 | ft_sfnt_os2 = 2, /* TT_OS2 */ |
michael@0 | 567 | ft_sfnt_hhea = 3, /* TT_HoriHeader */ |
michael@0 | 568 | ft_sfnt_vhea = 4, /* TT_VertHeader */ |
michael@0 | 569 | ft_sfnt_post = 5, /* TT_Postscript */ |
michael@0 | 570 | ft_sfnt_pclt = 6, /* TT_PCLT */ |
michael@0 | 571 | |
michael@0 | 572 | sfnt_max /* internal end mark */ |
michael@0 | 573 | |
michael@0 | 574 | } FT_Sfnt_Tag; |
michael@0 | 575 | |
michael@0 | 576 | /* */ |
michael@0 | 577 | |
michael@0 | 578 | |
michael@0 | 579 | /*************************************************************************/ |
michael@0 | 580 | /* */ |
michael@0 | 581 | /* <Function> */ |
michael@0 | 582 | /* FT_Get_Sfnt_Table */ |
michael@0 | 583 | /* */ |
michael@0 | 584 | /* <Description> */ |
michael@0 | 585 | /* Return a pointer to a given SFNT table within a face. */ |
michael@0 | 586 | /* */ |
michael@0 | 587 | /* <Input> */ |
michael@0 | 588 | /* face :: A handle to the source. */ |
michael@0 | 589 | /* */ |
michael@0 | 590 | /* tag :: The index of the SFNT table. */ |
michael@0 | 591 | /* */ |
michael@0 | 592 | /* <Return> */ |
michael@0 | 593 | /* A type-less pointer to the table. This will be~0 in case of */ |
michael@0 | 594 | /* error, or if the corresponding table was not found *OR* loaded */ |
michael@0 | 595 | /* from the file. */ |
michael@0 | 596 | /* */ |
michael@0 | 597 | /* Use a typecast according to `tag' to access the structure */ |
michael@0 | 598 | /* elements. */ |
michael@0 | 599 | /* */ |
michael@0 | 600 | /* <Note> */ |
michael@0 | 601 | /* The table is owned by the face object and disappears with it. */ |
michael@0 | 602 | /* */ |
michael@0 | 603 | /* This function is only useful to access SFNT tables that are loaded */ |
michael@0 | 604 | /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ |
michael@0 | 605 | /* a list. */ |
michael@0 | 606 | /* */ |
michael@0 | 607 | /* Here an example how to access the `vhea' table: */ |
michael@0 | 608 | /* */ |
michael@0 | 609 | /* { */ |
michael@0 | 610 | /* TT_VertHeader* vert_header; */ |
michael@0 | 611 | /* */ |
michael@0 | 612 | /* */ |
michael@0 | 613 | /* vert_header = */ |
michael@0 | 614 | /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ |
michael@0 | 615 | /* } */ |
michael@0 | 616 | /* */ |
michael@0 | 617 | FT_EXPORT( void* ) |
michael@0 | 618 | FT_Get_Sfnt_Table( FT_Face face, |
michael@0 | 619 | FT_Sfnt_Tag tag ); |
michael@0 | 620 | |
michael@0 | 621 | |
michael@0 | 622 | /************************************************************************** |
michael@0 | 623 | * |
michael@0 | 624 | * @function: |
michael@0 | 625 | * FT_Load_Sfnt_Table |
michael@0 | 626 | * |
michael@0 | 627 | * @description: |
michael@0 | 628 | * Load any font table into client memory. |
michael@0 | 629 | * |
michael@0 | 630 | * @input: |
michael@0 | 631 | * face :: |
michael@0 | 632 | * A handle to the source face. |
michael@0 | 633 | * |
michael@0 | 634 | * tag :: |
michael@0 | 635 | * The four-byte tag of the table to load. Use the value~0 if you want |
michael@0 | 636 | * to access the whole font file. Otherwise, you can use one of the |
michael@0 | 637 | * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new |
michael@0 | 638 | * one with @FT_MAKE_TAG. |
michael@0 | 639 | * |
michael@0 | 640 | * offset :: |
michael@0 | 641 | * The starting offset in the table (or file if tag == 0). |
michael@0 | 642 | * |
michael@0 | 643 | * @output: |
michael@0 | 644 | * buffer :: |
michael@0 | 645 | * The target buffer address. The client must ensure that the memory |
michael@0 | 646 | * array is big enough to hold the data. |
michael@0 | 647 | * |
michael@0 | 648 | * @inout: |
michael@0 | 649 | * length :: |
michael@0 | 650 | * If the `length' parameter is NULL, then try to load the whole table. |
michael@0 | 651 | * Return an error code if it fails. |
michael@0 | 652 | * |
michael@0 | 653 | * Else, if `*length' is~0, exit immediately while returning the |
michael@0 | 654 | * table's (or file) full size in it. |
michael@0 | 655 | * |
michael@0 | 656 | * Else the number of bytes to read from the table or file, from the |
michael@0 | 657 | * starting offset. |
michael@0 | 658 | * |
michael@0 | 659 | * @return: |
michael@0 | 660 | * FreeType error code. 0~means success. |
michael@0 | 661 | * |
michael@0 | 662 | * @note: |
michael@0 | 663 | * If you need to determine the table's length you should first call this |
michael@0 | 664 | * function with `*length' set to~0, as in the following example: |
michael@0 | 665 | * |
michael@0 | 666 | * { |
michael@0 | 667 | * FT_ULong length = 0; |
michael@0 | 668 | * |
michael@0 | 669 | * |
michael@0 | 670 | * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); |
michael@0 | 671 | * if ( error ) { ... table does not exist ... } |
michael@0 | 672 | * |
michael@0 | 673 | * buffer = malloc( length ); |
michael@0 | 674 | * if ( buffer == NULL ) { ... not enough memory ... } |
michael@0 | 675 | * |
michael@0 | 676 | * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); |
michael@0 | 677 | * if ( error ) { ... could not load table ... } |
michael@0 | 678 | * } |
michael@0 | 679 | * |
michael@0 | 680 | * Note that structures like @TT_Header or @TT_OS2 can't be used with |
michael@0 | 681 | * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that |
michael@0 | 682 | * those structures depend on the processor architecture, with varying |
michael@0 | 683 | * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). |
michael@0 | 684 | * |
michael@0 | 685 | */ |
michael@0 | 686 | FT_EXPORT( FT_Error ) |
michael@0 | 687 | FT_Load_Sfnt_Table( FT_Face face, |
michael@0 | 688 | FT_ULong tag, |
michael@0 | 689 | FT_Long offset, |
michael@0 | 690 | FT_Byte* buffer, |
michael@0 | 691 | FT_ULong* length ); |
michael@0 | 692 | |
michael@0 | 693 | |
michael@0 | 694 | /************************************************************************** |
michael@0 | 695 | * |
michael@0 | 696 | * @function: |
michael@0 | 697 | * FT_Sfnt_Table_Info |
michael@0 | 698 | * |
michael@0 | 699 | * @description: |
michael@0 | 700 | * Return information on an SFNT table. |
michael@0 | 701 | * |
michael@0 | 702 | * @input: |
michael@0 | 703 | * face :: |
michael@0 | 704 | * A handle to the source face. |
michael@0 | 705 | * |
michael@0 | 706 | * table_index :: |
michael@0 | 707 | * The index of an SFNT table. The function returns |
michael@0 | 708 | * FT_Err_Table_Missing for an invalid value. |
michael@0 | 709 | * |
michael@0 | 710 | * @inout: |
michael@0 | 711 | * tag :: |
michael@0 | 712 | * The name tag of the SFNT table. If the value is NULL, `table_index' |
michael@0 | 713 | * is ignored, and `length' returns the number of SFNT tables in the |
michael@0 | 714 | * font. |
michael@0 | 715 | * |
michael@0 | 716 | * @output: |
michael@0 | 717 | * length :: |
michael@0 | 718 | * The length of the SFNT table (or the number of SFNT tables, depending |
michael@0 | 719 | * on `tag'). |
michael@0 | 720 | * |
michael@0 | 721 | * @return: |
michael@0 | 722 | * FreeType error code. 0~means success. |
michael@0 | 723 | * |
michael@0 | 724 | * @note: |
michael@0 | 725 | * While parsing fonts, FreeType handles SFNT tables with length zero as |
michael@0 | 726 | * missing. |
michael@0 | 727 | * |
michael@0 | 728 | */ |
michael@0 | 729 | FT_EXPORT( FT_Error ) |
michael@0 | 730 | FT_Sfnt_Table_Info( FT_Face face, |
michael@0 | 731 | FT_UInt table_index, |
michael@0 | 732 | FT_ULong *tag, |
michael@0 | 733 | FT_ULong *length ); |
michael@0 | 734 | |
michael@0 | 735 | |
michael@0 | 736 | /*************************************************************************/ |
michael@0 | 737 | /* */ |
michael@0 | 738 | /* <Function> */ |
michael@0 | 739 | /* FT_Get_CMap_Language_ID */ |
michael@0 | 740 | /* */ |
michael@0 | 741 | /* <Description> */ |
michael@0 | 742 | /* Return TrueType/sfnt specific cmap language ID. Definitions of */ |
michael@0 | 743 | /* language ID values are in `ttnameid.h'. */ |
michael@0 | 744 | /* */ |
michael@0 | 745 | /* <Input> */ |
michael@0 | 746 | /* charmap :: */ |
michael@0 | 747 | /* The target charmap. */ |
michael@0 | 748 | /* */ |
michael@0 | 749 | /* <Return> */ |
michael@0 | 750 | /* The language ID of `charmap'. If `charmap' doesn't belong to a */ |
michael@0 | 751 | /* TrueType/sfnt face, just return~0 as the default value. */ |
michael@0 | 752 | /* */ |
michael@0 | 753 | /* For a format~14 cmap (to access Unicode IVS), the return value is */ |
michael@0 | 754 | /* 0xFFFFFFFF. */ |
michael@0 | 755 | /* */ |
michael@0 | 756 | FT_EXPORT( FT_ULong ) |
michael@0 | 757 | FT_Get_CMap_Language_ID( FT_CharMap charmap ); |
michael@0 | 758 | |
michael@0 | 759 | |
michael@0 | 760 | /*************************************************************************/ |
michael@0 | 761 | /* */ |
michael@0 | 762 | /* <Function> */ |
michael@0 | 763 | /* FT_Get_CMap_Format */ |
michael@0 | 764 | /* */ |
michael@0 | 765 | /* <Description> */ |
michael@0 | 766 | /* Return TrueType/sfnt specific cmap format. */ |
michael@0 | 767 | /* */ |
michael@0 | 768 | /* <Input> */ |
michael@0 | 769 | /* charmap :: */ |
michael@0 | 770 | /* The target charmap. */ |
michael@0 | 771 | /* */ |
michael@0 | 772 | /* <Return> */ |
michael@0 | 773 | /* The format of `charmap'. If `charmap' doesn't belong to a */ |
michael@0 | 774 | /* TrueType/sfnt face, return -1. */ |
michael@0 | 775 | /* */ |
michael@0 | 776 | FT_EXPORT( FT_Long ) |
michael@0 | 777 | FT_Get_CMap_Format( FT_CharMap charmap ); |
michael@0 | 778 | |
michael@0 | 779 | /* */ |
michael@0 | 780 | |
michael@0 | 781 | |
michael@0 | 782 | FT_END_HEADER |
michael@0 | 783 | |
michael@0 | 784 | #endif /* __TTTABLES_H__ */ |
michael@0 | 785 | |
michael@0 | 786 | |
michael@0 | 787 | /* END */ |