tttypes.h 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516
  1. /***************************************************************************/
  2. /* */
  3. /* tttypes.h */
  4. /* */
  5. /* Basic SFNT/TrueType type definitions and interface (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 1996-2002, 2004-2008, 2012-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 __TTTYPES_H__
  19. #define __TTTYPES_H__
  20. #include <ft2build.h>
  21. #include FT_TRUETYPE_TABLES_H
  22. #include FT_INTERNAL_OBJECTS_H
  23. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  24. #include FT_MULTIPLE_MASTERS_H
  25. #endif
  26. FT_BEGIN_HEADER
  27. /*************************************************************************/
  28. /*************************************************************************/
  29. /*************************************************************************/
  30. /*** ***/
  31. /*** ***/
  32. /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
  33. /*** ***/
  34. /*** ***/
  35. /*************************************************************************/
  36. /*************************************************************************/
  37. /*************************************************************************/
  38. /*************************************************************************/
  39. /* */
  40. /* <Struct> */
  41. /* TTC_HeaderRec */
  42. /* */
  43. /* <Description> */
  44. /* TrueType collection header. This table contains the offsets of */
  45. /* the font headers of each distinct TrueType face in the file. */
  46. /* */
  47. /* <Fields> */
  48. /* tag :: Must be `ttc ' to indicate a TrueType collection. */
  49. /* */
  50. /* version :: The version number. */
  51. /* */
  52. /* count :: The number of faces in the collection. The */
  53. /* specification says this should be an unsigned long, but */
  54. /* we use a signed long since we need the value -1 for */
  55. /* specific purposes. */
  56. /* */
  57. /* offsets :: The offsets of the font headers, one per face. */
  58. /* */
  59. typedef struct TTC_HeaderRec_
  60. {
  61. FT_ULong tag;
  62. FT_Fixed version;
  63. FT_Long count;
  64. FT_ULong* offsets;
  65. } TTC_HeaderRec;
  66. /*************************************************************************/
  67. /* */
  68. /* <Struct> */
  69. /* SFNT_HeaderRec */
  70. /* */
  71. /* <Description> */
  72. /* SFNT file format header. */
  73. /* */
  74. /* <Fields> */
  75. /* format_tag :: The font format tag. */
  76. /* */
  77. /* num_tables :: The number of tables in file. */
  78. /* */
  79. /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */
  80. /* */
  81. /* entry_selector :: Must be log2 of `search_range / 16'. */
  82. /* */
  83. /* range_shift :: Must be `num_tables * 16 - search_range'. */
  84. /* */
  85. typedef struct SFNT_HeaderRec_
  86. {
  87. FT_ULong format_tag;
  88. FT_UShort num_tables;
  89. FT_UShort search_range;
  90. FT_UShort entry_selector;
  91. FT_UShort range_shift;
  92. FT_ULong offset; /* not in file */
  93. } SFNT_HeaderRec, *SFNT_Header;
  94. /*************************************************************************/
  95. /* */
  96. /* <Struct> */
  97. /* TT_TableRec */
  98. /* */
  99. /* <Description> */
  100. /* This structure describes a given table of a TrueType font. */
  101. /* */
  102. /* <Fields> */
  103. /* Tag :: A four-bytes tag describing the table. */
  104. /* */
  105. /* CheckSum :: The table checksum. This value can be ignored. */
  106. /* */
  107. /* Offset :: The offset of the table from the start of the TrueType */
  108. /* font in its resource. */
  109. /* */
  110. /* Length :: The table length (in bytes). */
  111. /* */
  112. typedef struct TT_TableRec_
  113. {
  114. FT_ULong Tag; /* table type */
  115. FT_ULong CheckSum; /* table checksum */
  116. FT_ULong Offset; /* table file offset */
  117. FT_ULong Length; /* table length */
  118. } TT_TableRec, *TT_Table;
  119. /*************************************************************************/
  120. /* */
  121. /* <Struct> */
  122. /* WOFF_HeaderRec */
  123. /* */
  124. /* <Description> */
  125. /* WOFF file format header. */
  126. /* */
  127. /* <Fields> */
  128. /* See */
  129. /* */
  130. /* http://www.w3.org/TR/WOFF/#WOFFHeader */
  131. /* */
  132. typedef struct WOFF_HeaderRec_
  133. {
  134. FT_ULong signature;
  135. FT_ULong flavor;
  136. FT_ULong length;
  137. FT_UShort num_tables;
  138. FT_UShort reserved;
  139. FT_ULong totalSfntSize;
  140. FT_UShort majorVersion;
  141. FT_UShort minorVersion;
  142. FT_ULong metaOffset;
  143. FT_ULong metaLength;
  144. FT_ULong metaOrigLength;
  145. FT_ULong privOffset;
  146. FT_ULong privLength;
  147. } WOFF_HeaderRec, *WOFF_Header;
  148. /*************************************************************************/
  149. /* */
  150. /* <Struct> */
  151. /* WOFF_TableRec */
  152. /* */
  153. /* <Description> */
  154. /* This structure describes a given table of a WOFF font. */
  155. /* */
  156. /* <Fields> */
  157. /* Tag :: A four-bytes tag describing the table. */
  158. /* */
  159. /* Offset :: The offset of the table from the start of the WOFF */
  160. /* font in its resource. */
  161. /* */
  162. /* CompLength :: Compressed table length (in bytes). */
  163. /* */
  164. /* OrigLength :: Unompressed table length (in bytes). */
  165. /* */
  166. /* CheckSum :: The table checksum. This value can be ignored. */
  167. /* */
  168. /* OrigOffset :: The uncompressed table file offset. This value gets */
  169. /* computed while constructing the (uncompressed) SFNT */
  170. /* header. It is not contained in the WOFF file. */
  171. /* */
  172. typedef struct WOFF_TableRec_
  173. {
  174. FT_ULong Tag; /* table ID */
  175. FT_ULong Offset; /* table file offset */
  176. FT_ULong CompLength; /* compressed table length */
  177. FT_ULong OrigLength; /* uncompressed table length */
  178. FT_ULong CheckSum; /* uncompressed checksum */
  179. FT_ULong OrigOffset; /* uncompressed table file offset */
  180. /* (not in the WOFF file) */
  181. } WOFF_TableRec, *WOFF_Table;
  182. /*************************************************************************/
  183. /* */
  184. /* <Struct> */
  185. /* TT_LongMetricsRec */
  186. /* */
  187. /* <Description> */
  188. /* A structure modeling the long metrics of the `hmtx' and `vmtx' */
  189. /* TrueType tables. The values are expressed in font units. */
  190. /* */
  191. /* <Fields> */
  192. /* advance :: The advance width or height for the glyph. */
  193. /* */
  194. /* bearing :: The left-side or top-side bearing for the glyph. */
  195. /* */
  196. typedef struct TT_LongMetricsRec_
  197. {
  198. FT_UShort advance;
  199. FT_Short bearing;
  200. } TT_LongMetricsRec, *TT_LongMetrics;
  201. /*************************************************************************/
  202. /* */
  203. /* <Type> */
  204. /* TT_ShortMetrics */
  205. /* */
  206. /* <Description> */
  207. /* A simple type to model the short metrics of the `hmtx' and `vmtx' */
  208. /* tables. */
  209. /* */
  210. typedef FT_Short TT_ShortMetrics;
  211. /*************************************************************************/
  212. /* */
  213. /* <Struct> */
  214. /* TT_NameEntryRec */
  215. /* */
  216. /* <Description> */
  217. /* A structure modeling TrueType name records. Name records are used */
  218. /* to store important strings like family name, style name, */
  219. /* copyright, etc. in _localized_ versions (i.e., language, encoding, */
  220. /* etc). */
  221. /* */
  222. /* <Fields> */
  223. /* platformID :: The ID of the name's encoding platform. */
  224. /* */
  225. /* encodingID :: The platform-specific ID for the name's encoding. */
  226. /* */
  227. /* languageID :: The platform-specific ID for the name's language. */
  228. /* */
  229. /* nameID :: The ID specifying what kind of name this is. */
  230. /* */
  231. /* stringLength :: The length of the string in bytes. */
  232. /* */
  233. /* stringOffset :: The offset to the string in the `name' table. */
  234. /* */
  235. /* string :: A pointer to the string's bytes. Note that these */
  236. /* are usually UTF-16 encoded characters. */
  237. /* */
  238. typedef struct TT_NameEntryRec_
  239. {
  240. FT_UShort platformID;
  241. FT_UShort encodingID;
  242. FT_UShort languageID;
  243. FT_UShort nameID;
  244. FT_UShort stringLength;
  245. FT_ULong stringOffset;
  246. /* this last field is not defined in the spec */
  247. /* but used by the FreeType engine */
  248. FT_Byte* string;
  249. } TT_NameEntryRec, *TT_NameEntry;
  250. /*************************************************************************/
  251. /* */
  252. /* <Struct> */
  253. /* TT_NameTableRec */
  254. /* */
  255. /* <Description> */
  256. /* A structure modeling the TrueType name table. */
  257. /* */
  258. /* <Fields> */
  259. /* format :: The format of the name table. */
  260. /* */
  261. /* numNameRecords :: The number of names in table. */
  262. /* */
  263. /* storageOffset :: The offset of the name table in the `name' */
  264. /* TrueType table. */
  265. /* */
  266. /* names :: An array of name records. */
  267. /* */
  268. /* stream :: the file's input stream. */
  269. /* */
  270. typedef struct TT_NameTableRec_
  271. {
  272. FT_UShort format;
  273. FT_UInt numNameRecords;
  274. FT_UInt storageOffset;
  275. TT_NameEntryRec* names;
  276. FT_Stream stream;
  277. } TT_NameTableRec, *TT_NameTable;
  278. /*************************************************************************/
  279. /*************************************************************************/
  280. /*************************************************************************/
  281. /*** ***/
  282. /*** ***/
  283. /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
  284. /*** ***/
  285. /*** ***/
  286. /*************************************************************************/
  287. /*************************************************************************/
  288. /*************************************************************************/
  289. /*************************************************************************/
  290. /* */
  291. /* <Struct> */
  292. /* TT_GaspRangeRec */
  293. /* */
  294. /* <Description> */
  295. /* A tiny structure used to model a gasp range according to the */
  296. /* TrueType specification. */
  297. /* */
  298. /* <Fields> */
  299. /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
  300. /* */
  301. /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
  302. /* modes to be used. */
  303. /* */
  304. typedef struct TT_GaspRangeRec_
  305. {
  306. FT_UShort maxPPEM;
  307. FT_UShort gaspFlag;
  308. } TT_GaspRangeRec, *TT_GaspRange;
  309. #define TT_GASP_GRIDFIT 0x01
  310. #define TT_GASP_DOGRAY 0x02
  311. /*************************************************************************/
  312. /* */
  313. /* <Struct> */
  314. /* TT_GaspRec */
  315. /* */
  316. /* <Description> */
  317. /* A structure modeling the TrueType `gasp' table used to specify */
  318. /* grid-fitting and anti-aliasing behaviour. */
  319. /* */
  320. /* <Fields> */
  321. /* version :: The version number. */
  322. /* */
  323. /* numRanges :: The number of gasp ranges in table. */
  324. /* */
  325. /* gaspRanges :: An array of gasp ranges. */
  326. /* */
  327. typedef struct TT_Gasp_
  328. {
  329. FT_UShort version;
  330. FT_UShort numRanges;
  331. TT_GaspRange gaspRanges;
  332. } TT_GaspRec;
  333. /*************************************************************************/
  334. /*************************************************************************/
  335. /*************************************************************************/
  336. /*** ***/
  337. /*** ***/
  338. /*** EMBEDDED BITMAPS SUPPORT ***/
  339. /*** ***/
  340. /*** ***/
  341. /*************************************************************************/
  342. /*************************************************************************/
  343. /*************************************************************************/
  344. /*************************************************************************/
  345. /* */
  346. /* <Struct> */
  347. /* TT_SBit_MetricsRec */
  348. /* */
  349. /* <Description> */
  350. /* A structure used to hold the big metrics of a given glyph bitmap */
  351. /* in a TrueType or OpenType font. These are usually found in the */
  352. /* `EBDT' (Microsoft) or `bloc' (Apple) table. */
  353. /* */
  354. /* <Fields> */
  355. /* height :: The glyph height in pixels. */
  356. /* */
  357. /* width :: The glyph width in pixels. */
  358. /* */
  359. /* horiBearingX :: The horizontal left bearing. */
  360. /* */
  361. /* horiBearingY :: The horizontal top bearing. */
  362. /* */
  363. /* horiAdvance :: The horizontal advance. */
  364. /* */
  365. /* vertBearingX :: The vertical left bearing. */
  366. /* */
  367. /* vertBearingY :: The vertical top bearing. */
  368. /* */
  369. /* vertAdvance :: The vertical advance. */
  370. /* */
  371. typedef struct TT_SBit_MetricsRec_
  372. {
  373. FT_UShort height;
  374. FT_UShort width;
  375. FT_Short horiBearingX;
  376. FT_Short horiBearingY;
  377. FT_UShort horiAdvance;
  378. FT_Short vertBearingX;
  379. FT_Short vertBearingY;
  380. FT_UShort vertAdvance;
  381. } TT_SBit_MetricsRec, *TT_SBit_Metrics;
  382. /*************************************************************************/
  383. /* */
  384. /* <Struct> */
  385. /* TT_SBit_SmallMetricsRec */
  386. /* */
  387. /* <Description> */
  388. /* A structure used to hold the small metrics of a given glyph bitmap */
  389. /* in a TrueType or OpenType font. These are usually found in the */
  390. /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
  391. /* */
  392. /* <Fields> */
  393. /* height :: The glyph height in pixels. */
  394. /* */
  395. /* width :: The glyph width in pixels. */
  396. /* */
  397. /* bearingX :: The left-side bearing. */
  398. /* */
  399. /* bearingY :: The top-side bearing. */
  400. /* */
  401. /* advance :: The advance width or height. */
  402. /* */
  403. typedef struct TT_SBit_Small_Metrics_
  404. {
  405. FT_Byte height;
  406. FT_Byte width;
  407. FT_Char bearingX;
  408. FT_Char bearingY;
  409. FT_Byte advance;
  410. } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;
  411. /*************************************************************************/
  412. /* */
  413. /* <Struct> */
  414. /* TT_SBit_LineMetricsRec */
  415. /* */
  416. /* <Description> */
  417. /* A structure used to describe the text line metrics of a given */
  418. /* bitmap strike, for either a horizontal or vertical layout. */
  419. /* */
  420. /* <Fields> */
  421. /* ascender :: The ascender in pixels. */
  422. /* */
  423. /* descender :: The descender in pixels. */
  424. /* */
  425. /* max_width :: The maximum glyph width in pixels. */
  426. /* */
  427. /* caret_slope_enumerator :: Rise of the caret slope, typically set */
  428. /* to 1 for non-italic fonts. */
  429. /* */
  430. /* caret_slope_denominator :: Rise of the caret slope, typically set */
  431. /* to 0 for non-italic fonts. */
  432. /* */
  433. /* caret_offset :: Offset in pixels to move the caret for */
  434. /* proper positioning. */
  435. /* */
  436. /* min_origin_SB :: Minimum of horiBearingX (resp. */
  437. /* vertBearingY). */
  438. /* min_advance_SB :: Minimum of */
  439. /* */
  440. /* horizontal advance - */
  441. /* ( horiBearingX + width ) */
  442. /* */
  443. /* resp. */
  444. /* */
  445. /* vertical advance - */
  446. /* ( vertBearingY + height ) */
  447. /* */
  448. /* max_before_BL :: Maximum of horiBearingY (resp. */
  449. /* vertBearingY). */
  450. /* */
  451. /* min_after_BL :: Minimum of */
  452. /* */
  453. /* horiBearingY - height */
  454. /* */
  455. /* resp. */
  456. /* */
  457. /* vertBearingX - width */
  458. /* */
  459. /* pads :: Unused (to make the size of the record */
  460. /* a multiple of 32 bits. */
  461. /* */
  462. typedef struct TT_SBit_LineMetricsRec_
  463. {
  464. FT_Char ascender;
  465. FT_Char descender;
  466. FT_Byte max_width;
  467. FT_Char caret_slope_numerator;
  468. FT_Char caret_slope_denominator;
  469. FT_Char caret_offset;
  470. FT_Char min_origin_SB;
  471. FT_Char min_advance_SB;
  472. FT_Char max_before_BL;
  473. FT_Char min_after_BL;
  474. FT_Char pads[2];
  475. } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;
  476. /*************************************************************************/
  477. /* */
  478. /* <Struct> */
  479. /* TT_SBit_RangeRec */
  480. /* */
  481. /* <Description> */
  482. /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
  483. /* (Microsoft) or `bloc' (Apple) tables. */
  484. /* */
  485. /* <Fields> */
  486. /* first_glyph :: The first glyph index in the range. */
  487. /* */
  488. /* last_glyph :: The last glyph index in the range. */
  489. /* */
  490. /* index_format :: The format of index table. Valid values are 1 */
  491. /* to 5. */
  492. /* */
  493. /* image_format :: The format of `EBDT' image data. */
  494. /* */
  495. /* image_offset :: The offset to image data in `EBDT'. */
  496. /* */
  497. /* image_size :: For index formats 2 and 5. This is the size in */
  498. /* bytes of each glyph bitmap. */
  499. /* */
  500. /* big_metrics :: For index formats 2 and 5. This is the big */
  501. /* metrics for each glyph bitmap. */
  502. /* */
  503. /* num_glyphs :: For index formats 4 and 5. This is the number of */
  504. /* glyphs in the code array. */
  505. /* */
  506. /* glyph_offsets :: For index formats 1 and 3. */
  507. /* */
  508. /* glyph_codes :: For index formats 4 and 5. */
  509. /* */
  510. /* table_offset :: The offset of the index table in the `EBLC' */
  511. /* table. Only used during strike loading. */
  512. /* */
  513. typedef struct TT_SBit_RangeRec_
  514. {
  515. FT_UShort first_glyph;
  516. FT_UShort last_glyph;
  517. FT_UShort index_format;
  518. FT_UShort image_format;
  519. FT_ULong image_offset;
  520. FT_ULong image_size;
  521. TT_SBit_MetricsRec metrics;
  522. FT_ULong num_glyphs;
  523. FT_ULong* glyph_offsets;
  524. FT_UShort* glyph_codes;
  525. FT_ULong table_offset;
  526. } TT_SBit_RangeRec, *TT_SBit_Range;
  527. /*************************************************************************/
  528. /* */
  529. /* <Struct> */
  530. /* TT_SBit_StrikeRec */
  531. /* */
  532. /* <Description> */
  533. /* A structure used describe a given bitmap strike in the `EBLC' */
  534. /* (Microsoft) or `bloc' (Apple) tables. */
  535. /* */
  536. /* <Fields> */
  537. /* num_index_ranges :: The number of index ranges. */
  538. /* */
  539. /* index_ranges :: An array of glyph index ranges. */
  540. /* */
  541. /* color_ref :: Unused. `color_ref' is put in for future */
  542. /* enhancements, but these fields are already */
  543. /* in use by other platforms (e.g. Newton). */
  544. /* For details, please see */
  545. /* */
  546. /* http://fonts.apple.com/ */
  547. /* TTRefMan/RM06/Chap6bloc.html */
  548. /* */
  549. /* hori :: The line metrics for horizontal layouts. */
  550. /* */
  551. /* vert :: The line metrics for vertical layouts. */
  552. /* */
  553. /* start_glyph :: The lowest glyph index for this strike. */
  554. /* */
  555. /* end_glyph :: The highest glyph index for this strike. */
  556. /* */
  557. /* x_ppem :: The number of horizontal pixels per EM. */
  558. /* */
  559. /* y_ppem :: The number of vertical pixels per EM. */
  560. /* */
  561. /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
  562. /* and 8. */
  563. /* */
  564. /* flags :: Is this a vertical or horizontal strike? For */
  565. /* details, please see */
  566. /* */
  567. /* http://fonts.apple.com/ */
  568. /* TTRefMan/RM06/Chap6bloc.html */
  569. /* */
  570. typedef struct TT_SBit_StrikeRec_
  571. {
  572. FT_Int num_ranges;
  573. TT_SBit_Range sbit_ranges;
  574. FT_ULong ranges_offset;
  575. FT_ULong color_ref;
  576. TT_SBit_LineMetricsRec hori;
  577. TT_SBit_LineMetricsRec vert;
  578. FT_UShort start_glyph;
  579. FT_UShort end_glyph;
  580. FT_Byte x_ppem;
  581. FT_Byte y_ppem;
  582. FT_Byte bit_depth;
  583. FT_Char flags;
  584. } TT_SBit_StrikeRec, *TT_SBit_Strike;
  585. /*************************************************************************/
  586. /* */
  587. /* <Struct> */
  588. /* TT_SBit_ComponentRec */
  589. /* */
  590. /* <Description> */
  591. /* A simple structure to describe a compound sbit element. */
  592. /* */
  593. /* <Fields> */
  594. /* glyph_code :: The element's glyph index. */
  595. /* */
  596. /* x_offset :: The element's left bearing. */
  597. /* */
  598. /* y_offset :: The element's top bearing. */
  599. /* */
  600. typedef struct TT_SBit_ComponentRec_
  601. {
  602. FT_UShort glyph_code;
  603. FT_Char x_offset;
  604. FT_Char y_offset;
  605. } TT_SBit_ComponentRec, *TT_SBit_Component;
  606. /*************************************************************************/
  607. /* */
  608. /* <Struct> */
  609. /* TT_SBit_ScaleRec */
  610. /* */
  611. /* <Description> */
  612. /* A structure used describe a given bitmap scaling table, as defined */
  613. /* in the `EBSC' table. */
  614. /* */
  615. /* <Fields> */
  616. /* hori :: The horizontal line metrics. */
  617. /* */
  618. /* vert :: The vertical line metrics. */
  619. /* */
  620. /* x_ppem :: The number of horizontal pixels per EM. */
  621. /* */
  622. /* y_ppem :: The number of vertical pixels per EM. */
  623. /* */
  624. /* x_ppem_substitute :: Substitution x_ppem value. */
  625. /* */
  626. /* y_ppem_substitute :: Substitution y_ppem value. */
  627. /* */
  628. typedef struct TT_SBit_ScaleRec_
  629. {
  630. TT_SBit_LineMetricsRec hori;
  631. TT_SBit_LineMetricsRec vert;
  632. FT_Byte x_ppem;
  633. FT_Byte y_ppem;
  634. FT_Byte x_ppem_substitute;
  635. FT_Byte y_ppem_substitute;
  636. } TT_SBit_ScaleRec, *TT_SBit_Scale;
  637. /*************************************************************************/
  638. /*************************************************************************/
  639. /*************************************************************************/
  640. /*** ***/
  641. /*** ***/
  642. /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
  643. /*** ***/
  644. /*** ***/
  645. /*************************************************************************/
  646. /*************************************************************************/
  647. /*************************************************************************/
  648. /*************************************************************************/
  649. /* */
  650. /* <Struct> */
  651. /* TT_Post_20Rec */
  652. /* */
  653. /* <Description> */
  654. /* Postscript names sub-table, format 2.0. Stores the PS name of */
  655. /* each glyph in the font face. */
  656. /* */
  657. /* <Fields> */
  658. /* num_glyphs :: The number of named glyphs in the table. */
  659. /* */
  660. /* num_names :: The number of PS names stored in the table. */
  661. /* */
  662. /* glyph_indices :: The indices of the glyphs in the names arrays. */
  663. /* */
  664. /* glyph_names :: The PS names not in Mac Encoding. */
  665. /* */
  666. typedef struct TT_Post_20Rec_
  667. {
  668. FT_UShort num_glyphs;
  669. FT_UShort num_names;
  670. FT_UShort* glyph_indices;
  671. FT_Char** glyph_names;
  672. } TT_Post_20Rec, *TT_Post_20;
  673. /*************************************************************************/
  674. /* */
  675. /* <Struct> */
  676. /* TT_Post_25Rec */
  677. /* */
  678. /* <Description> */
  679. /* Postscript names sub-table, format 2.5. Stores the PS name of */
  680. /* each glyph in the font face. */
  681. /* */
  682. /* <Fields> */
  683. /* num_glyphs :: The number of glyphs in the table. */
  684. /* */
  685. /* offsets :: An array of signed offsets in a normal Mac */
  686. /* Postscript name encoding. */
  687. /* */
  688. typedef struct TT_Post_25_
  689. {
  690. FT_UShort num_glyphs;
  691. FT_Char* offsets;
  692. } TT_Post_25Rec, *TT_Post_25;
  693. /*************************************************************************/
  694. /* */
  695. /* <Struct> */
  696. /* TT_Post_NamesRec */
  697. /* */
  698. /* <Description> */
  699. /* Postscript names table, either format 2.0 or 2.5. */
  700. /* */
  701. /* <Fields> */
  702. /* loaded :: A flag to indicate whether the PS names are loaded. */
  703. /* */
  704. /* format_20 :: The sub-table used for format 2.0. */
  705. /* */
  706. /* format_25 :: The sub-table used for format 2.5. */
  707. /* */
  708. typedef struct TT_Post_NamesRec_
  709. {
  710. FT_Bool loaded;
  711. union
  712. {
  713. TT_Post_20Rec format_20;
  714. TT_Post_25Rec format_25;
  715. } names;
  716. } TT_Post_NamesRec, *TT_Post_Names;
  717. /*************************************************************************/
  718. /*************************************************************************/
  719. /*************************************************************************/
  720. /*** ***/
  721. /*** ***/
  722. /*** GX VARIATION TABLE SUPPORT ***/
  723. /*** ***/
  724. /*** ***/
  725. /*************************************************************************/
  726. /*************************************************************************/
  727. /*************************************************************************/
  728. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  729. typedef struct GX_BlendRec_ *GX_Blend;
  730. #endif
  731. /*************************************************************************/
  732. /*************************************************************************/
  733. /*************************************************************************/
  734. /*** ***/
  735. /*** ***/
  736. /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/
  737. /*** ***/
  738. /*** ***/
  739. /*************************************************************************/
  740. /*************************************************************************/
  741. /*************************************************************************/
  742. /*
  743. * These types are used to support a `BDF ' table that isn't part of the
  744. * official TrueType specification. It is mainly used in SFNT-based
  745. * bitmap fonts that were generated from a set of BDF fonts.
  746. *
  747. * The format of the table is as follows.
  748. *
  749. * USHORT version `BDF ' table version number, should be 0x0001.
  750. * USHORT strikeCount Number of strikes (bitmap sizes) in this table.
  751. * ULONG stringTable Offset (from start of BDF table) to string
  752. * table.
  753. *
  754. * This is followed by an array of `strikeCount' descriptors, having the
  755. * following format.
  756. *
  757. * USHORT ppem Vertical pixels per EM for this strike.
  758. * USHORT numItems Number of items for this strike (properties and
  759. * atoms). Maximum is 255.
  760. *
  761. * This array in turn is followed by `strikeCount' value sets. Each
  762. * `value set' is an array of `numItems' items with the following format.
  763. *
  764. * ULONG item_name Offset in string table to item name.
  765. * USHORT item_type The item type. Possible values are
  766. * 0 => string (e.g., COMMENT)
  767. * 1 => atom (e.g., FONT or even SIZE)
  768. * 2 => int32
  769. * 3 => uint32
  770. * 0x10 => A flag to indicate a properties. This
  771. * is ORed with the above values.
  772. * ULONG item_value For strings => Offset into string table without
  773. * the corresponding double quotes.
  774. * For atoms => Offset into string table.
  775. * For integers => Direct value.
  776. *
  777. * All strings in the string table consist of bytes and are
  778. * zero-terminated.
  779. *
  780. */
  781. #ifdef TT_CONFIG_OPTION_BDF
  782. typedef struct TT_BDFRec_
  783. {
  784. FT_Byte* table;
  785. FT_Byte* table_end;
  786. FT_Byte* strings;
  787. FT_ULong strings_size;
  788. FT_UInt num_strikes;
  789. FT_Bool loaded;
  790. } TT_BDFRec, *TT_BDF;
  791. #endif /* TT_CONFIG_OPTION_BDF */
  792. /*************************************************************************/
  793. /*************************************************************************/
  794. /*************************************************************************/
  795. /*** ***/
  796. /*** ***/
  797. /*** ORIGINAL TT_FACE CLASS DEFINITION ***/
  798. /*** ***/
  799. /*** ***/
  800. /*************************************************************************/
  801. /*************************************************************************/
  802. /*************************************************************************/
  803. /*************************************************************************/
  804. /* */
  805. /* This structure/class is defined here because it is common to the */
  806. /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
  807. /* */
  808. /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */
  809. /* shared between font drivers, and are thus defined in `ttobjs.h'. */
  810. /* */
  811. /*************************************************************************/
  812. /*************************************************************************/
  813. /* */
  814. /* <Type> */
  815. /* TT_Face */
  816. /* */
  817. /* <Description> */
  818. /* A handle to a TrueType face/font object. A TT_Face encapsulates */
  819. /* the resolution and scaling independent parts of a TrueType font */
  820. /* resource. */
  821. /* */
  822. /* <Note> */
  823. /* The TT_Face structure is also used as a `parent class' for the */
  824. /* OpenType-CFF class (T2_Face). */
  825. /* */
  826. typedef struct TT_FaceRec_* TT_Face;
  827. /* a function type used for the truetype bytecode interpreter hooks */
  828. typedef FT_Error
  829. (*TT_Interpreter)( void* exec_context );
  830. /* forward declaration */
  831. typedef struct TT_LoaderRec_* TT_Loader;
  832. /*************************************************************************/
  833. /* */
  834. /* <FuncType> */
  835. /* TT_Loader_GotoTableFunc */
  836. /* */
  837. /* <Description> */
  838. /* Seeks a stream to the start of a given TrueType table. */
  839. /* */
  840. /* <Input> */
  841. /* face :: A handle to the target face object. */
  842. /* */
  843. /* tag :: A 4-byte tag used to name the table. */
  844. /* */
  845. /* stream :: The input stream. */
  846. /* */
  847. /* <Output> */
  848. /* length :: The length of the table in bytes. Set to 0 if not */
  849. /* needed. */
  850. /* */
  851. /* <Return> */
  852. /* FreeType error code. 0 means success. */
  853. /* */
  854. /* <Note> */
  855. /* The stream cursor must be at the font file's origin. */
  856. /* */
  857. typedef FT_Error
  858. (*TT_Loader_GotoTableFunc)( TT_Face face,
  859. FT_ULong tag,
  860. FT_Stream stream,
  861. FT_ULong* length );
  862. /*************************************************************************/
  863. /* */
  864. /* <FuncType> */
  865. /* TT_Loader_StartGlyphFunc */
  866. /* */
  867. /* <Description> */
  868. /* Seeks a stream to the start of a given glyph element, and opens a */
  869. /* frame for it. */
  870. /* */
  871. /* <Input> */
  872. /* loader :: The current TrueType glyph loader object. */
  873. /* */
  874. /* glyph index :: The index of the glyph to access. */
  875. /* */
  876. /* offset :: The offset of the glyph according to the */
  877. /* `locations' table. */
  878. /* */
  879. /* byte_count :: The size of the frame in bytes. */
  880. /* */
  881. /* <Return> */
  882. /* FreeType error code. 0 means success. */
  883. /* */
  884. /* <Note> */
  885. /* This function is normally equivalent to FT_STREAM_SEEK(offset) */
  886. /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */
  887. /* but alternative formats (e.g. compressed ones) might use something */
  888. /* different. */
  889. /* */
  890. typedef FT_Error
  891. (*TT_Loader_StartGlyphFunc)( TT_Loader loader,
  892. FT_UInt glyph_index,
  893. FT_ULong offset,
  894. FT_UInt byte_count );
  895. /*************************************************************************/
  896. /* */
  897. /* <FuncType> */
  898. /* TT_Loader_ReadGlyphFunc */
  899. /* */
  900. /* <Description> */
  901. /* Reads one glyph element (its header, a simple glyph, or a */
  902. /* composite) from the loader's current stream frame. */
  903. /* */
  904. /* <Input> */
  905. /* loader :: The current TrueType glyph loader object. */
  906. /* */
  907. /* <Return> */
  908. /* FreeType error code. 0 means success. */
  909. /* */
  910. typedef FT_Error
  911. (*TT_Loader_ReadGlyphFunc)( TT_Loader loader );
  912. /*************************************************************************/
  913. /* */
  914. /* <FuncType> */
  915. /* TT_Loader_EndGlyphFunc */
  916. /* */
  917. /* <Description> */
  918. /* Closes the current loader stream frame for the glyph. */
  919. /* */
  920. /* <Input> */
  921. /* loader :: The current TrueType glyph loader object. */
  922. /* */
  923. typedef void
  924. (*TT_Loader_EndGlyphFunc)( TT_Loader loader );
  925. typedef enum TT_SbitTableType_
  926. {
  927. TT_SBIT_TABLE_TYPE_NONE = 0,
  928. TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */
  929. /* `bloc' (Apple) */
  930. TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */
  931. TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */
  932. /* do not remove */
  933. TT_SBIT_TABLE_TYPE_MAX
  934. } TT_SbitTableType;
  935. /*************************************************************************/
  936. /* */
  937. /* TrueType Face Type */
  938. /* */
  939. /* <Struct> */
  940. /* TT_Face */
  941. /* */
  942. /* <Description> */
  943. /* The TrueType face class. These objects model the resolution and */
  944. /* point-size independent data found in a TrueType font file. */
  945. /* */
  946. /* <Fields> */
  947. /* root :: The base FT_Face structure, managed by the */
  948. /* base layer. */
  949. /* */
  950. /* ttc_header :: The TrueType collection header, used when */
  951. /* the file is a `ttc' rather than a `ttf'. */
  952. /* For ordinary font files, the field */
  953. /* `ttc_header.count' is set to 0. */
  954. /* */
  955. /* format_tag :: The font format tag. */
  956. /* */
  957. /* num_tables :: The number of TrueType tables in this font */
  958. /* file. */
  959. /* */
  960. /* dir_tables :: The directory of TrueType tables for this */
  961. /* font file. */
  962. /* */
  963. /* header :: The font's font header (`head' table). */
  964. /* Read on font opening. */
  965. /* */
  966. /* horizontal :: The font's horizontal header (`hhea' */
  967. /* table). This field also contains the */
  968. /* associated horizontal metrics table */
  969. /* (`hmtx'). */
  970. /* */
  971. /* max_profile :: The font's maximum profile table. Read on */
  972. /* font opening. Note that some maximum */
  973. /* values cannot be taken directly from this */
  974. /* table. We thus define additional fields */
  975. /* below to hold the computed maxima. */
  976. /* */
  977. /* vertical_info :: A boolean which is set when the font file */
  978. /* contains vertical metrics. If not, the */
  979. /* value of the `vertical' field is */
  980. /* undefined. */
  981. /* */
  982. /* vertical :: The font's vertical header (`vhea' table). */
  983. /* This field also contains the associated */
  984. /* vertical metrics table (`vmtx'), if found. */
  985. /* IMPORTANT: The contents of this field is */
  986. /* undefined if the `verticalInfo' field is */
  987. /* unset. */
  988. /* */
  989. /* num_names :: The number of name records within this */
  990. /* TrueType font. */
  991. /* */
  992. /* name_table :: The table of name records (`name'). */
  993. /* */
  994. /* os2 :: The font's OS/2 table (`OS/2'). */
  995. /* */
  996. /* postscript :: The font's PostScript table (`post' */
  997. /* table). The PostScript glyph names are */
  998. /* not loaded by the driver on face opening. */
  999. /* See the `ttpost' module for more details. */
  1000. /* */
  1001. /* cmap_table :: Address of the face's `cmap' SFNT table */
  1002. /* in memory (it's an extracted frame). */
  1003. /* */
  1004. /* cmap_size :: The size in bytes of the `cmap_table' */
  1005. /* described above. */
  1006. /* */
  1007. /* goto_table :: A function called by each TrueType table */
  1008. /* loader to position a stream's cursor to */
  1009. /* the start of a given table according to */
  1010. /* its tag. It defaults to TT_Goto_Face but */
  1011. /* can be different for strange formats (e.g. */
  1012. /* Type 42). */
  1013. /* */
  1014. /* access_glyph_frame :: A function used to access the frame of a */
  1015. /* given glyph within the face's font file. */
  1016. /* */
  1017. /* forget_glyph_frame :: A function used to forget the frame of a */
  1018. /* given glyph when all data has been loaded. */
  1019. /* */
  1020. /* read_glyph_header :: A function used to read a glyph header. */
  1021. /* It must be called between an `access' and */
  1022. /* `forget'. */
  1023. /* */
  1024. /* read_simple_glyph :: A function used to read a simple glyph. */
  1025. /* It must be called after the header was */
  1026. /* read, and before the `forget'. */
  1027. /* */
  1028. /* read_composite_glyph :: A function used to read a composite glyph. */
  1029. /* It must be called after the header was */
  1030. /* read, and before the `forget'. */
  1031. /* */
  1032. /* sfnt :: A pointer to the SFNT service. */
  1033. /* */
  1034. /* psnames :: A pointer to the PostScript names service. */
  1035. /* */
  1036. /* hdmx :: The face's horizontal device metrics */
  1037. /* (`hdmx' table). This table is optional in */
  1038. /* TrueType/OpenType fonts. */
  1039. /* */
  1040. /* gasp :: The grid-fitting and scaling properties */
  1041. /* table (`gasp'). This table is optional in */
  1042. /* TrueType/OpenType fonts. */
  1043. /* */
  1044. /* pclt :: The `pclt' SFNT table. */
  1045. /* */
  1046. /* num_sbit_scales :: The number of sbit scales for this font. */
  1047. /* */
  1048. /* sbit_scales :: Array of sbit scales embedded in this */
  1049. /* font. This table is optional in a */
  1050. /* TrueType/OpenType font. */
  1051. /* */
  1052. /* postscript_names :: A table used to store the Postscript names */
  1053. /* of the glyphs for this font. See the */
  1054. /* file `ttconfig.h' for comments on the */
  1055. /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
  1056. /* */
  1057. /* num_locations :: The number of glyph locations in this */
  1058. /* TrueType file. This should be */
  1059. /* identical to the number of glyphs. */
  1060. /* Ignored for Type 2 fonts. */
  1061. /* */
  1062. /* glyph_locations :: An array of longs. These are offsets to */
  1063. /* glyph data within the `glyf' table. */
  1064. /* Ignored for Type 2 font faces. */
  1065. /* */
  1066. /* glyf_len :: The length of the `glyf' table. Needed */
  1067. /* for malformed `loca' tables. */
  1068. /* */
  1069. /* font_program_size :: Size in bytecodes of the face's font */
  1070. /* program. 0 if none defined. Ignored for */
  1071. /* Type 2 fonts. */
  1072. /* */
  1073. /* font_program :: The face's font program (bytecode stream) */
  1074. /* executed at load time, also used during */
  1075. /* glyph rendering. Comes from the `fpgm' */
  1076. /* table. Ignored for Type 2 font fonts. */
  1077. /* */
  1078. /* cvt_program_size :: The size in bytecodes of the face's cvt */
  1079. /* program. Ignored for Type 2 fonts. */
  1080. /* */
  1081. /* cvt_program :: The face's cvt program (bytecode stream) */
  1082. /* executed each time an instance/size is */
  1083. /* changed/reset. Comes from the `prep' */
  1084. /* table. Ignored for Type 2 fonts. */
  1085. /* */
  1086. /* cvt_size :: Size of the control value table (in */
  1087. /* entries). Ignored for Type 2 fonts. */
  1088. /* */
  1089. /* cvt :: The face's original control value table. */
  1090. /* Coordinates are expressed in unscaled font */
  1091. /* units. Comes from the `cvt ' table. */
  1092. /* Ignored for Type 2 fonts. */
  1093. /* */
  1094. /* num_kern_pairs :: The number of kerning pairs present in the */
  1095. /* font file. The engine only loads the */
  1096. /* first horizontal format 0 kern table it */
  1097. /* finds in the font file. Ignored for */
  1098. /* Type 2 fonts. */
  1099. /* */
  1100. /* kern_table_index :: The index of the kerning table in the font */
  1101. /* kerning directory. Ignored for Type 2 */
  1102. /* fonts. */
  1103. /* */
  1104. /* interpreter :: A pointer to the TrueType bytecode */
  1105. /* interpreters field is also used to hook */
  1106. /* the debugger in `ttdebug'. */
  1107. /* */
  1108. /* unpatented_hinting :: If true, use only unpatented methods in */
  1109. /* the bytecode interpreter. */
  1110. /* */
  1111. /* doblend :: A boolean which is set if the font should */
  1112. /* be blended (this is for GX var). */
  1113. /* */
  1114. /* blend :: Contains the data needed to control GX */
  1115. /* variation tables (rather like Multiple */
  1116. /* Master data). */
  1117. /* */
  1118. /* extra :: Reserved for third-party font drivers. */
  1119. /* */
  1120. /* postscript_name :: The PS name of the font. Used by the */
  1121. /* postscript name service. */
  1122. /* */
  1123. typedef struct TT_FaceRec_
  1124. {
  1125. FT_FaceRec root;
  1126. TTC_HeaderRec ttc_header;
  1127. FT_ULong format_tag;
  1128. FT_UShort num_tables;
  1129. TT_Table dir_tables;
  1130. TT_Header header; /* TrueType header table */
  1131. TT_HoriHeader horizontal; /* TrueType horizontal header */
  1132. TT_MaxProfile max_profile;
  1133. FT_Bool vertical_info;
  1134. TT_VertHeader vertical; /* TT Vertical header, if present */
  1135. FT_UShort num_names; /* number of name records */
  1136. TT_NameTableRec name_table; /* name table */
  1137. TT_OS2 os2; /* TrueType OS/2 table */
  1138. TT_Postscript postscript; /* TrueType Postscript table */
  1139. FT_Byte* cmap_table; /* extracted `cmap' table */
  1140. FT_ULong cmap_size;
  1141. TT_Loader_GotoTableFunc goto_table;
  1142. TT_Loader_StartGlyphFunc access_glyph_frame;
  1143. TT_Loader_EndGlyphFunc forget_glyph_frame;
  1144. TT_Loader_ReadGlyphFunc read_glyph_header;
  1145. TT_Loader_ReadGlyphFunc read_simple_glyph;
  1146. TT_Loader_ReadGlyphFunc read_composite_glyph;
  1147. /* a typeless pointer to the SFNT_Interface table used to load */
  1148. /* the basic TrueType tables in the face object */
  1149. void* sfnt;
  1150. /* a typeless pointer to the FT_Service_PsCMapsRec table used to */
  1151. /* handle glyph names <-> unicode & Mac values */
  1152. void* psnames;
  1153. /***********************************************************************/
  1154. /* */
  1155. /* Optional TrueType/OpenType tables */
  1156. /* */
  1157. /***********************************************************************/
  1158. /* grid-fitting and scaling table */
  1159. TT_GaspRec gasp; /* the `gasp' table */
  1160. /* PCL 5 table */
  1161. TT_PCLT pclt;
  1162. /* embedded bitmaps support */
  1163. FT_ULong num_sbit_scales;
  1164. TT_SBit_Scale sbit_scales;
  1165. /* postscript names table */
  1166. TT_Post_NamesRec postscript_names;
  1167. /***********************************************************************/
  1168. /* */
  1169. /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
  1170. /* */
  1171. /***********************************************************************/
  1172. /* the font program, if any */
  1173. FT_ULong font_program_size;
  1174. FT_Byte* font_program;
  1175. /* the cvt program, if any */
  1176. FT_ULong cvt_program_size;
  1177. FT_Byte* cvt_program;
  1178. /* the original, unscaled, control value table */
  1179. FT_ULong cvt_size;
  1180. FT_Short* cvt;
  1181. /* A pointer to the bytecode interpreter to use. This is also */
  1182. /* used to hook the debugger for the `ttdebug' utility. */
  1183. TT_Interpreter interpreter;
  1184. #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
  1185. /* Use unpatented hinting only. */
  1186. FT_Bool unpatented_hinting;
  1187. #endif
  1188. /***********************************************************************/
  1189. /* */
  1190. /* Other tables or fields. This is used by derivative formats like */
  1191. /* OpenType. */
  1192. /* */
  1193. /***********************************************************************/
  1194. FT_Generic extra;
  1195. const char* postscript_name;
  1196. FT_ULong glyf_len;
  1197. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  1198. FT_Bool doblend;
  1199. GX_Blend blend;
  1200. #endif
  1201. /* since version 2.2 */
  1202. FT_Byte* horz_metrics;
  1203. FT_ULong horz_metrics_size;
  1204. FT_Byte* vert_metrics;
  1205. FT_ULong vert_metrics_size;
  1206. FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */
  1207. FT_Byte* glyph_locations;
  1208. FT_Byte* hdmx_table;
  1209. FT_ULong hdmx_table_size;
  1210. FT_UInt hdmx_record_count;
  1211. FT_ULong hdmx_record_size;
  1212. FT_Byte* hdmx_record_sizes;
  1213. FT_Byte* sbit_table;
  1214. FT_ULong sbit_table_size;
  1215. TT_SbitTableType sbit_table_type;
  1216. FT_UInt sbit_num_strikes;
  1217. FT_Byte* kern_table;
  1218. FT_ULong kern_table_size;
  1219. FT_UInt num_kern_tables;
  1220. FT_UInt32 kern_avail_bits;
  1221. FT_UInt32 kern_order_bits;
  1222. #ifdef TT_CONFIG_OPTION_BDF
  1223. TT_BDFRec bdf;
  1224. #endif /* TT_CONFIG_OPTION_BDF */
  1225. /* since 2.3.0 */
  1226. FT_ULong horz_metrics_offset;
  1227. FT_ULong vert_metrics_offset;
  1228. #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
  1229. /* since 2.4.12 */
  1230. FT_ULong sph_found_func_flags; /* special functions found */
  1231. /* for this face */
  1232. FT_Bool sph_compatibility_mode;
  1233. #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
  1234. } TT_FaceRec;
  1235. /*************************************************************************/
  1236. /* */
  1237. /* <Struct> */
  1238. /* TT_GlyphZoneRec */
  1239. /* */
  1240. /* <Description> */
  1241. /* A glyph zone is used to load, scale and hint glyph outline */
  1242. /* coordinates. */
  1243. /* */
  1244. /* <Fields> */
  1245. /* memory :: A handle to the memory manager. */
  1246. /* */
  1247. /* max_points :: The maximum size in points of the zone. */
  1248. /* */
  1249. /* max_contours :: Max size in links contours of the zone. */
  1250. /* */
  1251. /* n_points :: The current number of points in the zone. */
  1252. /* */
  1253. /* n_contours :: The current number of contours in the zone. */
  1254. /* */
  1255. /* org :: The original glyph coordinates (font */
  1256. /* units/scaled). */
  1257. /* */
  1258. /* cur :: The current glyph coordinates (scaled/hinted). */
  1259. /* */
  1260. /* tags :: The point control tags. */
  1261. /* */
  1262. /* contours :: The contours end points. */
  1263. /* */
  1264. /* first_point :: Offset of the current subglyph's first point. */
  1265. /* */
  1266. typedef struct TT_GlyphZoneRec_
  1267. {
  1268. FT_Memory memory;
  1269. FT_UShort max_points;
  1270. FT_UShort max_contours;
  1271. FT_UShort n_points; /* number of points in zone */
  1272. FT_Short n_contours; /* number of contours */
  1273. FT_Vector* org; /* original point coordinates */
  1274. FT_Vector* cur; /* current point coordinates */
  1275. FT_Vector* orus; /* original (unscaled) point coordinates */
  1276. FT_Byte* tags; /* current touch flags */
  1277. FT_UShort* contours; /* contour end points */
  1278. FT_UShort first_point; /* offset of first (#0) point */
  1279. } TT_GlyphZoneRec, *TT_GlyphZone;
  1280. /* handle to execution context */
  1281. typedef struct TT_ExecContextRec_* TT_ExecContext;
  1282. /* glyph loader structure */
  1283. typedef struct TT_LoaderRec_
  1284. {
  1285. FT_Face face;
  1286. FT_Size size;
  1287. FT_GlyphSlot glyph;
  1288. FT_GlyphLoader gloader;
  1289. FT_ULong load_flags;
  1290. FT_UInt glyph_index;
  1291. FT_Stream stream;
  1292. FT_Int byte_len;
  1293. FT_Short n_contours;
  1294. FT_BBox bbox;
  1295. FT_Int left_bearing;
  1296. FT_Int advance;
  1297. FT_Int linear;
  1298. FT_Bool linear_def;
  1299. FT_Vector pp1;
  1300. FT_Vector pp2;
  1301. FT_ULong glyf_offset;
  1302. /* the zone where we load our glyphs */
  1303. TT_GlyphZoneRec base;
  1304. TT_GlyphZoneRec zone;
  1305. TT_ExecContext exec;
  1306. FT_Byte* instructions;
  1307. FT_ULong ins_pos;
  1308. /* for possible extensibility in other formats */
  1309. void* other;
  1310. /* since version 2.1.8 */
  1311. FT_Int top_bearing;
  1312. FT_Int vadvance;
  1313. FT_Vector pp3;
  1314. FT_Vector pp4;
  1315. /* since version 2.2.1 */
  1316. FT_Byte* cursor;
  1317. FT_Byte* limit;
  1318. } TT_LoaderRec;
  1319. FT_END_HEADER
  1320. #endif /* __TTTYPES_H__ */
  1321. /* END */