tttypes.h 85 KB

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