PageRenderTime 112ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 1ms

/src/compiler/android-ndk/jni/freetype/include/freetype/freetype.h

http://ftk.googlecode.com/
C++ Header | 995 lines | 126 code | 88 blank | 781 comment | 0 complexity | 9f2d72f3be18516679a278611a5a10cf MD5 | raw file
Possible License(s): LGPL-3.0
  1. /***************************************************************************/
  2. /* */
  3. /* freetype.h */
  4. /* */
  5. /* FreeType high-level API and common types (specification only). */
  6. /* */
  7. /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
  8. /* 2010 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 FT_FREETYPE_H
  19. #error "`ft2build.h' hasn't been included yet!"
  20. #error "Please always use macros to include FreeType header files."
  21. #error "Example:"
  22. #error " #include <ft2build.h>"
  23. #error " #include FT_FREETYPE_H"
  24. #endif
  25. #ifndef __FREETYPE_H__
  26. #define __FREETYPE_H__
  27. #include <ft2build.h>
  28. #include FT_CONFIG_CONFIG_H
  29. #include FT_ERRORS_H
  30. #include FT_TYPES_H
  31. FT_BEGIN_HEADER
  32. /*************************************************************************/
  33. /* */
  34. /* <Section> */
  35. /* user_allocation */
  36. /* */
  37. /* <Title> */
  38. /* User allocation */
  39. /* */
  40. /* <Abstract> */
  41. /* How client applications should allocate FreeType data structures. */
  42. /* */
  43. /* <Description> */
  44. /* FreeType assumes that structures allocated by the user and passed */
  45. /* as arguments are zeroed out except for the actual data. In other */
  46. /* words, it is recommended to use `calloc' (or variants of it) */
  47. /* instead of `malloc' for allocation. */
  48. /* */
  49. /*************************************************************************/
  50. /*************************************************************************/
  51. /*************************************************************************/
  52. /* */
  53. /* B A S I C T Y P E S */
  54. /* */
  55. /*************************************************************************/
  56. /*************************************************************************/
  57. /*************************************************************************/
  58. /* */
  59. /* <Section> */
  60. /* base_interface */
  61. /* */
  62. /* <Title> */
  63. /* Base Interface */
  64. /* */
  65. /* <Abstract> */
  66. /* The FreeType~2 base font interface. */
  67. /* */
  68. /* <Description> */
  69. /* This section describes the public high-level API of FreeType~2. */
  70. /* */
  71. /* <Order> */
  72. /* FT_Library */
  73. /* FT_Face */
  74. /* FT_Size */
  75. /* FT_GlyphSlot */
  76. /* FT_CharMap */
  77. /* FT_Encoding */
  78. /* */
  79. /* FT_FaceRec */
  80. /* */
  81. /* FT_FACE_FLAG_SCALABLE */
  82. /* FT_FACE_FLAG_FIXED_SIZES */
  83. /* FT_FACE_FLAG_FIXED_WIDTH */
  84. /* FT_FACE_FLAG_HORIZONTAL */
  85. /* FT_FACE_FLAG_VERTICAL */
  86. /* FT_FACE_FLAG_SFNT */
  87. /* FT_FACE_FLAG_KERNING */
  88. /* FT_FACE_FLAG_MULTIPLE_MASTERS */
  89. /* FT_FACE_FLAG_GLYPH_NAMES */
  90. /* FT_FACE_FLAG_EXTERNAL_STREAM */
  91. /* FT_FACE_FLAG_FAST_GLYPHS */
  92. /* FT_FACE_FLAG_HINTER */
  93. /* */
  94. /* FT_STYLE_FLAG_BOLD */
  95. /* FT_STYLE_FLAG_ITALIC */
  96. /* */
  97. /* FT_SizeRec */
  98. /* FT_Size_Metrics */
  99. /* */
  100. /* FT_GlyphSlotRec */
  101. /* FT_Glyph_Metrics */
  102. /* FT_SubGlyph */
  103. /* */
  104. /* FT_Bitmap_Size */
  105. /* */
  106. /* FT_Init_FreeType */
  107. /* FT_Done_FreeType */
  108. /* */
  109. /* FT_New_Face */
  110. /* FT_Done_Face */
  111. /* FT_New_Memory_Face */
  112. /* FT_Open_Face */
  113. /* FT_Open_Args */
  114. /* FT_Parameter */
  115. /* FT_Attach_File */
  116. /* FT_Attach_Stream */
  117. /* */
  118. /* FT_Set_Char_Size */
  119. /* FT_Set_Pixel_Sizes */
  120. /* FT_Request_Size */
  121. /* FT_Select_Size */
  122. /* FT_Size_Request_Type */
  123. /* FT_Size_Request */
  124. /* FT_Set_Transform */
  125. /* FT_Load_Glyph */
  126. /* FT_Get_Char_Index */
  127. /* FT_Get_Name_Index */
  128. /* FT_Load_Char */
  129. /* */
  130. /* FT_OPEN_MEMORY */
  131. /* FT_OPEN_STREAM */
  132. /* FT_OPEN_PATHNAME */
  133. /* FT_OPEN_DRIVER */
  134. /* FT_OPEN_PARAMS */
  135. /* */
  136. /* FT_LOAD_DEFAULT */
  137. /* FT_LOAD_RENDER */
  138. /* FT_LOAD_MONOCHROME */
  139. /* FT_LOAD_LINEAR_DESIGN */
  140. /* FT_LOAD_NO_SCALE */
  141. /* FT_LOAD_NO_HINTING */
  142. /* FT_LOAD_NO_BITMAP */
  143. /* FT_LOAD_CROP_BITMAP */
  144. /* */
  145. /* FT_LOAD_VERTICAL_LAYOUT */
  146. /* FT_LOAD_IGNORE_TRANSFORM */
  147. /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
  148. /* FT_LOAD_FORCE_AUTOHINT */
  149. /* FT_LOAD_NO_RECURSE */
  150. /* FT_LOAD_PEDANTIC */
  151. /* */
  152. /* FT_LOAD_TARGET_NORMAL */
  153. /* FT_LOAD_TARGET_LIGHT */
  154. /* FT_LOAD_TARGET_MONO */
  155. /* FT_LOAD_TARGET_LCD */
  156. /* FT_LOAD_TARGET_LCD_V */
  157. /* */
  158. /* FT_Render_Glyph */
  159. /* FT_Render_Mode */
  160. /* FT_Get_Kerning */
  161. /* FT_Kerning_Mode */
  162. /* FT_Get_Track_Kerning */
  163. /* FT_Get_Glyph_Name */
  164. /* FT_Get_Postscript_Name */
  165. /* */
  166. /* FT_CharMapRec */
  167. /* FT_Select_Charmap */
  168. /* FT_Set_Charmap */
  169. /* FT_Get_Charmap_Index */
  170. /* */
  171. /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
  172. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
  173. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
  174. /* FT_FSTYPE_EDITABLE_EMBEDDING */
  175. /* FT_FSTYPE_NO_SUBSETTING */
  176. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
  177. /* */
  178. /* FT_Get_FSType_Flags */
  179. /* */
  180. /*************************************************************************/
  181. /*************************************************************************/
  182. /* */
  183. /* <Struct> */
  184. /* FT_Glyph_Metrics */
  185. /* */
  186. /* <Description> */
  187. /* A structure used to model the metrics of a single glyph. The */
  188. /* values are expressed in 26.6 fractional pixel format; if the flag */
  189. /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
  190. /* are expressed in font units instead. */
  191. /* */
  192. /* <Fields> */
  193. /* width :: */
  194. /* The glyph's width. */
  195. /* */
  196. /* height :: */
  197. /* The glyph's height. */
  198. /* */
  199. /* horiBearingX :: */
  200. /* Left side bearing for horizontal layout. */
  201. /* */
  202. /* horiBearingY :: */
  203. /* Top side bearing for horizontal layout. */
  204. /* */
  205. /* horiAdvance :: */
  206. /* Advance width for horizontal layout. */
  207. /* */
  208. /* vertBearingX :: */
  209. /* Left side bearing for vertical layout. */
  210. /* */
  211. /* vertBearingY :: */
  212. /* Top side bearing for vertical layout. */
  213. /* */
  214. /* vertAdvance :: */
  215. /* Advance height for vertical layout. */
  216. /* */
  217. /* <Note> */
  218. /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
  219. /* dimensions of the hinted glyph (in case hinting is applicable). */
  220. /* */
  221. typedef struct FT_Glyph_Metrics_
  222. {
  223. FT_Pos width;
  224. FT_Pos height;
  225. FT_Pos horiBearingX;
  226. FT_Pos horiBearingY;
  227. FT_Pos horiAdvance;
  228. FT_Pos vertBearingX;
  229. FT_Pos vertBearingY;
  230. FT_Pos vertAdvance;
  231. } FT_Glyph_Metrics;
  232. /*************************************************************************/
  233. /* */
  234. /* <Struct> */
  235. /* FT_Bitmap_Size */
  236. /* */
  237. /* <Description> */
  238. /* This structure models the metrics of a bitmap strike (i.e., a set */
  239. /* of glyphs for a given point size and resolution) in a bitmap font. */
  240. /* It is used for the `available_sizes' field of @FT_Face. */
  241. /* */
  242. /* <Fields> */
  243. /* height :: The vertical distance, in pixels, between two */
  244. /* consecutive baselines. It is always positive. */
  245. /* */
  246. /* width :: The average width, in pixels, of all glyphs in the */
  247. /* strike. */
  248. /* */
  249. /* size :: The nominal size of the strike in 26.6 fractional */
  250. /* points. This field is not very useful. */
  251. /* */
  252. /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
  253. /* pixels. */
  254. /* */
  255. /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
  256. /* pixels. */
  257. /* */
  258. /* <Note> */
  259. /* Windows FNT: */
  260. /* The nominal size given in a FNT font is not reliable. Thus when */
  261. /* the driver finds it incorrect, it sets `size' to some calculated */
  262. /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
  263. /* height given in the font, respectively. */
  264. /* */
  265. /* TrueType embedded bitmaps: */
  266. /* `size', `width', and `height' values are not contained in the */
  267. /* bitmap strike itself. They are computed from the global font */
  268. /* parameters. */
  269. /* */
  270. typedef struct FT_Bitmap_Size_
  271. {
  272. FT_Short height;
  273. FT_Short width;
  274. FT_Pos size;
  275. FT_Pos x_ppem;
  276. FT_Pos y_ppem;
  277. } FT_Bitmap_Size;
  278. /*************************************************************************/
  279. /*************************************************************************/
  280. /* */
  281. /* O B J E C T C L A S S E S */
  282. /* */
  283. /*************************************************************************/
  284. /*************************************************************************/
  285. /*************************************************************************/
  286. /* */
  287. /* <Type> */
  288. /* FT_Library */
  289. /* */
  290. /* <Description> */
  291. /* A handle to a FreeType library instance. Each `library' is */
  292. /* completely independent from the others; it is the `root' of a set */
  293. /* of objects like fonts, faces, sizes, etc. */
  294. /* */
  295. /* It also embeds a memory manager (see @FT_Memory), as well as a */
  296. /* scan-line converter object (see @FT_Raster). */
  297. /* */
  298. /* For multi-threading applications each thread should have its own */
  299. /* FT_Library object. */
  300. /* */
  301. /* <Note> */
  302. /* Library objects are normally created by @FT_Init_FreeType, and */
  303. /* destroyed with @FT_Done_FreeType. */
  304. /* */
  305. typedef struct FT_LibraryRec_ *FT_Library;
  306. /*************************************************************************/
  307. /* */
  308. /* <Type> */
  309. /* FT_Module */
  310. /* */
  311. /* <Description> */
  312. /* A handle to a given FreeType module object. Each module can be a */
  313. /* font driver, a renderer, or anything else that provides services */
  314. /* to the formers. */
  315. /* */
  316. typedef struct FT_ModuleRec_* FT_Module;
  317. /*************************************************************************/
  318. /* */
  319. /* <Type> */
  320. /* FT_Driver */
  321. /* */
  322. /* <Description> */
  323. /* A handle to a given FreeType font driver object. Each font driver */
  324. /* is a special module capable of creating faces from font files. */
  325. /* */
  326. typedef struct FT_DriverRec_* FT_Driver;
  327. /*************************************************************************/
  328. /* */
  329. /* <Type> */
  330. /* FT_Renderer */
  331. /* */
  332. /* <Description> */
  333. /* A handle to a given FreeType renderer. A renderer is a special */
  334. /* module in charge of converting a glyph image to a bitmap, when */
  335. /* necessary. Each renderer supports a given glyph image format, and */
  336. /* one or more target surface depths. */
  337. /* */
  338. typedef struct FT_RendererRec_* FT_Renderer;
  339. /*************************************************************************/
  340. /* */
  341. /* <Type> */
  342. /* FT_Face */
  343. /* */
  344. /* <Description> */
  345. /* A handle to a given typographic face object. A face object models */
  346. /* a given typeface, in a given style. */
  347. /* */
  348. /* <Note> */
  349. /* Each face object also owns a single @FT_GlyphSlot object, as well */
  350. /* as one or more @FT_Size objects. */
  351. /* */
  352. /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
  353. /* a given filepathname or a custom input stream. */
  354. /* */
  355. /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
  356. /* */
  357. /* <Also> */
  358. /* See @FT_FaceRec for the publicly accessible fields of a given face */
  359. /* object. */
  360. /* */
  361. typedef struct FT_FaceRec_* FT_Face;
  362. /*************************************************************************/
  363. /* */
  364. /* <Type> */
  365. /* FT_Size */
  366. /* */
  367. /* <Description> */
  368. /* A handle to an object used to model a face scaled to a given */
  369. /* character size. */
  370. /* */
  371. /* <Note> */
  372. /* Each @FT_Face has an _active_ @FT_Size object that is used by */
  373. /* functions like @FT_Load_Glyph to determine the scaling */
  374. /* transformation which is used to load and hint glyphs and metrics. */
  375. /* */
  376. /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
  377. /* @FT_Request_Size or even @FT_Select_Size to change the content */
  378. /* (i.e., the scaling values) of the active @FT_Size. */
  379. /* */
  380. /* You can use @FT_New_Size to create additional size objects for a */
  381. /* given @FT_Face, but they won't be used by other functions until */
  382. /* you activate it through @FT_Activate_Size. Only one size can be */
  383. /* activated at any given time per face. */
  384. /* */
  385. /* <Also> */
  386. /* See @FT_SizeRec for the publicly accessible fields of a given size */
  387. /* object. */
  388. /* */
  389. typedef struct FT_SizeRec_* FT_Size;
  390. /*************************************************************************/
  391. /* */
  392. /* <Type> */
  393. /* FT_GlyphSlot */
  394. /* */
  395. /* <Description> */
  396. /* A handle to a given `glyph slot'. A slot is a container where it */
  397. /* is possible to load any of the glyphs contained in its parent */
  398. /* face. */
  399. /* */
  400. /* In other words, each time you call @FT_Load_Glyph or */
  401. /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
  402. /* i.e., the glyph's metrics, its image (bitmap or outline), and */
  403. /* other control information. */
  404. /* */
  405. /* <Also> */
  406. /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
  407. /* */
  408. typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
  409. /*************************************************************************/
  410. /* */
  411. /* <Type> */
  412. /* FT_CharMap */
  413. /* */
  414. /* <Description> */
  415. /* A handle to a given character map. A charmap is used to translate */
  416. /* character codes in a given encoding into glyph indexes for its */
  417. /* parent's face. Some font formats may provide several charmaps per */
  418. /* font. */
  419. /* */
  420. /* Each face object owns zero or more charmaps, but only one of them */
  421. /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
  422. /* */
  423. /* The list of available charmaps in a face is available through the */
  424. /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
  425. /* */
  426. /* The currently active charmap is available as `face->charmap'. */
  427. /* You should call @FT_Set_Charmap to change it. */
  428. /* */
  429. /* <Note> */
  430. /* When a new face is created (either through @FT_New_Face or */
  431. /* @FT_Open_Face), the library looks for a Unicode charmap within */
  432. /* the list and automatically activates it. */
  433. /* */
  434. /* <Also> */
  435. /* See @FT_CharMapRec for the publicly accessible fields of a given */
  436. /* character map. */
  437. /* */
  438. typedef struct FT_CharMapRec_* FT_CharMap;
  439. /*************************************************************************/
  440. /* */
  441. /* <Macro> */
  442. /* FT_ENC_TAG */
  443. /* */
  444. /* <Description> */
  445. /* This macro converts four-letter tags into an unsigned long. It is */
  446. /* used to define `encoding' identifiers (see @FT_Encoding). */
  447. /* */
  448. /* <Note> */
  449. /* Since many 16-bit compilers don't like 32-bit enumerations, you */
  450. /* should redefine this macro in case of problems to something like */
  451. /* this: */
  452. /* */
  453. /* { */
  454. /* #define FT_ENC_TAG( value, a, b, c, d ) value */
  455. /* } */
  456. /* */
  457. /* to get a simple enumeration without assigning special numbers. */
  458. /* */
  459. #ifndef FT_ENC_TAG
  460. #define FT_ENC_TAG( value, a, b, c, d ) \
  461. value = ( ( (FT_UInt32)(a) << 24 ) | \
  462. ( (FT_UInt32)(b) << 16 ) | \
  463. ( (FT_UInt32)(c) << 8 ) | \
  464. (FT_UInt32)(d) )
  465. #endif /* FT_ENC_TAG */
  466. /*************************************************************************/
  467. /* */
  468. /* <Enum> */
  469. /* FT_Encoding */
  470. /* */
  471. /* <Description> */
  472. /* An enumeration used to specify character sets supported by */
  473. /* charmaps. Used in the @FT_Select_Charmap API function. */
  474. /* */
  475. /* <Note> */
  476. /* Despite the name, this enumeration lists specific character */
  477. /* repertories (i.e., charsets), and not text encoding methods (e.g., */
  478. /* UTF-8, UTF-16, etc.). */
  479. /* */
  480. /* Other encodings might be defined in the future. */
  481. /* */
  482. /* <Values> */
  483. /* FT_ENCODING_NONE :: */
  484. /* The encoding value~0 is reserved. */
  485. /* */
  486. /* FT_ENCODING_UNICODE :: */
  487. /* Corresponds to the Unicode character set. This value covers */
  488. /* all versions of the Unicode repertoire, including ASCII and */
  489. /* Latin-1. Most fonts include a Unicode charmap, but not all */
  490. /* of them. */
  491. /* */
  492. /* For example, if you want to access Unicode value U+1F028 (and */
  493. /* the font contains it), use value 0x1F028 as the input value for */
  494. /* @FT_Get_Char_Index. */
  495. /* */
  496. /* FT_ENCODING_MS_SYMBOL :: */
  497. /* Corresponds to the Microsoft Symbol encoding, used to encode */
  498. /* mathematical symbols in the 32..255 character code range. For */
  499. /* more information, see `http://www.ceviz.net/symbol.htm'. */
  500. /* */
  501. /* FT_ENCODING_SJIS :: */
  502. /* Corresponds to Japanese SJIS encoding. More info at */
  503. /* at `http://langsupport.japanreference.com/encoding.shtml'. */
  504. /* See note on multi-byte encodings below. */
  505. /* */
  506. /* FT_ENCODING_GB2312 :: */
  507. /* Corresponds to an encoding system for Simplified Chinese as used */
  508. /* used in mainland China. */
  509. /* */
  510. /* FT_ENCODING_BIG5 :: */
  511. /* Corresponds to an encoding system for Traditional Chinese as */
  512. /* used in Taiwan and Hong Kong. */
  513. /* */
  514. /* FT_ENCODING_WANSUNG :: */
  515. /* Corresponds to the Korean encoding system known as Wansung. */
  516. /* For more information see */
  517. /* `http://www.microsoft.com/typography/unicode/949.txt'. */
  518. /* */
  519. /* FT_ENCODING_JOHAB :: */
  520. /* The Korean standard character set (KS~C 5601-1992), which */
  521. /* corresponds to MS Windows code page 1361. This character set */
  522. /* includes all possible Hangeul character combinations. */
  523. /* */
  524. /* FT_ENCODING_ADOBE_LATIN_1 :: */
  525. /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
  526. /* PostScript font. It is limited to 256 character codes. */
  527. /* */
  528. /* FT_ENCODING_ADOBE_STANDARD :: */
  529. /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
  530. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  531. /* codes. */
  532. /* */
  533. /* FT_ENCODING_ADOBE_EXPERT :: */
  534. /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
  535. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  536. /* codes. */
  537. /* */
  538. /* FT_ENCODING_ADOBE_CUSTOM :: */
  539. /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
  540. /* OpenType/CFF fonts. It is limited to 256 character codes. */
  541. /* */
  542. /* FT_ENCODING_APPLE_ROMAN :: */
  543. /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
  544. /* and OpenType fonts contain a charmap for this encoding, since */
  545. /* older versions of Mac OS are able to use it. */
  546. /* */
  547. /* FT_ENCODING_OLD_LATIN_2 :: */
  548. /* This value is deprecated and was never used nor reported by */
  549. /* FreeType. Don't use or test for it. */
  550. /* */
  551. /* FT_ENCODING_MS_SJIS :: */
  552. /* Same as FT_ENCODING_SJIS. Deprecated. */
  553. /* */
  554. /* FT_ENCODING_MS_GB2312 :: */
  555. /* Same as FT_ENCODING_GB2312. Deprecated. */
  556. /* */
  557. /* FT_ENCODING_MS_BIG5 :: */
  558. /* Same as FT_ENCODING_BIG5. Deprecated. */
  559. /* */
  560. /* FT_ENCODING_MS_WANSUNG :: */
  561. /* Same as FT_ENCODING_WANSUNG. Deprecated. */
  562. /* */
  563. /* FT_ENCODING_MS_JOHAB :: */
  564. /* Same as FT_ENCODING_JOHAB. Deprecated. */
  565. /* */
  566. /* <Note> */
  567. /* By default, FreeType automatically synthesizes a Unicode charmap */
  568. /* for PostScript fonts, using their glyph names dictionaries. */
  569. /* However, it also reports the encodings defined explicitly in the */
  570. /* font file, for the cases when they are needed, with the Adobe */
  571. /* values as well. */
  572. /* */
  573. /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
  574. /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
  575. /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
  576. /* which encoding is really present. If, for example, the */
  577. /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
  578. /* the font is encoded in KOI8-R. */
  579. /* */
  580. /* FT_ENCODING_NONE is always set (with a single exception) by the */
  581. /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
  582. /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
  583. /* which encoding is really present. For example, */
  584. /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
  585. /* Russian). */
  586. /* */
  587. /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
  588. /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
  589. /* FT_ENCODING_APPLE_ROMAN). */
  590. /* */
  591. /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
  592. /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
  593. /* be needed to be able to distinguish Apple encoding variants. See */
  594. /* */
  595. /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
  596. /* */
  597. /* to get an idea how to do that. Basically, if the language ID */
  598. /* is~0, don't use it, otherwise subtract 1 from the language ID. */
  599. /* Then examine `encoding_id'. If, for example, `encoding_id' is */
  600. /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
  601. /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
  602. /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
  603. /* variant the Arabic encoding. */
  604. /* */
  605. typedef enum FT_Encoding_
  606. {
  607. FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
  608. FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
  609. FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
  610. FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
  611. FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
  612. FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
  613. FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
  614. FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
  615. /* for backwards compatibility */
  616. FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
  617. FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
  618. FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
  619. FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
  620. FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
  621. FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
  622. FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
  623. FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
  624. FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
  625. FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
  626. FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
  627. } FT_Encoding;
  628. /*************************************************************************/
  629. /* */
  630. /* <Enum> */
  631. /* ft_encoding_xxx */
  632. /* */
  633. /* <Description> */
  634. /* These constants are deprecated; use the corresponding @FT_Encoding */
  635. /* values instead. */
  636. /* */
  637. #define ft_encoding_none FT_ENCODING_NONE
  638. #define ft_encoding_unicode FT_ENCODING_UNICODE
  639. #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
  640. #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
  641. #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
  642. #define ft_encoding_sjis FT_ENCODING_SJIS
  643. #define ft_encoding_gb2312 FT_ENCODING_GB2312
  644. #define ft_encoding_big5 FT_ENCODING_BIG5
  645. #define ft_encoding_wansung FT_ENCODING_WANSUNG
  646. #define ft_encoding_johab FT_ENCODING_JOHAB
  647. #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
  648. #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
  649. #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
  650. #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
  651. /*************************************************************************/
  652. /* */
  653. /* <Struct> */
  654. /* FT_CharMapRec */
  655. /* */
  656. /* <Description> */
  657. /* The base charmap structure. */
  658. /* */
  659. /* <Fields> */
  660. /* face :: A handle to the parent face object. */
  661. /* */
  662. /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
  663. /* this with @FT_Select_Charmap. */
  664. /* */
  665. /* platform_id :: An ID number describing the platform for the */
  666. /* following encoding ID. This comes directly from */
  667. /* the TrueType specification and should be emulated */
  668. /* for other formats. */
  669. /* */
  670. /* encoding_id :: A platform specific encoding number. This also */
  671. /* comes from the TrueType specification and should be */
  672. /* emulated similarly. */
  673. /* */
  674. typedef struct FT_CharMapRec_
  675. {
  676. FT_Face face;
  677. FT_Encoding encoding;
  678. FT_UShort platform_id;
  679. FT_UShort encoding_id;
  680. } FT_CharMapRec;
  681. /*************************************************************************/
  682. /*************************************************************************/
  683. /* */
  684. /* B A S E O B J E C T C L A S S E S */
  685. /* */
  686. /*************************************************************************/
  687. /*************************************************************************/
  688. /*************************************************************************/
  689. /* */
  690. /* <Type> */
  691. /* FT_Face_Internal */
  692. /* */
  693. /* <Description> */
  694. /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
  695. /* model private data of a given @FT_Face object. */
  696. /* */
  697. /* This structure might change between releases of FreeType~2 and is */
  698. /* not generally available to client applications. */
  699. /* */
  700. typedef struct FT_Face_InternalRec_* FT_Face_Internal;
  701. /*************************************************************************/
  702. /* */
  703. /* <Struct> */
  704. /* FT_FaceRec */
  705. /* */
  706. /* <Description> */
  707. /* FreeType root face class structure. A face object models a */
  708. /* typeface in a font file. */
  709. /* */
  710. /* <Fields> */
  711. /* num_faces :: The number of faces in the font file. Some */
  712. /* font formats can have multiple faces in */
  713. /* a font file. */
  714. /* */
  715. /* face_index :: The index of the face in the font file. It */
  716. /* is set to~0 if there is only one face in */
  717. /* the font file. */
  718. /* */
  719. /* face_flags :: A set of bit flags that give important */
  720. /* information about the face; see */
  721. /* @FT_FACE_FLAG_XXX for the details. */
  722. /* */
  723. /* style_flags :: A set of bit flags indicating the style of */
  724. /* the face; see @FT_STYLE_FLAG_XXX for the */
  725. /* details. */
  726. /* */
  727. /* num_glyphs :: The number of glyphs in the face. If the */
  728. /* face is scalable and has sbits (see */
  729. /* `num_fixed_sizes'), it is set to the number */
  730. /* of outline glyphs. */
  731. /* */
  732. /* For CID-keyed fonts, this value gives the */
  733. /* highest CID used in the font. */
  734. /* */
  735. /* family_name :: The face's family name. This is an ASCII */
  736. /* string, usually in English, which describes */
  737. /* the typeface's family (like `Times New */
  738. /* Roman', `Bodoni', `Garamond', etc). This */
  739. /* is a least common denominator used to list */
  740. /* fonts. Some formats (TrueType & OpenType) */
  741. /* provide localized and Unicode versions of */
  742. /* this string. Applications should use the */
  743. /* format specific interface to access them. */
  744. /* Can be NULL (e.g., in fonts embedded in a */
  745. /* PDF file). */
  746. /* */
  747. /* style_name :: The face's style name. This is an ASCII */
  748. /* string, usually in English, which describes */
  749. /* the typeface's style (like `Italic', */
  750. /* `Bold', `Condensed', etc). Not all font */
  751. /* formats provide a style name, so this field */
  752. /* is optional, and can be set to NULL. As */
  753. /* for `family_name', some formats provide */
  754. /* localized and Unicode versions of this */
  755. /* string. Applications should use the format */
  756. /* specific interface to access them. */
  757. /* */
  758. /* num_fixed_sizes :: The number of bitmap strikes in the face. */
  759. /* Even if the face is scalable, there might */
  760. /* still be bitmap strikes, which are called */
  761. /* `sbits' in that case. */
  762. /* */
  763. /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
  764. /* strikes in the face. It is set to NULL if */
  765. /* there is no bitmap strike. */
  766. /* */
  767. /* num_charmaps :: The number of charmaps in the face. */
  768. /* */
  769. /* charmaps :: An array of the charmaps of the face. */
  770. /* */
  771. /* generic :: A field reserved for client uses. See the */
  772. /* @FT_Generic type description. */
  773. /* */
  774. /* bbox :: The font bounding box. Coordinates are */
  775. /* expressed in font units (see */
  776. /* `units_per_EM'). The box is large enough */
  777. /* to contain any glyph from the font. Thus, */
  778. /* `bbox.yMax' can be seen as the `maximal */
  779. /* ascender', and `bbox.yMin' as the `minimal */
  780. /* descender'. Only relevant for scalable */
  781. /* formats. */
  782. /* */
  783. /* Note that the bounding box might be off by */
  784. /* (at least) one pixel for hinted fonts. See */
  785. /* @FT_Size_Metrics for further discussion. */
  786. /* */
  787. /* units_per_EM :: The number of font units per EM square for */
  788. /* this face. This is typically 2048 for */
  789. /* TrueType fonts, and 1000 for Type~1 fonts. */
  790. /* Only relevant for scalable formats. */
  791. /* */
  792. /* ascender :: The typographic ascender of the face, */
  793. /* expressed in font units. For font formats */
  794. /* not having this information, it is set to */
  795. /* `bbox.yMax'. Only relevant for scalable */
  796. /* formats. */
  797. /* */
  798. /* descender :: The typographic descender of the face, */
  799. /* expressed in font units. For font formats */
  800. /* not having this information, it is set to */
  801. /* `bbox.yMin'. Note that this field is */
  802. /* usually negative. Only relevant for */
  803. /* scalable formats. */
  804. /* */
  805. /* height :: The height is the vertical distance */
  806. /* between two consecutive baselines, */
  807. /* expressed in font units. It is always */
  808. /* positive. Only relevant for scalable */
  809. /* formats. */
  810. /* */
  811. /* max_advance_width :: The maximal advance width, in font units, */
  812. /* for all glyphs in this face. This can be */
  813. /* used to make word wrapping computations */
  814. /* faster. Only relevant for scalable */
  815. /* formats. */
  816. /* */
  817. /* max_advance_height :: The maximal advance height, in font units, */
  818. /* for all glyphs in this face. This is only */
  819. /* relevant for vertical layouts, and is set */
  820. /* to `height' for fonts that do not provide */
  821. /* vertical metrics. Only relevant for */
  822. /* scalable formats. */
  823. /* */
  824. /* underline_position :: The position, in font units, of the */
  825. /* underline line for this face. It is the */
  826. /* center of the underlining stem. Only */
  827. /* relevant for scalable formats. */
  828. /* */
  829. /* underline_thickness :: The thickness, in font units, of the */
  830. /* underline for this face. Only relevant for */
  831. /* scalable formats. */
  832. /* */
  833. /* glyph :: The face's associated glyph slot(s). */
  834. /* */
  835. /* size :: The current active size for this face. */
  836. /* */
  837. /* charmap :: The current active charmap for this face. */
  838. /* */
  839. /* <Note> */
  840. /* Fields may be changed after a call to @FT_Attach_File or */
  841. /* @FT_Attach_Stream. */
  842. /* */
  843. typedef struct FT_FaceRec_
  844. {
  845. FT_Long num_faces;
  846. FT_Long face_index;
  847. FT_Long face_flags;
  848. FT_Long style_flags;
  849. FT_Long num_glyphs;
  850. FT_String* family_name;
  851. FT_String* style_name;
  852. FT_Int num_fixed_sizes;
  853. FT_Bitmap_Size* available_sizes;
  854. FT_Int num_charmaps;
  855. FT_CharMap* charmaps;
  856. FT_Generic generic;
  857. /*# The following member variables (down to `underline_thickness') */
  858. /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
  859. /*# for bitmap fonts. */
  860. FT_BBox bbox;
  861. FT_UShort units_per_EM;
  862. FT_Short ascender;
  863. FT_Short descender;
  864. FT_Short height;
  865. FT_Short max_advance_width;
  866. FT_Short max_advance_height;
  867. FT_Short underline_position;
  868. FT_Short underline_thickness;
  869. FT_GlyphSlot glyph;
  870. FT_Size size;
  871. FT_CharMap charmap;
  872. /*@private begin */
  873. FT_Driver driver;
  874. FT_Memory memory;
  875. FT_Stream stream;
  876. FT_ListRec sizes_list;
  877. FT_Generic autohint;
  878. void* extensions;
  879. FT_Face_Internal internal;
  880. /*@private end */
  881. } FT_FaceRec;
  882. /*************************************************************************/
  883. /* */
  884. /* <Enum> */
  885. /* FT_FACE_FLAG_XXX */
  886. /* */
  887. /* <Description> */
  888. /* A list of bit flags used in the `face_flags' field of the */
  889. /* @FT_FaceRec structure. They inform client applications of */
  890. /* properties of the corresponding face. */
  891. /* */
  892. /* <Values> */
  893. /* FT_FACE_FLAG_SCALABLE :: */
  894. /* Indicates that the face contains outline glyphs. This doesn't */
  895. /* prevent bitmap strikes, i.e., a face can have both this and */
  896. /* and @FT_FACE_FLAG_FIXED_SIZES set. */
  897. /* */
  898. /* FT_FACE_FLAG_FIXED_SIZES :: */
  899. /* Indicates that the face contains bitmap strikes. See also the */
  900. /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
  901. /* */
  902. /* FT_FACE_FLAG_FIXED_WIDTH :: */
  903. /* Indicates that the face contains fixed-width characters (like */
  904. /* Courier, Lucido, MonoType, etc.). */
  905. /* */
  906. /* FT_FACE_FLAG_SFNT :: */
  907. /* Indicates that the face uses th