tttables.h 41 KB

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