PageRenderTime 68ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/extlibs/SFML/extlibs/headers/freetype/freetype.h

https://bitbucket.org/hugoruscitti/pilascpp
C++ Header | 3919 lines | 481 code | 296 blank | 3142 comment | 0 complexity | 4ab279be43fa13b84f38100b9241f92a MD5 | raw file
  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 the `sfnt' storage scheme. For */
  908. /* now, this means TrueType and OpenType. */
  909. /* */
  910. /* FT_FACE_FLAG_HORIZONTAL :: */
  911. /* Indicates that the face contains horizontal glyph metrics. This */
  912. /* should be set for all common formats. */
  913. /* */
  914. /* FT_FACE_FLAG_VERTICAL :: */
  915. /* Indicates that the face contains vertical glyph metrics. This */
  916. /* is only available in some formats, not all of them. */
  917. /* */
  918. /* FT_FACE_FLAG_KERNING :: */
  919. /* Indicates that the face contains kerning information. If set, */
  920. /* the kerning distance can be retrieved through the function */
  921. /* @FT_Get_Kerning. Otherwise the function always return the */
  922. /* vector (0,0). Note that FreeType doesn't handle kerning data */
  923. /* from the `GPOS' table (as present in some OpenType fonts). */
  924. /* */
  925. /* FT_FACE_FLAG_FAST_GLYPHS :: */
  926. /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
  927. /* */
  928. /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
  929. /* Indicates that the font contains multiple masters and is capable */
  930. /* of interpolating between them. See the multiple-masters */
  931. /* specific API for details. */
  932. /* */
  933. /* FT_FACE_FLAG_GLYPH_NAMES :: */
  934. /* Indicates that the font contains glyph names that can be */
  935. /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
  936. /* fonts contain broken glyph name tables. Use the function */
  937. /* @FT_Has_PS_Glyph_Names when needed. */
  938. /* */
  939. /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
  940. /* Used internally by FreeType to indicate that a face's stream was */
  941. /* provided by the client application and should not be destroyed */
  942. /* when @FT_Done_Face is called. Don't read or test this flag. */
  943. /* */
  944. /* FT_FACE_FLAG_HINTER :: */
  945. /* Set if the font driver has a hinting machine of its own. For */
  946. /* example, with TrueType fonts, it makes sense to use data from */
  947. /* the SFNT `gasp' table only if the native TrueType hinting engine */
  948. /* (with the bytecode interpreter) is available and active. */
  949. /* */
  950. /* FT_FACE_FLAG_CID_KEYED :: */
  951. /* Set if the font is CID-keyed. In that case, the font is not */
  952. /* accessed by glyph indices but by CID values. For subsetted */
  953. /* CID-keyed fonts this has the consequence that not all index */
  954. /* values are a valid argument to FT_Load_Glyph. Only the CID */
  955. /* values for which corresponding glyphs in the subsetted font */
  956. /* exist make FT_Load_Glyph return successfully; in all other cases */
  957. /* you get an `FT_Err_Invalid_Argument' error. */
  958. /* */
  959. /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
  960. /* have this flag set since the glyphs are accessed in the normal */
  961. /* way (using contiguous indices); the `CID-ness' isn't visible to */
  962. /* the application. */
  963. /* */
  964. /* FT_FACE_FLAG_TRICKY :: */
  965. /* Set if the font is `tricky', this is, it always needs the */
  966. /* font format's native hinting engine to get a reasonable result. */
  967. /* A typical example is the Chinese font `mingli.ttf' which uses */
  968. /* TrueType bytecode instructions to move and scale all of its */
  969. /* subglyphs. */
  970. /* */
  971. /* It is not possible to autohint such fonts using */
  972. /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
  973. /* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */
  974. /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
  975. /* probably never want this except for demonstration purposes. */
  976. /* */
  977. /* Currently, there are six TrueType fonts in the list of tricky */
  978. /* fonts; they are hard-coded in file `ttobjs.c'. */
  979. /* */
  980. #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
  981. #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
  982. #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
  983. #define FT_FACE_FLAG_SFNT ( 1L << 3 )
  984. #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
  985. #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
  986. #define FT_FACE_FLAG_KERNING ( 1L << 6 )
  987. #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
  988. #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
  989. #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
  990. #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
  991. #define FT_FACE_FLAG_HINTER ( 1L << 11 )
  992. #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
  993. #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
  994. /*************************************************************************
  995. *
  996. * @macro:
  997. * FT_HAS_HORIZONTAL( face )
  998. *
  999. * @description:
  1000. * A macro that returns true whenever a face object contains
  1001. * horizontal metrics (this is true for all font formats though).
  1002. *
  1003. * @also:
  1004. * @FT_HAS_VERTICAL can be used to check for vertical metrics.
  1005. *
  1006. */
  1007. #define FT_HAS_HORIZONTAL( face ) \
  1008. ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
  1009. /*************************************************************************
  1010. *
  1011. * @macro:
  1012. * FT_HAS_VERTICAL( face )
  1013. *
  1014. * @description:
  1015. * A macro that returns true whenever a face object contains vertical
  1016. * metrics.
  1017. *
  1018. */
  1019. #define FT_HAS_VERTICAL( face ) \
  1020. ( face->face_flags & FT_FACE_FLAG_VERTICAL )
  1021. /*************************************************************************
  1022. *
  1023. * @macro:
  1024. * FT_HAS_KERNING( face )
  1025. *
  1026. * @description:
  1027. * A macro that returns true whenever a face object contains kerning
  1028. * data that can be accessed with @FT_Get_Kerning.
  1029. *
  1030. */
  1031. #define FT_HAS_KERNING( face ) \
  1032. ( face->face_flags & FT_FACE_FLAG_KERNING )
  1033. /*************************************************************************
  1034. *
  1035. * @macro:
  1036. * FT_IS_SCALABLE( face )
  1037. *
  1038. * @description:
  1039. * A macro that returns true whenever a face object contains a scalable
  1040. * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
  1041. * and PFR font formats.
  1042. *
  1043. */
  1044. #define FT_IS_SCALABLE( face ) \
  1045. ( face->face_flags & FT_FACE_FLAG_SCALABLE )
  1046. /*************************************************************************
  1047. *
  1048. * @macro:
  1049. * FT_IS_SFNT( face )
  1050. *
  1051. * @description:
  1052. * A macro that returns true whenever a face object contains a font
  1053. * whose format is based on the SFNT storage scheme. This usually
  1054. * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
  1055. * bitmap fonts.
  1056. *
  1057. * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
  1058. * @FT_TRUETYPE_TABLES_H are available.
  1059. *
  1060. */
  1061. #define FT_IS_SFNT( face ) \
  1062. ( face->face_flags & FT_FACE_FLAG_SFNT )
  1063. /*************************************************************************
  1064. *
  1065. * @macro:
  1066. * FT_IS_FIXED_WIDTH( face )
  1067. *
  1068. * @description:
  1069. * A macro that returns true whenever a face object contains a font face
  1070. * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
  1071. * glyphs.
  1072. *
  1073. */
  1074. #define FT_IS_FIXED_WIDTH( face ) \
  1075. ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
  1076. /*************************************************************************
  1077. *
  1078. * @macro:
  1079. * FT_HAS_FIXED_SIZES( face )
  1080. *
  1081. * @description:
  1082. * A macro that returns true whenever a face object contains some
  1083. * embedded bitmaps. See the `available_sizes' field of the
  1084. * @FT_FaceRec structure.
  1085. *
  1086. */
  1087. #define FT_HAS_FIXED_SIZES( face ) \
  1088. ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
  1089. /*************************************************************************
  1090. *
  1091. * @macro:
  1092. * FT_HAS_FAST_GLYPHS( face )
  1093. *
  1094. * @description:
  1095. * Deprecated.
  1096. *
  1097. */
  1098. #define FT_HAS_FAST_GLYPHS( face ) 0
  1099. /*************************************************************************
  1100. *
  1101. * @macro:
  1102. * FT_HAS_GLYPH_NAMES( face )
  1103. *
  1104. * @description:
  1105. * A macro that returns true whenever a face object contains some glyph
  1106. * names that can be accessed through @FT_Get_Glyph_Name.
  1107. *
  1108. */
  1109. #define FT_HAS_GLYPH_NAMES( face ) \
  1110. ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
  1111. /*************************************************************************
  1112. *
  1113. * @macro:
  1114. * FT_HAS_MULTIPLE_MASTERS( face )
  1115. *
  1116. * @description:
  1117. * A macro that returns true whenever a face object contains some
  1118. * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
  1119. * are then available to choose the exact design you want.
  1120. *
  1121. */
  1122. #define FT_HAS_MULTIPLE_MASTERS( face ) \
  1123. ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
  1124. /*************************************************************************
  1125. *
  1126. * @macro:
  1127. * FT_IS_CID_KEYED( face )
  1128. *
  1129. * @description:
  1130. * A macro that returns true whenever a face object contains a CID-keyed
  1131. * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
  1132. * details.
  1133. *
  1134. * If this macro is true, all functions defined in @FT_CID_H are
  1135. * available.
  1136. *
  1137. */
  1138. #define FT_IS_CID_KEYED( face ) \
  1139. ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
  1140. /*************************************************************************
  1141. *
  1142. * @macro:
  1143. * FT_IS_TRICKY( face )
  1144. *
  1145. * @description:
  1146. * A macro that returns true whenever a face represents a `tricky' font.
  1147. * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
  1148. *
  1149. */
  1150. #define FT_IS_TRICKY( face ) \
  1151. ( face->face_flags & FT_FACE_FLAG_TRICKY )
  1152. /*************************************************************************/
  1153. /* */
  1154. /* <Const> */
  1155. /* FT_STYLE_FLAG_XXX */
  1156. /* */
  1157. /* <Description> */
  1158. /* A list of bit-flags used to indicate the style of a given face. */
  1159. /* These are used in the `style_flags' field of @FT_FaceRec. */
  1160. /* */
  1161. /* <Values> */
  1162. /* FT_STYLE_FLAG_ITALIC :: */
  1163. /* Indicates that a given face style is italic or oblique. */
  1164. /* */
  1165. /* FT_STYLE_FLAG_BOLD :: */
  1166. /* Indicates that a given face is bold. */
  1167. /* */
  1168. /* <Note> */
  1169. /* The style information as provided by FreeType is very basic. More */
  1170. /* details are beyond the scope and should be done on a higher level */
  1171. /* (for example, by analyzing various fields of the `OS/2' table in */
  1172. /* SFNT based fonts). */
  1173. /* */
  1174. #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
  1175. #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
  1176. /*************************************************************************/
  1177. /* */
  1178. /* <Type> */
  1179. /* FT_Size_Internal */
  1180. /* */
  1181. /* <Description> */
  1182. /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
  1183. /* model private data of a given @FT_Size object. */
  1184. /* */
  1185. typedef struct FT_Size_InternalRec_* FT_Size_Internal;
  1186. /*************************************************************************/
  1187. /* */
  1188. /* <Struct> */
  1189. /* FT_Size_Metrics */
  1190. /* */
  1191. /* <Description> */
  1192. /* The size metrics structure gives the metrics of a size object. */
  1193. /* */
  1194. /* <Fields> */
  1195. /* x_ppem :: The width of the scaled EM square in pixels, hence */
  1196. /* the term `ppem' (pixels per EM). It is also */
  1197. /* referred to as `nominal width'. */
  1198. /* */
  1199. /* y_ppem :: The height of the scaled EM square in pixels, */
  1200. /* hence the term `ppem' (pixels per EM). It is also */
  1201. /* referred to as `nominal height'. */
  1202. /* */
  1203. /* x_scale :: A 16.16 fractional scaling value used to convert */
  1204. /* horizontal metrics from font units to 26.6 */
  1205. /* fractional pixels. Only relevant for scalable */
  1206. /* font formats. */
  1207. /* */
  1208. /* y_scale :: A 16.16 fractional scaling value used to convert */
  1209. /* vertical metrics from font units to 26.6 */
  1210. /* fractional pixels. Only relevant for scalable */
  1211. /* font formats. */
  1212. /* */
  1213. /* ascender :: The ascender in 26.6 fractional pixels. See */
  1214. /* @FT_FaceRec for the details. */
  1215. /* */
  1216. /* descender :: The descender in 26.6 fractional pixels. See */
  1217. /* @FT_FaceRec for the details. */
  1218. /* */
  1219. /* height :: The height in 26.6 fractional pixels. See */
  1220. /* @FT_FaceRec for the details. */
  1221. /* */
  1222. /* max_advance :: The maximal advance width in 26.6 fractional */
  1223. /* pixels. See @FT_FaceRec for the details. */
  1224. /* */
  1225. /* <Note> */
  1226. /* The scaling values, if relevant, are determined first during a */
  1227. /* size changing operation. The remaining fields are then set by the */
  1228. /* driver. For scalable formats, they are usually set to scaled */
  1229. /* values of the corresponding fields in @FT_FaceRec. */
  1230. /* */
  1231. /* Note that due to glyph hinting, these values might not be exact */
  1232. /* for certain fonts. Thus they must be treated as unreliable */
  1233. /* with an error margin of at least one pixel! */
  1234. /* */
  1235. /* Indeed, the only way to get the exact metrics is to render _all_ */
  1236. /* glyphs. As this would be a definite performance hit, it is up to */
  1237. /* client applications to perform such computations. */
  1238. /* */
  1239. /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
  1240. /* */
  1241. typedef struct FT_Size_Metrics_
  1242. {
  1243. FT_UShort x_ppem; /* horizontal pixels per EM */
  1244. FT_UShort y_ppem; /* vertical pixels per EM */
  1245. FT_Fixed x_scale; /* scaling values used to convert font */
  1246. FT_Fixed y_scale; /* units to 26.6 fractional pixels */
  1247. FT_Pos ascender; /* ascender in 26.6 frac. pixels */
  1248. FT_Pos descender; /* descender in 26.6 frac. pixels */
  1249. FT_Pos height; /* text height in 26.6 frac. pixels */
  1250. FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
  1251. } FT_Size_Metrics;
  1252. /*************************************************************************/
  1253. /* */
  1254. /* <Struct> */
  1255. /* FT_SizeRec */
  1256. /* */
  1257. /* <Description> */
  1258. /* FreeType root size class structure. A size object models a face */
  1259. /* object at a given size. */
  1260. /* */
  1261. /* <Fields> */
  1262. /* face :: Handle to the parent face object. */
  1263. /* */
  1264. /* generic :: A typeless pointer, which is unused by the FreeType */
  1265. /* library or any of its drivers. It can be used by */
  1266. /* client applications to link their own data to each size */
  1267. /* object. */
  1268. /* */
  1269. /* metrics :: Metrics for this size object. This field is read-only. */
  1270. /* */
  1271. typedef struct FT_SizeRec_
  1272. {
  1273. FT_Face face; /* parent face object */
  1274. FT_Generic generic; /* generic pointer for client uses */
  1275. FT_Size_Metrics metrics; /* size metrics */
  1276. FT_Size_Internal internal;
  1277. } FT_SizeRec;
  1278. /*************************************************************************/
  1279. /* */
  1280. /* <Struct> */
  1281. /* FT_SubGlyph */
  1282. /* */
  1283. /* <Description> */
  1284. /* The subglyph structure is an internal object used to describe */
  1285. /* subglyphs (for example, in the case of composites). */
  1286. /* */
  1287. /* <Note> */
  1288. /* The subglyph implementation is not part of the high-level API, */
  1289. /* hence the forward structure declaration. */
  1290. /* */
  1291. /* You can however retrieve subglyph information with */
  1292. /* @FT_Get_SubGlyph_Info. */
  1293. /* */
  1294. typedef struct FT_SubGlyphRec_* FT_SubGlyph;
  1295. /*************************************************************************/
  1296. /* */
  1297. /* <Type> */
  1298. /* FT_Slot_Internal */
  1299. /* */
  1300. /* <Description> */
  1301. /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
  1302. /* model private data of a given @FT_GlyphSlot object. */
  1303. /* */
  1304. typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
  1305. /*************************************************************************/
  1306. /* */
  1307. /* <Struct> */
  1308. /* FT_GlyphSlotRec */
  1309. /* */
  1310. /* <Description> */
  1311. /* FreeType root glyph slot class structure. A glyph slot is a */
  1312. /* container where individual glyphs can be loaded, be they in */
  1313. /* outline or bitmap format. */
  1314. /* */
  1315. /* <Fields> */
  1316. /* library :: A handle to the FreeType library instance */
  1317. /* this slot belongs to. */
  1318. /* */
  1319. /* face :: A handle to the parent face object. */
  1320. /* */
  1321. /* next :: In some cases (like some font tools), several */
  1322. /* glyph slots per face object can be a good */
  1323. /* thing. As this is rare, the glyph slots are */
  1324. /* listed through a direct, single-linked list */
  1325. /* using its `next' field. */
  1326. /* */
  1327. /* generic :: A typeless pointer which is unused by the */
  1328. /* FreeType library or any of its drivers. It */
  1329. /* can be used by client applications to link */
  1330. /* their own data to each glyph slot object. */
  1331. /* */
  1332. /* metrics :: The metrics of the last loaded glyph in the */
  1333. /* slot. The returned values depend on the last */
  1334. /* load flags (see the @FT_Load_Glyph API */
  1335. /* function) and can be expressed either in 26.6 */
  1336. /* fractional pixels or font units. */
  1337. /* */
  1338. /* Note that even when the glyph image is */
  1339. /* transformed, the metrics are not. */
  1340. /* */
  1341. /* linearHoriAdvance :: The advance width of the unhinted glyph. */
  1342. /* Its value is expressed in 16.16 fractional */
  1343. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1344. /* when loading the glyph. This field can be */
  1345. /* important to perform correct WYSIWYG layout. */
  1346. /* Only relevant for outline glyphs. */
  1347. /* */
  1348. /* linearVertAdvance :: The advance height of the unhinted glyph. */
  1349. /* Its value is expressed in 16.16 fractional */
  1350. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1351. /* when loading the glyph. This field can be */
  1352. /* important to perform correct WYSIWYG layout. */
  1353. /* Only relevant for outline glyphs. */
  1354. /* */
  1355. /* advance :: This shorthand is, depending on */
  1356. /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
  1357. /* advance width for the glyph (in 26.6 */
  1358. /* fractional pixel format). As specified with */
  1359. /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
  1360. /* `horiAdvance' or the `vertAdvance' value of */
  1361. /* `metrics' field. */
  1362. /* */
  1363. /* format :: This field indicates the format of the image */
  1364. /* contained in the glyph slot. Typically */
  1365. /* @FT_GLYPH_FORMAT_BITMAP, */
  1366. /* @FT_GLYPH_FORMAT_OUTLINE, or */
  1367. /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
  1368. /* possible. */
  1369. /* */
  1370. /* bitmap :: This field is used as a bitmap descriptor */
  1371. /* when the slot format is */
  1372. /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
  1373. /* address and content of the bitmap buffer can */
  1374. /* change between calls of @FT_Load_Glyph and a */
  1375. /* few other functions. */
  1376. /* */
  1377. /* bitmap_left :: This is the bitmap's left bearing expressed */
  1378. /* in integer pixels. Of course, this is only */
  1379. /* valid if the format is */
  1380. /* @FT_GLYPH_FORMAT_BITMAP. */
  1381. /* */
  1382. /* bitmap_top :: This is the bitmap's top bearing expressed in */
  1383. /* integer pixels. Remember that this is the */
  1384. /* distance from the baseline to the top-most */
  1385. /* glyph scanline, upwards y~coordinates being */
  1386. /* *positive*. */
  1387. /* */
  1388. /* outline :: The outline descriptor for the current glyph */
  1389. /* image if its format is */
  1390. /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
  1391. /* loaded, `outline' can be transformed, */
  1392. /* distorted, embolded, etc. However, it must */
  1393. /* not be freed. */
  1394. /* */
  1395. /* num_subglyphs :: The number of subglyphs in a composite glyph. */
  1396. /* This field is only valid for the composite */
  1397. /* glyph format that should normally only be */
  1398. /* loaded with the @FT_LOAD_NO_RECURSE flag. */
  1399. /* For now this is internal to FreeType. */
  1400. /* */
  1401. /* subglyphs :: An array of subglyph descriptors for */
  1402. /* composite glyphs. There are `num_subglyphs' */
  1403. /* elements in there. Currently internal to */
  1404. /* FreeType. */
  1405. /* */
  1406. /* control_data :: Certain font drivers can also return the */
  1407. /* control data for a given glyph image (e.g. */
  1408. /* TrueType bytecode, Type~1 charstrings, etc.). */
  1409. /* This field is a pointer to such data. */
  1410. /* */
  1411. /* control_len :: This is the length in bytes of the control */
  1412. /* data. */
  1413. /* */
  1414. /* other :: Really wicked formats can use this pointer to */
  1415. /* present their own glyph image to client */
  1416. /* applications. Note that the application */
  1417. /* needs to know about the image format. */
  1418. /* */
  1419. /* lsb_delta :: The difference between hinted and unhinted */
  1420. /* left side bearing while autohinting is */
  1421. /* active. Zero otherwise. */
  1422. /* */
  1423. /* rsb_delta :: The difference between hinted and unhinted */
  1424. /* right side bearing while autohinting is */
  1425. /* active. Zero otherwise. */
  1426. /* */
  1427. /* <Note> */
  1428. /* If @FT_Load_Glyph is called with default flags (see */
  1429. /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
  1430. /* its native format (e.g., an outline glyph for TrueType and Type~1 */
  1431. /* formats). */
  1432. /* */
  1433. /* This image can later be converted into a bitmap by calling */
  1434. /* @FT_Render_Glyph. This function finds the current renderer for */
  1435. /* the native image's format, then invokes it. */
  1436. /* */
  1437. /* The renderer is in charge of transforming the native image through */
  1438. /* the slot's face transformation fields, then converting it into a */
  1439. /* bitmap that is returned in `slot->bitmap'. */
  1440. /* */
  1441. /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
  1442. /* to specify the position of the bitmap relative to the current pen */
  1443. /* position (e.g., coordinates (0,0) on the baseline). Of course, */
  1444. /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
  1445. /* */
  1446. /* <Note> */
  1447. /* Here a small pseudo code fragment which shows how to use */
  1448. /* `lsb_delta' and `rsb_delta': */
  1449. /* */
  1450. /* { */
  1451. /* FT_Pos origin_x = 0; */
  1452. /* FT_Pos prev_rsb_delta = 0; */
  1453. /* */
  1454. /* */
  1455. /* for all glyphs do */
  1456. /* <compute kern between current and previous glyph and add it to */
  1457. /* `origin_x'> */
  1458. /* */
  1459. /* <load glyph with `FT_Load_Glyph'> */
  1460. /* */
  1461. /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
  1462. /* origin_x -= 64; */
  1463. /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
  1464. /* origin_x += 64; */
  1465. /* */
  1466. /* prev_rsb_delta = face->glyph->rsb_delta; */
  1467. /* */
  1468. /* <save glyph image, or render glyph, or ...> */
  1469. /* */
  1470. /* origin_x += face->glyph->advance.x; */
  1471. /* endfor */
  1472. /* } */
  1473. /* */
  1474. typedef struct FT_GlyphSlotRec_
  1475. {
  1476. FT_Library library;
  1477. FT_Face face;
  1478. FT_GlyphSlot next;
  1479. FT_UInt reserved; /* retained for binary compatibility */
  1480. FT_Generic generic;
  1481. FT_Glyph_Metrics metrics;
  1482. FT_Fixed linearHoriAdvance;
  1483. FT_Fixed linearVertAdvance;
  1484. FT_Vector advance;
  1485. FT_Glyph_Format format;
  1486. FT_Bitmap bitmap;
  1487. FT_Int bitmap_left;
  1488. FT_Int bitmap_top;
  1489. FT_Outline outline;
  1490. FT_UInt num_subglyphs;
  1491. FT_SubGlyph subglyphs;
  1492. void* control_data;
  1493. long control_len;
  1494. FT_Pos lsb_delta;
  1495. FT_Pos rsb_delta;
  1496. void* other;
  1497. FT_Slot_Internal internal;
  1498. } FT_GlyphSlotRec;
  1499. /*************************************************************************/
  1500. /*************************************************************************/
  1501. /* */
  1502. /* F U N C T I O N S */
  1503. /* */
  1504. /*************************************************************************/
  1505. /*************************************************************************/
  1506. /*************************************************************************/
  1507. /* */
  1508. /* <Function> */
  1509. /* FT_Init_FreeType */
  1510. /* */
  1511. /* <Description> */
  1512. /* Initialize a new FreeType library object. The set of modules */
  1513. /* that are registered by this function is determined at build time. */
  1514. /* */
  1515. /* <Output> */
  1516. /* alibrary :: A handle to a new library object. */
  1517. /* */
  1518. /* <Return> */
  1519. /* FreeType error code. 0~means success. */
  1520. /* */
  1521. /* <Note> */
  1522. /* In case you want to provide your own memory allocating routines, */
  1523. /* use @FT_New_Library instead, followed by a call to */
  1524. /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
  1525. /* */
  1526. FT_EXPORT( FT_Error )
  1527. FT_Init_FreeType( FT_Library *alibrary );
  1528. /*************************************************************************/
  1529. /* */
  1530. /* <Function> */
  1531. /* FT_Done_FreeType */
  1532. /* */
  1533. /* <Description> */
  1534. /* Destroy a given FreeType library object and all of its children, */
  1535. /* including resources, drivers, faces, sizes, etc. */
  1536. /* */
  1537. /* <Input> */
  1538. /* library :: A handle to the target library object. */
  1539. /* */
  1540. /* <Return> */
  1541. /* FreeType error code. 0~means success. */
  1542. /* */
  1543. FT_EXPORT( FT_Error )
  1544. FT_Done_FreeType( FT_Library library );
  1545. /*************************************************************************/
  1546. /* */
  1547. /* <Enum> */
  1548. /* FT_OPEN_XXX */
  1549. /* */
  1550. /* <Description> */
  1551. /* A list of bit-field constants used within the `flags' field of the */
  1552. /* @FT_Open_Args structure. */
  1553. /* */
  1554. /* <Values> */
  1555. /* FT_OPEN_MEMORY :: This is a memory-based stream. */
  1556. /* */
  1557. /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
  1558. /* */
  1559. /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
  1560. /* name. */
  1561. /* */
  1562. /* FT_OPEN_DRIVER :: Use the `driver' field. */
  1563. /* */
  1564. /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
  1565. /* */
  1566. /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
  1567. /* */
  1568. /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
  1569. /* */
  1570. /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
  1571. /* */
  1572. /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
  1573. /* */
  1574. /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
  1575. /* */
  1576. /* <Note> */
  1577. /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
  1578. /* flags are mutually exclusive. */
  1579. /* */
  1580. #define FT_OPEN_MEMORY 0x1
  1581. #define FT_OPEN_STREAM 0x2
  1582. #define FT_OPEN_PATHNAME 0x4
  1583. #define FT_OPEN_DRIVER 0x8
  1584. #define FT_OPEN_PARAMS 0x10
  1585. #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
  1586. #define ft_open_stream FT_OPEN_STREAM /* deprecated */
  1587. #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
  1588. #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
  1589. #define ft_open_params FT_OPEN_PARAMS /* deprecated */
  1590. /*************************************************************************/
  1591. /* */
  1592. /* <Struct> */
  1593. /* FT_Parameter */
  1594. /* */
  1595. /* <Description> */
  1596. /* A simple structure used to pass more or less generic parameters to */
  1597. /* @FT_Open_Face. */
  1598. /* */
  1599. /* <Fields> */
  1600. /* tag :: A four-byte identification tag. */
  1601. /* */
  1602. /* data :: A pointer to the parameter data. */
  1603. /* */
  1604. /* <Note> */
  1605. /* The ID and function of parameters are driver-specific. See the */
  1606. /* various FT_PARAM_TAG_XXX flags for more information. */
  1607. /* */
  1608. typedef struct FT_Parameter_
  1609. {
  1610. FT_ULong tag;
  1611. FT_Pointer data;
  1612. } FT_Parameter;
  1613. /*************************************************************************/
  1614. /* */
  1615. /* <Struct> */
  1616. /* FT_Open_Args */
  1617. /* */
  1618. /* <Description> */
  1619. /* A structure used to indicate how to open a new font file or */
  1620. /* stream. A pointer to such a structure can be used as a parameter */
  1621. /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
  1622. /* */
  1623. /* <Fields> */
  1624. /* flags :: A set of bit flags indicating how to use the */
  1625. /* structure. */
  1626. /* */
  1627. /* memory_base :: The first byte of the file in memory. */
  1628. /* */
  1629. /* memory_size :: The size in bytes of the file in memory. */
  1630. /* */
  1631. /* pathname :: A pointer to an 8-bit file pathname. */
  1632. /* */
  1633. /* stream :: A handle to a source stream object. */
  1634. /* */
  1635. /* driver :: This field is exclusively used by @FT_Open_Face; */
  1636. /* it simply specifies the font driver to use to open */
  1637. /* the face. If set to~0, FreeType tries to load the */
  1638. /* face with each one of the drivers in its list. */
  1639. /* */
  1640. /* num_params :: The number of extra parameters. */
  1641. /* */
  1642. /* params :: Extra parameters passed to the font driver when */
  1643. /* opening a new face. */
  1644. /* */
  1645. /* <Note> */
  1646. /* The stream type is determined by the contents of `flags' which */
  1647. /* are tested in the following order by @FT_Open_Face: */
  1648. /* */
  1649. /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
  1650. /* memory file of `memory_size' bytes, located at `memory_address'. */
  1651. /* The data are are not copied, and the client is responsible for */
  1652. /* releasing and destroying them _after_ the corresponding call to */
  1653. /* @FT_Done_Face. */
  1654. /* */
  1655. /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
  1656. /* custom input stream `stream' is used. */
  1657. /* */
  1658. /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
  1659. /* is a normal file and use `pathname' to open it. */
  1660. /* */
  1661. /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
  1662. /* open the file with the driver whose handler is in `driver'. */
  1663. /* */
  1664. /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
  1665. /* `num_params' and `params' is used. They are ignored otherwise. */
  1666. /* */
  1667. /* Ideally, both the `pathname' and `params' fields should be tagged */
  1668. /* as `const'; this is missing for API backwards compatibility. In */
  1669. /* other words, applications should treat them as read-only. */
  1670. /* */
  1671. typedef struct FT_Open_Args_
  1672. {
  1673. FT_UInt flags;
  1674. const FT_Byte* memory_base;
  1675. FT_Long memory_size;
  1676. FT_String* pathname;
  1677. FT_Stream stream;
  1678. FT_Module driver;
  1679. FT_Int num_params;
  1680. FT_Parameter* params;
  1681. } FT_Open_Args;
  1682. /*************************************************************************/
  1683. /* */
  1684. /* <Function> */
  1685. /* FT_New_Face */
  1686. /* */
  1687. /* <Description> */
  1688. /* This function calls @FT_Open_Face to open a font by its pathname. */
  1689. /* */
  1690. /* <InOut> */
  1691. /* library :: A handle to the library resource. */
  1692. /* */
  1693. /* <Input> */
  1694. /* pathname :: A path to the font file. */
  1695. /* */
  1696. /* face_index :: The index of the face within the font. The first */
  1697. /* face has index~0. */
  1698. /* */
  1699. /* <Output> */
  1700. /* aface :: A handle to a new face object. If `face_index' is */
  1701. /* greater than or equal to zero, it must be non-NULL. */
  1702. /* See @FT_Open_Face for more details. */
  1703. /* */
  1704. /* <Return> */
  1705. /* FreeType error code. 0~means success. */
  1706. /* */
  1707. FT_EXPORT( FT_Error )
  1708. FT_New_Face( FT_Library library,
  1709. const char* filepathname,
  1710. FT_Long face_index,
  1711. FT_Face *aface );
  1712. /*************************************************************************/
  1713. /* */
  1714. /* <Function> */
  1715. /* FT_New_Memory_Face */
  1716. /* */
  1717. /* <Description> */
  1718. /* This function calls @FT_Open_Face to open a font which has been */
  1719. /* loaded into memory. */
  1720. /* */
  1721. /* <InOut> */
  1722. /* library :: A handle to the library resource. */
  1723. /* */
  1724. /* <Input> */
  1725. /* file_base :: A pointer to the beginning of the font data. */
  1726. /* */
  1727. /* file_size :: The size of the memory chunk used by the font data. */
  1728. /* */
  1729. /* face_index :: The index of the face within the font. The first */
  1730. /* face has index~0. */
  1731. /* */
  1732. /* <Output> */
  1733. /* aface :: A handle to a new face object. If `face_index' is */
  1734. /* greater than or equal to zero, it must be non-NULL. */
  1735. /* See @FT_Open_Face for more details. */
  1736. /* */
  1737. /* <Return> */
  1738. /* FreeType error code. 0~means success. */
  1739. /* */
  1740. /* <Note> */
  1741. /* You must not deallocate the memory before calling @FT_Done_Face. */
  1742. /* */
  1743. FT_EXPORT( FT_Error )
  1744. FT_New_Memory_Face( FT_Library library,
  1745. const FT_Byte* file_base,
  1746. FT_Long file_size,
  1747. FT_Long face_index,
  1748. FT_Face *aface );
  1749. /*************************************************************************/
  1750. /* */
  1751. /* <Function> */
  1752. /* FT_Open_Face */
  1753. /* */
  1754. /* <Description> */
  1755. /* Create a face object from a given resource described by */
  1756. /* @FT_Open_Args. */
  1757. /* */
  1758. /* <InOut> */
  1759. /* library :: A handle to the library resource. */
  1760. /* */
  1761. /* <Input> */
  1762. /* args :: A pointer to an `FT_Open_Args' structure which must */
  1763. /* be filled by the caller. */
  1764. /* */
  1765. /* face_index :: The index of the face within the font. The first */
  1766. /* face has index~0. */
  1767. /* */
  1768. /* <Output> */
  1769. /* aface :: A handle to a new face object. If `face_index' is */
  1770. /* greater than or equal to zero, it must be non-NULL. */
  1771. /* See note below. */
  1772. /* */
  1773. /* <Return> */
  1774. /* FreeType error code. 0~means success. */
  1775. /* */
  1776. /* <Note> */
  1777. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1778. /* slot for the face object which can be accessed directly through */
  1779. /* `face->glyph'. */
  1780. /* */
  1781. /* FT_Open_Face can be used to quickly check whether the font */
  1782. /* format of a given font resource is supported by FreeType. If the */
  1783. /* `face_index' field is negative, the function's return value is~0 */
  1784. /* if the font format is recognized, or non-zero otherwise; */
  1785. /* the function returns a more or less empty face handle in `*aface' */
  1786. /* (if `aface' isn't NULL). The only useful field in this special */
  1787. /* case is `face->num_faces' which gives the number of faces within */
  1788. /* the font file. After examination, the returned @FT_Face structure */
  1789. /* should be deallocated with a call to @FT_Done_Face. */
  1790. /* */
  1791. /* Each new face object created with this function also owns a */
  1792. /* default @FT_Size object, accessible as `face->size'. */
  1793. /* */
  1794. /* See the discussion of reference counters in the description of */
  1795. /* @FT_Reference_Face. */
  1796. /* */
  1797. FT_EXPORT( FT_Error )
  1798. FT_Open_Face( FT_Library library,
  1799. const FT_Open_Args* args,
  1800. FT_Long face_index,
  1801. FT_Face *aface );
  1802. /*************************************************************************/
  1803. /* */
  1804. /* <Function> */
  1805. /* FT_Attach_File */
  1806. /* */
  1807. /* <Description> */
  1808. /* This function calls @FT_Attach_Stream to attach a file. */
  1809. /* */
  1810. /* <InOut> */
  1811. /* face :: The target face object. */
  1812. /* */
  1813. /* <Input> */
  1814. /* filepathname :: The pathname. */
  1815. /* */
  1816. /* <Return> */
  1817. /* FreeType error code. 0~means success. */
  1818. /* */
  1819. FT_EXPORT( FT_Error )
  1820. FT_Attach_File( FT_Face face,
  1821. const char* filepathname );
  1822. /*************************************************************************/
  1823. /* */
  1824. /* <Function> */
  1825. /* FT_Attach_Stream */
  1826. /* */
  1827. /* <Description> */
  1828. /* `Attach' data to a face object. Normally, this is used to read */
  1829. /* additional information for the face object. For example, you can */
  1830. /* attach an AFM file that comes with a Type~1 font to get the */
  1831. /* kerning values and other metrics. */
  1832. /* */
  1833. /* <InOut> */
  1834. /* face :: The target face object. */
  1835. /* */
  1836. /* <Input> */
  1837. /* parameters :: A pointer to @FT_Open_Args which must be filled by */
  1838. /* the caller. */
  1839. /* */
  1840. /* <Return> */
  1841. /* FreeType error code. 0~means success. */
  1842. /* */
  1843. /* <Note> */
  1844. /* The meaning of the `attach' (i.e., what really happens when the */
  1845. /* new file is read) is not fixed by FreeType itself. It really */
  1846. /* depends on the font format (and thus the font driver). */
  1847. /* */
  1848. /* Client applications are expected to know what they are doing */
  1849. /* when invoking this function. Most drivers simply do not implement */
  1850. /* file attachments. */
  1851. /* */
  1852. FT_EXPORT( FT_Error )
  1853. FT_Attach_Stream( FT_Face face,
  1854. FT_Open_Args* parameters );
  1855. /*************************************************************************/
  1856. /* */
  1857. /* <Function> */
  1858. /* FT_Reference_Face */
  1859. /* */
  1860. /* <Description> */
  1861. /* A counter gets initialized to~1 at the time an @FT_Face structure */
  1862. /* is created. This function increments the counter. @FT_Done_Face */
  1863. /* then only destroys a face if the counter is~1, otherwise it simply */
  1864. /* decrements the counter. */
  1865. /* */
  1866. /* This function helps in managing life-cycles of structures which */
  1867. /* reference @FT_Face objects. */
  1868. /* */
  1869. /* <Input> */
  1870. /* face :: A handle to a target face object. */
  1871. /* */
  1872. /* <Return> */
  1873. /* FreeType error code. 0~means success. */
  1874. /* */
  1875. /* <Since> */
  1876. /* 2.4.2 */
  1877. /* */
  1878. FT_EXPORT( FT_Error )
  1879. FT_Reference_Face( FT_Face face );
  1880. /*************************************************************************/
  1881. /* */
  1882. /* <Function> */
  1883. /* FT_Done_Face */
  1884. /* */
  1885. /* <Description> */
  1886. /* Discard a given face object, as well as all of its child slots and */
  1887. /* sizes. */
  1888. /* */
  1889. /* <Input> */
  1890. /* face :: A handle to a target face object. */
  1891. /* */
  1892. /* <Return> */
  1893. /* FreeType error code. 0~means success. */
  1894. /* */
  1895. /* <Note> */
  1896. /* See the discussion of reference counters in the description of */
  1897. /* @FT_Reference_Face. */
  1898. /* */
  1899. FT_EXPORT( FT_Error )
  1900. FT_Done_Face( FT_Face face );
  1901. /*************************************************************************/
  1902. /* */
  1903. /* <Function> */
  1904. /* FT_Select_Size */
  1905. /* */
  1906. /* <Description> */
  1907. /* Select a bitmap strike. */
  1908. /* */
  1909. /* <InOut> */
  1910. /* face :: A handle to a target face object. */
  1911. /* */
  1912. /* <Input> */
  1913. /* strike_index :: The index of the bitmap strike in the */
  1914. /* `available_sizes' field of @FT_FaceRec structure. */
  1915. /* */
  1916. /* <Return> */
  1917. /* FreeType error code. 0~means success. */
  1918. /* */
  1919. FT_EXPORT( FT_Error )
  1920. FT_Select_Size( FT_Face face,
  1921. FT_Int strike_index );
  1922. /*************************************************************************/
  1923. /* */
  1924. /* <Enum> */
  1925. /* FT_Size_Request_Type */
  1926. /* */
  1927. /* <Description> */
  1928. /* An enumeration type that lists the supported size request types. */
  1929. /* */
  1930. /* <Values> */
  1931. /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
  1932. /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
  1933. /* used to determine both scaling values. */
  1934. /* */
  1935. /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
  1936. /* The real dimension. The sum of the the `Ascender' and (minus */
  1937. /* of) the `Descender' fields of @FT_FaceRec are used to determine */
  1938. /* both scaling values. */
  1939. /* */
  1940. /* FT_SIZE_REQUEST_TYPE_BBOX :: */
  1941. /* The font bounding box. The width and height of the `bbox' field */
  1942. /* of @FT_FaceRec are used to determine the horizontal and vertical */
  1943. /* scaling value, respectively. */
  1944. /* */
  1945. /* FT_SIZE_REQUEST_TYPE_CELL :: */
  1946. /* The `max_advance_width' field of @FT_FaceRec is used to */
  1947. /* determine the horizontal scaling value; the vertical scaling */
  1948. /* value is determined the same way as */
  1949. /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
  1950. /* values are set to the smaller one. This type is useful if you */
  1951. /* want to specify the font size for, say, a window of a given */
  1952. /* dimension and 80x24 cells. */
  1953. /* */
  1954. /* FT_SIZE_REQUEST_TYPE_SCALES :: */
  1955. /* Specify the scaling values directly. */
  1956. /* */
  1957. /* <Note> */
  1958. /* The above descriptions only apply to scalable formats. For bitmap */
  1959. /* formats, the behaviour is up to the driver. */
  1960. /* */
  1961. /* See the note section of @FT_Size_Metrics if you wonder how size */
  1962. /* requesting relates to scaling values. */
  1963. /* */
  1964. typedef enum FT_Size_Request_Type_
  1965. {
  1966. FT_SIZE_REQUEST_TYPE_NOMINAL,
  1967. FT_SIZE_REQUEST_TYPE_REAL_DIM,
  1968. FT_SIZE_REQUEST_TYPE_BBOX,
  1969. FT_SIZE_REQUEST_TYPE_CELL,
  1970. FT_SIZE_REQUEST_TYPE_SCALES,
  1971. FT_SIZE_REQUEST_TYPE_MAX
  1972. } FT_Size_Request_Type;
  1973. /*************************************************************************/
  1974. /* */
  1975. /* <Struct> */
  1976. /* FT_Size_RequestRec */
  1977. /* */
  1978. /* <Description> */
  1979. /* A structure used to model a size request. */
  1980. /* */
  1981. /* <Fields> */
  1982. /* type :: See @FT_Size_Request_Type. */
  1983. /* */
  1984. /* width :: The desired width. */
  1985. /* */
  1986. /* height :: The desired height. */
  1987. /* */
  1988. /* horiResolution :: The horizontal resolution. If set to zero, */
  1989. /* `width' is treated as a 26.6 fractional pixel */
  1990. /* value. */
  1991. /* */
  1992. /* vertResolution :: The vertical resolution. If set to zero, */
  1993. /* `height' is treated as a 26.6 fractional pixel */
  1994. /* value. */
  1995. /* */
  1996. /* <Note> */
  1997. /* If `width' is zero, then the horizontal scaling value is set equal */
  1998. /* to the vertical scaling value, and vice versa. */
  1999. /* */
  2000. typedef struct FT_Size_RequestRec_
  2001. {
  2002. FT_Size_Request_Type type;
  2003. FT_Long width;
  2004. FT_Long height;
  2005. FT_UInt horiResolution;
  2006. FT_UInt vertResolution;
  2007. } FT_Size_RequestRec;
  2008. /*************************************************************************/
  2009. /* */
  2010. /* <Struct> */
  2011. /* FT_Size_Request */
  2012. /* */
  2013. /* <Description> */
  2014. /* A handle to a size request structure. */
  2015. /* */
  2016. typedef struct FT_Size_RequestRec_ *FT_Size_Request;
  2017. /*************************************************************************/
  2018. /* */
  2019. /* <Function> */
  2020. /* FT_Request_Size */
  2021. /* */
  2022. /* <Description> */
  2023. /* Resize the scale of the active @FT_Size object in a face. */
  2024. /* */
  2025. /* <InOut> */
  2026. /* face :: A handle to a target face object. */
  2027. /* */
  2028. /* <Input> */
  2029. /* req :: A pointer to a @FT_Size_RequestRec. */
  2030. /* */
  2031. /* <Return> */
  2032. /* FreeType error code. 0~means success. */
  2033. /* */
  2034. /* <Note> */
  2035. /* Although drivers may select the bitmap strike matching the */
  2036. /* request, you should not rely on this if you intend to select a */
  2037. /* particular bitmap strike. Use @FT_Select_Size instead in that */
  2038. /* case. */
  2039. /* */
  2040. FT_EXPORT( FT_Error )
  2041. FT_Request_Size( FT_Face face,
  2042. FT_Size_Request req );
  2043. /*************************************************************************/
  2044. /* */
  2045. /* <Function> */
  2046. /* FT_Set_Char_Size */
  2047. /* */
  2048. /* <Description> */
  2049. /* This function calls @FT_Request_Size to request the nominal size */
  2050. /* (in points). */
  2051. /* */
  2052. /* <InOut> */
  2053. /* face :: A handle to a target face object. */
  2054. /* */
  2055. /* <Input> */
  2056. /* char_width :: The nominal width, in 26.6 fractional points. */
  2057. /* */
  2058. /* char_height :: The nominal height, in 26.6 fractional points. */
  2059. /* */
  2060. /* horz_resolution :: The horizontal resolution in dpi. */
  2061. /* */
  2062. /* vert_resolution :: The vertical resolution in dpi. */
  2063. /* */
  2064. /* <Return> */
  2065. /* FreeType error code. 0~means success. */
  2066. /* */
  2067. /* <Note> */
  2068. /* If either the character width or height is zero, it is set equal */
  2069. /* to the other value. */
  2070. /* */
  2071. /* If either the horizontal or vertical resolution is zero, it is set */
  2072. /* equal to the other value. */
  2073. /* */
  2074. /* A character width or height smaller than 1pt is set to 1pt; if */
  2075. /* both resolution values are zero, they are set to 72dpi. */
  2076. /* */
  2077. /* Don't use this function if you are using the FreeType cache API. */
  2078. /* */
  2079. FT_EXPORT( FT_Error )
  2080. FT_Set_Char_Size( FT_Face face,
  2081. FT_F26Dot6 char_width,
  2082. FT_F26Dot6 char_height,
  2083. FT_UInt horz_resolution,
  2084. FT_UInt vert_resolution );
  2085. /*************************************************************************/
  2086. /* */
  2087. /* <Function> */
  2088. /* FT_Set_Pixel_Sizes */
  2089. /* */
  2090. /* <Description> */
  2091. /* This function calls @FT_Request_Size to request the nominal size */
  2092. /* (in pixels). */
  2093. /* */
  2094. /* <InOut> */
  2095. /* face :: A handle to the target face object. */
  2096. /* */
  2097. /* <Input> */
  2098. /* pixel_width :: The nominal width, in pixels. */
  2099. /* */
  2100. /* pixel_height :: The nominal height, in pixels. */
  2101. /* */
  2102. /* <Return> */
  2103. /* FreeType error code. 0~means success. */
  2104. /* */
  2105. FT_EXPORT( FT_Error )
  2106. FT_Set_Pixel_Sizes( FT_Face face,
  2107. FT_UInt pixel_width,
  2108. FT_UInt pixel_height );
  2109. /*************************************************************************/
  2110. /* */
  2111. /* <Function> */
  2112. /* FT_Load_Glyph */
  2113. /* */
  2114. /* <Description> */
  2115. /* A function used to load a single glyph into the glyph slot of a */
  2116. /* face object. */
  2117. /* */
  2118. /* <InOut> */
  2119. /* face :: A handle to the target face object where the glyph */
  2120. /* is loaded. */
  2121. /* */
  2122. /* <Input> */
  2123. /* glyph_index :: The index of the glyph in the font file. For */
  2124. /* CID-keyed fonts (either in PS or in CFF format) */
  2125. /* this argument specifies the CID value. */
  2126. /* */
  2127. /* load_flags :: A flag indicating what to load for this glyph. The */
  2128. /* @FT_LOAD_XXX constants can be used to control the */
  2129. /* glyph loading process (e.g., whether the outline */
  2130. /* should be scaled, whether to load bitmaps or not, */
  2131. /* whether to hint the outline, etc). */
  2132. /* */
  2133. /* <Return> */
  2134. /* FreeType error code. 0~means success. */
  2135. /* */
  2136. /* <Note> */
  2137. /* The loaded glyph may be transformed. See @FT_Set_Transform for */
  2138. /* the details. */
  2139. /* */
  2140. /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
  2141. /* returned for invalid CID values (this is, for CID values which */
  2142. /* don't have a corresponding glyph in the font). See the discussion */
  2143. /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
  2144. /* */
  2145. FT_EXPORT( FT_Error )
  2146. FT_Load_Glyph( FT_Face face,
  2147. FT_UInt glyph_index,
  2148. FT_Int32 load_flags );
  2149. /*************************************************************************/
  2150. /* */
  2151. /* <Function> */
  2152. /* FT_Load_Char */
  2153. /* */
  2154. /* <Description> */
  2155. /* A function used to load a single glyph into the glyph slot of a */
  2156. /* face object, according to its character code. */
  2157. /* */
  2158. /* <InOut> */
  2159. /* face :: A handle to a target face object where the glyph */
  2160. /* is loaded. */
  2161. /* */
  2162. /* <Input> */
  2163. /* char_code :: The glyph's character code, according to the */
  2164. /* current charmap used in the face. */
  2165. /* */
  2166. /* load_flags :: A flag indicating what to load for this glyph. The */
  2167. /* @FT_LOAD_XXX constants can be used to control the */
  2168. /* glyph loading process (e.g., whether the outline */
  2169. /* should be scaled, whether to load bitmaps or not, */
  2170. /* whether to hint the outline, etc). */
  2171. /* */
  2172. /* <Return> */
  2173. /* FreeType error code. 0~means success. */
  2174. /* */
  2175. /* <Note> */
  2176. /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
  2177. /* */
  2178. FT_EXPORT( FT_Error )
  2179. FT_Load_Char( FT_Face face,
  2180. FT_ULong char_code,
  2181. FT_Int32 load_flags );
  2182. /*************************************************************************
  2183. *
  2184. * @enum:
  2185. * FT_LOAD_XXX
  2186. *
  2187. * @description:
  2188. * A list of bit-field constants used with @FT_Load_Glyph to indicate
  2189. * what kind of operations to perform during glyph loading.
  2190. *
  2191. * @values:
  2192. * FT_LOAD_DEFAULT ::
  2193. * Corresponding to~0, this value is used as the default glyph load
  2194. * operation. In this case, the following happens:
  2195. *
  2196. * 1. FreeType looks for a bitmap for the glyph corresponding to the
  2197. * face's current size. If one is found, the function returns.
  2198. * The bitmap data can be accessed from the glyph slot (see note
  2199. * below).
  2200. *
  2201. * 2. If no embedded bitmap is searched or found, FreeType looks for a
  2202. * scalable outline. If one is found, it is loaded from the font
  2203. * file, scaled to device pixels, then `hinted' to the pixel grid
  2204. * in order to optimize it. The outline data can be accessed from
  2205. * the glyph slot (see note below).
  2206. *
  2207. * Note that by default, the glyph loader doesn't render outlines into
  2208. * bitmaps. The following flags are used to modify this default
  2209. * behaviour to more specific and useful cases.
  2210. *
  2211. * FT_LOAD_NO_SCALE ::
  2212. * Don't scale the outline glyph loaded, but keep it in font units.
  2213. *
  2214. * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
  2215. * unsets @FT_LOAD_RENDER.
  2216. *
  2217. * FT_LOAD_NO_HINTING ::
  2218. * Disable hinting. This generally generates `blurrier' bitmap glyph
  2219. * when the glyph is rendered in any of the anti-aliased modes. See
  2220. * also the note below.
  2221. *
  2222. * This flag is implied by @FT_LOAD_NO_SCALE.
  2223. *
  2224. * FT_LOAD_RENDER ::
  2225. * Call @FT_Render_Glyph after the glyph is loaded. By default, the
  2226. * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
  2227. * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
  2228. *
  2229. * This flag is unset by @FT_LOAD_NO_SCALE.
  2230. *
  2231. * FT_LOAD_NO_BITMAP ::
  2232. * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
  2233. * flag.
  2234. *
  2235. * @FT_LOAD_NO_SCALE always sets this flag.
  2236. *
  2237. * FT_LOAD_VERTICAL_LAYOUT ::
  2238. * Load the glyph for vertical text layout. _Don't_ use it as it is
  2239. * problematic currently.
  2240. *
  2241. * FT_LOAD_FORCE_AUTOHINT ::
  2242. * Indicates that the auto-hinter is preferred over the font's native
  2243. * hinter. See also the note below.
  2244. *
  2245. * FT_LOAD_CROP_BITMAP ::
  2246. * Indicates that the font driver should crop the loaded bitmap glyph
  2247. * (i.e., remove all space around its black bits). Not all drivers
  2248. * implement this.
  2249. *
  2250. * FT_LOAD_PEDANTIC ::
  2251. * Indicates that the font driver should perform pedantic verifications
  2252. * during glyph loading. This is mostly used to detect broken glyphs
  2253. * in fonts. By default, FreeType tries to handle broken fonts also.
  2254. *
  2255. * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
  2256. * Indicates that the font driver should ignore the global advance
  2257. * width defined in the font. By default, that value is used as the
  2258. * advance width for all glyphs when the face has
  2259. * @FT_FACE_FLAG_FIXED_WIDTH set.
  2260. *
  2261. * This flag exists for historical reasons (to support buggy CJK
  2262. * fonts).
  2263. *
  2264. * FT_LOAD_NO_RECURSE ::
  2265. * This flag is only used internally. It merely indicates that the
  2266. * font driver should not load composite glyphs recursively. Instead,
  2267. * it should set the `num_subglyph' and `subglyphs' values of the
  2268. * glyph slot accordingly, and set `glyph->format' to
  2269. * @FT_GLYPH_FORMAT_COMPOSITE.
  2270. *
  2271. * The description of sub-glyphs is not available to client
  2272. * applications for now.
  2273. *
  2274. * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
  2275. *
  2276. * FT_LOAD_IGNORE_TRANSFORM ::
  2277. * Indicates that the transform matrix set by @FT_Set_Transform should
  2278. * be ignored.
  2279. *
  2280. * FT_LOAD_MONOCHROME ::
  2281. * This flag is used with @FT_LOAD_RENDER to indicate that you want to
  2282. * render an outline glyph to a 1-bit monochrome bitmap glyph, with
  2283. * 8~pixels packed into each byte of the bitmap data.
  2284. *
  2285. * Note that this has no effect on the hinting algorithm used. You
  2286. * should rather use @FT_LOAD_TARGET_MONO so that the
  2287. * monochrome-optimized hinting algorithm is used.
  2288. *
  2289. * FT_LOAD_LINEAR_DESIGN ::
  2290. * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
  2291. * fields of @FT_GlyphSlotRec should be kept in font units. See
  2292. * @FT_GlyphSlotRec for details.
  2293. *
  2294. * FT_LOAD_NO_AUTOHINT ::
  2295. * Disable auto-hinter. See also the note below.
  2296. *
  2297. * @note:
  2298. * By default, hinting is enabled and the font's native hinter (see
  2299. * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
  2300. * disable hinting by setting @FT_LOAD_NO_HINTING or change the
  2301. * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
  2302. * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
  2303. * used at all.
  2304. *
  2305. * See the description of @FT_FACE_FLAG_TRICKY for a special exception
  2306. * (affecting only a handful of Asian fonts).
  2307. *
  2308. * Besides deciding which hinter to use, you can also decide which
  2309. * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
  2310. *
  2311. */
  2312. #define FT_LOAD_DEFAULT 0x0
  2313. #define FT_LOAD_NO_SCALE 0x1
  2314. #define FT_LOAD_NO_HINTING 0x2
  2315. #define FT_LOAD_RENDER 0x4
  2316. #define FT_LOAD_NO_BITMAP 0x8
  2317. #define FT_LOAD_VERTICAL_LAYOUT 0x10
  2318. #define FT_LOAD_FORCE_AUTOHINT 0x20
  2319. #define FT_LOAD_CROP_BITMAP 0x40
  2320. #define FT_LOAD_PEDANTIC 0x80
  2321. #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200
  2322. #define FT_LOAD_NO_RECURSE 0x400
  2323. #define FT_LOAD_IGNORE_TRANSFORM 0x800
  2324. #define FT_LOAD_MONOCHROME 0x1000
  2325. #define FT_LOAD_LINEAR_DESIGN 0x2000
  2326. #define FT_LOAD_NO_AUTOHINT 0x8000U
  2327. /* */
  2328. /* used internally only by certain font drivers! */
  2329. #define FT_LOAD_ADVANCE_ONLY 0x100
  2330. #define FT_LOAD_SBITS_ONLY 0x4000
  2331. /**************************************************************************
  2332. *
  2333. * @enum:
  2334. * FT_LOAD_TARGET_XXX
  2335. *
  2336. * @description:
  2337. * A list of values that are used to select a specific hinting algorithm
  2338. * to use by the hinter. You should OR one of these values to your
  2339. * `load_flags' when calling @FT_Load_Glyph.
  2340. *
  2341. * Note that font's native hinters may ignore the hinting algorithm you
  2342. * have specified (e.g., the TrueType bytecode interpreter). You can set
  2343. * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
  2344. *
  2345. * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
  2346. * always implies @FT_LOAD_FORCE_AUTOHINT.
  2347. *
  2348. * @values:
  2349. * FT_LOAD_TARGET_NORMAL ::
  2350. * This corresponds to the default hinting algorithm, optimized for
  2351. * standard gray-level rendering. For monochrome output, use
  2352. * @FT_LOAD_TARGET_MONO instead.
  2353. *
  2354. * FT_LOAD_TARGET_LIGHT ::
  2355. * A lighter hinting algorithm for non-monochrome modes. Many
  2356. * generated glyphs are more fuzzy but better resemble its original
  2357. * shape. A bit like rendering on Mac OS~X.
  2358. *
  2359. * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
  2360. *
  2361. * FT_LOAD_TARGET_MONO ::
  2362. * Strong hinting algorithm that should only be used for monochrome
  2363. * output. The result is probably unpleasant if the glyph is rendered
  2364. * in non-monochrome modes.
  2365. *
  2366. * FT_LOAD_TARGET_LCD ::
  2367. * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
  2368. * decimated LCD displays.
  2369. *
  2370. * FT_LOAD_TARGET_LCD_V ::
  2371. * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
  2372. * decimated LCD displays.
  2373. *
  2374. * @note:
  2375. * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
  2376. * `load_flags'. They can't be ORed.
  2377. *
  2378. * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
  2379. * corresponding mode (i.e., the mode which matches the used algorithm
  2380. * best) unless @FT_LOAD_MONOCHROME is set.
  2381. *
  2382. * You can use a hinting algorithm that doesn't correspond to the same
  2383. * rendering mode. As an example, it is possible to use the `light'
  2384. * hinting algorithm and have the results rendered in horizontal LCD
  2385. * pixel mode, with code like
  2386. *
  2387. * {
  2388. * FT_Load_Glyph( face, glyph_index,
  2389. * load_flags | FT_LOAD_TARGET_LIGHT );
  2390. *
  2391. * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
  2392. * }
  2393. *
  2394. */
  2395. #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
  2396. #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  2397. #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
  2398. #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
  2399. #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
  2400. #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
  2401. /**************************************************************************
  2402. *
  2403. * @macro:
  2404. * FT_LOAD_TARGET_MODE
  2405. *
  2406. * @description:
  2407. * Return the @FT_Render_Mode corresponding to a given
  2408. * @FT_LOAD_TARGET_XXX value.
  2409. *
  2410. */
  2411. #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
  2412. /*************************************************************************/
  2413. /* */
  2414. /* <Function> */
  2415. /* FT_Set_Transform */
  2416. /* */
  2417. /* <Description> */
  2418. /* A function used to set the transformation that is applied to glyph */
  2419. /* images when they are loaded into a glyph slot through */
  2420. /* @FT_Load_Glyph. */
  2421. /* */
  2422. /* <InOut> */
  2423. /* face :: A handle to the source face object. */
  2424. /* */
  2425. /* <Input> */
  2426. /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
  2427. /* the identity matrix. */
  2428. /* delta :: A pointer to the translation vector. Use~0 for the null */
  2429. /* vector. */
  2430. /* */
  2431. /* <Note> */
  2432. /* The transformation is only applied to scalable image formats after */
  2433. /* the glyph has been loaded. It means that hinting is unaltered by */
  2434. /* the transformation and is performed on the character size given in */
  2435. /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
  2436. /* */
  2437. /* Note that this also transforms the `face.glyph.advance' field, but */
  2438. /* *not* the values in `face.glyph.metrics'. */
  2439. /* */
  2440. FT_EXPORT( void )
  2441. FT_Set_Transform( FT_Face face,
  2442. FT_Matrix* matrix,
  2443. FT_Vector* delta );
  2444. /*************************************************************************/
  2445. /* */
  2446. /* <Enum> */
  2447. /* FT_Render_Mode */
  2448. /* */
  2449. /* <Description> */
  2450. /* An enumeration type that lists the render modes supported by */
  2451. /* FreeType~2. Each mode corresponds to a specific type of scanline */
  2452. /* conversion performed on the outline. */
  2453. /* */
  2454. /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
  2455. /* field in the @FT_GlyphSlotRec structure gives the format of the */
  2456. /* returned bitmap. */
  2457. /* */
  2458. /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
  2459. /* */
  2460. /* <Values> */
  2461. /* FT_RENDER_MODE_NORMAL :: */
  2462. /* This is the default render mode; it corresponds to 8-bit */
  2463. /* anti-aliased bitmaps. */
  2464. /* */
  2465. /* FT_RENDER_MODE_LIGHT :: */
  2466. /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
  2467. /* defined as a separate value because render modes are also used */
  2468. /* indirectly to define hinting algorithm selectors. See */
  2469. /* @FT_LOAD_TARGET_XXX for details. */
  2470. /* */
  2471. /* FT_RENDER_MODE_MONO :: */
  2472. /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
  2473. /* opacity). */
  2474. /* */
  2475. /* FT_RENDER_MODE_LCD :: */
  2476. /* This mode corresponds to horizontal RGB and BGR sub-pixel */
  2477. /* displays like LCD screens. It produces 8-bit bitmaps that are */
  2478. /* 3~times the width of the original glyph outline in pixels, and */
  2479. /* which use the @FT_PIXEL_MODE_LCD mode. */
  2480. /* */
  2481. /* FT_RENDER_MODE_LCD_V :: */
  2482. /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
  2483. /* (like PDA screens, rotated LCD displays, etc.). It produces */
  2484. /* 8-bit bitmaps that are 3~times the height of the original */
  2485. /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
  2486. /* */
  2487. /* <Note> */
  2488. /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
  2489. /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
  2490. /* (not active in the default builds). It is up to the caller to */
  2491. /* either call @FT_Library_SetLcdFilter (if available) or do the */
  2492. /* filtering itself. */
  2493. /* */
  2494. /* The selected render mode only affects vector glyphs of a font. */
  2495. /* Embedded bitmaps often have a different pixel mode like */
  2496. /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
  2497. /* them into 8-bit pixmaps. */
  2498. /* */
  2499. typedef enum FT_Render_Mode_
  2500. {
  2501. FT_RENDER_MODE_NORMAL = 0,
  2502. FT_RENDER_MODE_LIGHT,
  2503. FT_RENDER_MODE_MONO,
  2504. FT_RENDER_MODE_LCD,
  2505. FT_RENDER_MODE_LCD_V,
  2506. FT_RENDER_MODE_MAX
  2507. } FT_Render_Mode;
  2508. /*************************************************************************/
  2509. /* */
  2510. /* <Enum> */
  2511. /* ft_render_mode_xxx */
  2512. /* */
  2513. /* <Description> */
  2514. /* These constants are deprecated. Use the corresponding */
  2515. /* @FT_Render_Mode values instead. */
  2516. /* */
  2517. /* <Values> */
  2518. /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
  2519. /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
  2520. /* */
  2521. #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
  2522. #define ft_render_mode_mono FT_RENDER_MODE_MONO
  2523. /*************************************************************************/
  2524. /* */
  2525. /* <Function> */
  2526. /* FT_Render_Glyph */
  2527. /* */
  2528. /* <Description> */
  2529. /* Convert a given glyph image to a bitmap. It does so by inspecting */
  2530. /* the glyph image format, finding the relevant renderer, and */
  2531. /* invoking it. */
  2532. /* */
  2533. /* <InOut> */
  2534. /* slot :: A handle to the glyph slot containing the image to */
  2535. /* convert. */
  2536. /* */
  2537. /* <Input> */
  2538. /* render_mode :: This is the render mode used to render the glyph */
  2539. /* image into a bitmap. See @FT_Render_Mode for a */
  2540. /* list of possible values. */
  2541. /* */
  2542. /* <Return> */
  2543. /* FreeType error code. 0~means success. */
  2544. /* */
  2545. FT_EXPORT( FT_Error )
  2546. FT_Render_Glyph( FT_GlyphSlot slot,
  2547. FT_Render_Mode render_mode );
  2548. /*************************************************************************/
  2549. /* */
  2550. /* <Enum> */
  2551. /* FT_Kerning_Mode */
  2552. /* */
  2553. /* <Description> */
  2554. /* An enumeration used to specify which kerning values to return in */
  2555. /* @FT_Get_Kerning. */
  2556. /* */
  2557. /* <Values> */
  2558. /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
  2559. /* distances (value is~0). */
  2560. /* */
  2561. /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
  2562. /* distances. */
  2563. /* */
  2564. /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
  2565. /* units. */
  2566. /* */
  2567. typedef enum FT_Kerning_Mode_
  2568. {
  2569. FT_KERNING_DEFAULT = 0,
  2570. FT_KERNING_UNFITTED,
  2571. FT_KERNING_UNSCALED
  2572. } FT_Kerning_Mode;
  2573. /*************************************************************************/
  2574. /* */
  2575. /* <Const> */
  2576. /* ft_kerning_default */
  2577. /* */
  2578. /* <Description> */
  2579. /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
  2580. /* instead. */
  2581. /* */
  2582. #define ft_kerning_default FT_KERNING_DEFAULT
  2583. /*************************************************************************/
  2584. /* */
  2585. /* <Const> */
  2586. /* ft_kerning_unfitted */
  2587. /* */
  2588. /* <Description> */
  2589. /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
  2590. /* instead. */
  2591. /* */
  2592. #define ft_kerning_unfitted FT_KERNING_UNFITTED
  2593. /*************************************************************************/
  2594. /* */
  2595. /* <Const> */
  2596. /* ft_kerning_unscaled */
  2597. /* */
  2598. /* <Description> */
  2599. /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
  2600. /* instead. */
  2601. /* */
  2602. #define ft_kerning_unscaled FT_KERNING_UNSCALED
  2603. /*************************************************************************/
  2604. /* */
  2605. /* <Function> */
  2606. /* FT_Get_Kerning */
  2607. /* */
  2608. /* <Description> */
  2609. /* Return the kerning vector between two glyphs of a same face. */
  2610. /* */
  2611. /* <Input> */
  2612. /* face :: A handle to a source face object. */
  2613. /* */
  2614. /* left_glyph :: The index of the left glyph in the kern pair. */
  2615. /* */
  2616. /* right_glyph :: The index of the right glyph in the kern pair. */
  2617. /* */
  2618. /* kern_mode :: See @FT_Kerning_Mode for more information. */
  2619. /* Determines the scale and dimension of the returned */
  2620. /* kerning vector. */
  2621. /* */
  2622. /* <Output> */
  2623. /* akerning :: The kerning vector. This is either in font units */
  2624. /* or in pixels (26.6 format) for scalable formats, */
  2625. /* and in pixels for fixed-sizes formats. */
  2626. /* */
  2627. /* <Return> */
  2628. /* FreeType error code. 0~means success. */
  2629. /* */
  2630. /* <Note> */
  2631. /* Only horizontal layouts (left-to-right & right-to-left) are */
  2632. /* supported by this method. Other layouts, or more sophisticated */
  2633. /* kernings, are out of the scope of this API function -- they can be */
  2634. /* implemented through format-specific interfaces. */
  2635. /* */
  2636. FT_EXPORT( FT_Error )
  2637. FT_Get_Kerning( FT_Face face,
  2638. FT_UInt left_glyph,
  2639. FT_UInt right_glyph,
  2640. FT_UInt kern_mode,
  2641. FT_Vector *akerning );
  2642. /*************************************************************************/
  2643. /* */
  2644. /* <Function> */
  2645. /* FT_Get_Track_Kerning */
  2646. /* */
  2647. /* <Description> */
  2648. /* Return the track kerning for a given face object at a given size. */
  2649. /* */
  2650. /* <Input> */
  2651. /* face :: A handle to a source face object. */
  2652. /* */
  2653. /* point_size :: The point size in 16.16 fractional points. */
  2654. /* */
  2655. /* degree :: The degree of tightness. */
  2656. /* */
  2657. /* <Output> */
  2658. /* akerning :: The kerning in 16.16 fractional points. */
  2659. /* */
  2660. /* <Return> */
  2661. /* FreeType error code. 0~means success. */
  2662. /* */
  2663. FT_EXPORT( FT_Error )
  2664. FT_Get_Track_Kerning( FT_Face face,
  2665. FT_Fixed point_size,
  2666. FT_Int degree,
  2667. FT_Fixed* akerning );
  2668. /*************************************************************************/
  2669. /* */
  2670. /* <Function> */
  2671. /* FT_Get_Glyph_Name */
  2672. /* */
  2673. /* <Description> */
  2674. /* Retrieve the ASCII name of a given glyph in a face. This only */
  2675. /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
  2676. /* */
  2677. /* <Input> */
  2678. /* face :: A handle to a source face object. */
  2679. /* */
  2680. /* glyph_index :: The glyph index. */
  2681. /* */
  2682. /* buffer_max :: The maximal number of bytes available in the */
  2683. /* buffer. */
  2684. /* */
  2685. /* <Output> */
  2686. /* buffer :: A pointer to a target buffer where the name is */
  2687. /* copied to. */
  2688. /* */
  2689. /* <Return> */
  2690. /* FreeType error code. 0~means success. */
  2691. /* */
  2692. /* <Note> */
  2693. /* An error is returned if the face doesn't provide glyph names or if */
  2694. /* the glyph index is invalid. In all cases of failure, the first */
  2695. /* byte of `buffer' is set to~0 to indicate an empty name. */
  2696. /* */
  2697. /* The glyph name is truncated to fit within the buffer if it is too */
  2698. /* long. The returned string is always zero-terminated. */
  2699. /* */
  2700. /* This function is not compiled within the library if the config */
  2701. /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
  2702. /* `include/freetype/config/ftoptions.h'. */
  2703. /* */
  2704. FT_EXPORT( FT_Error )
  2705. FT_Get_Glyph_Name( FT_Face face,
  2706. FT_UInt glyph_index,
  2707. FT_Pointer buffer,
  2708. FT_UInt buffer_max );
  2709. /*************************************************************************/
  2710. /* */
  2711. /* <Function> */
  2712. /* FT_Get_Postscript_Name */
  2713. /* */
  2714. /* <Description> */
  2715. /* Retrieve the ASCII PostScript name of a given face, if available. */
  2716. /* This only works with PostScript and TrueType fonts. */
  2717. /* */
  2718. /* <Input> */
  2719. /* face :: A handle to the source face object. */
  2720. /* */
  2721. /* <Return> */
  2722. /* A pointer to the face's PostScript name. NULL if unavailable. */
  2723. /* */
  2724. /* <Note> */
  2725. /* The returned pointer is owned by the face and is destroyed with */
  2726. /* it. */
  2727. /* */
  2728. FT_EXPORT( const char* )
  2729. FT_Get_Postscript_Name( FT_Face face );
  2730. /*************************************************************************/
  2731. /* */
  2732. /* <Function> */
  2733. /* FT_Select_Charmap */
  2734. /* */
  2735. /* <Description> */
  2736. /* Select a given charmap by its encoding tag (as listed in */
  2737. /* `freetype.h'). */
  2738. /* */
  2739. /* <InOut> */
  2740. /* face :: A handle to the source face object. */
  2741. /* */
  2742. /* <Input> */
  2743. /* encoding :: A handle to the selected encoding. */
  2744. /* */
  2745. /* <Return> */
  2746. /* FreeType error code. 0~means success. */
  2747. /* */
  2748. /* <Note> */
  2749. /* This function returns an error if no charmap in the face */
  2750. /* corresponds to the encoding queried here. */
  2751. /* */
  2752. /* Because many fonts contain more than a single cmap for Unicode */
  2753. /* encoding, this function has some special code to select the one */
  2754. /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */
  2755. /* is preferred to a UCS-2 cmap). It is thus preferable to */
  2756. /* @FT_Set_Charmap in this case. */
  2757. /* */
  2758. FT_EXPORT( FT_Error )
  2759. FT_Select_Charmap( FT_Face face,
  2760. FT_Encoding encoding );
  2761. /*************************************************************************/
  2762. /* */
  2763. /* <Function> */
  2764. /* FT_Set_Charmap */
  2765. /* */
  2766. /* <Description> */
  2767. /* Select a given charmap for character code to glyph index mapping. */
  2768. /* */
  2769. /* <InOut> */
  2770. /* face :: A handle to the source face object. */
  2771. /* */
  2772. /* <Input> */
  2773. /* charmap :: A handle to the selected charmap. */
  2774. /* */
  2775. /* <Return> */
  2776. /* FreeType error code. 0~means success. */
  2777. /* */
  2778. /* <Note> */
  2779. /* This function returns an error if the charmap is not part of */
  2780. /* the face (i.e., if it is not listed in the `face->charmaps' */
  2781. /* table). */
  2782. /* */
  2783. /* It also fails if a type~14 charmap is selected. */
  2784. /* */
  2785. FT_EXPORT( FT_Error )
  2786. FT_Set_Charmap( FT_Face face,
  2787. FT_CharMap charmap );
  2788. /*************************************************************************
  2789. *
  2790. * @function:
  2791. * FT_Get_Charmap_Index
  2792. *
  2793. * @description:
  2794. * Retrieve index of a given charmap.
  2795. *
  2796. * @input:
  2797. * charmap ::
  2798. * A handle to a charmap.
  2799. *
  2800. * @return:
  2801. * The index into the array of character maps within the face to which
  2802. * `charmap' belongs. If an error occurs, -1 is returned.
  2803. *
  2804. */
  2805. FT_EXPORT( FT_Int )
  2806. FT_Get_Charmap_Index( FT_CharMap charmap );
  2807. /*************************************************************************/
  2808. /* */
  2809. /* <Function> */
  2810. /* FT_Get_Char_Index */
  2811. /* */
  2812. /* <Description> */
  2813. /* Return the glyph index of a given character code. This function */
  2814. /* uses a charmap object to do the mapping. */
  2815. /* */
  2816. /* <Input> */
  2817. /* face :: A handle to the source face object. */
  2818. /* */
  2819. /* charcode :: The character code. */
  2820. /* */
  2821. /* <Return> */
  2822. /* The glyph index. 0~means `undefined character code'. */
  2823. /* */
  2824. /* <Note> */
  2825. /* If you use FreeType to manipulate the contents of font files */
  2826. /* directly, be aware that the glyph index returned by this function */
  2827. /* doesn't always correspond to the internal indices used within */
  2828. /* the file. This is done to ensure that value~0 always corresponds */
  2829. /* to the `missing glyph'. */
  2830. /* */
  2831. FT_EXPORT( FT_UInt )
  2832. FT_Get_Char_Index( FT_Face face,
  2833. FT_ULong charcode );
  2834. /*************************************************************************/
  2835. /* */
  2836. /* <Function> */
  2837. /* FT_Get_First_Char */
  2838. /* */
  2839. /* <Description> */
  2840. /* This function is used to return the first character code in the */
  2841. /* current charmap of a given face. It also returns the */
  2842. /* corresponding glyph index. */
  2843. /* */
  2844. /* <Input> */
  2845. /* face :: A handle to the source face object. */
  2846. /* */
  2847. /* <Output> */
  2848. /* agindex :: Glyph index of first character code. 0~if charmap is */
  2849. /* empty. */
  2850. /* */
  2851. /* <Return> */
  2852. /* The charmap's first character code. */
  2853. /* */
  2854. /* <Note> */
  2855. /* You should use this function with @FT_Get_Next_Char to be able to */
  2856. /* parse all character codes available in a given charmap. The code */
  2857. /* should look like this: */
  2858. /* */
  2859. /* { */
  2860. /* FT_ULong charcode; */
  2861. /* FT_UInt gindex; */
  2862. /* */
  2863. /* */
  2864. /* charcode = FT_Get_First_Char( face, &gindex ); */
  2865. /* while ( gindex != 0 ) */
  2866. /* { */
  2867. /* ... do something with (charcode,gindex) pair ... */
  2868. /* */
  2869. /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
  2870. /* } */
  2871. /* } */
  2872. /* */
  2873. /* Note that `*agindex' is set to~0 if the charmap is empty. The */
  2874. /* result itself can be~0 in two cases: if the charmap is empty or */
  2875. /* if the value~0 is the first valid character code. */
  2876. /* */
  2877. FT_EXPORT( FT_ULong )
  2878. FT_Get_First_Char( FT_Face face,
  2879. FT_UInt *agindex );
  2880. /*************************************************************************/
  2881. /* */
  2882. /* <Function> */
  2883. /* FT_Get_Next_Char */
  2884. /* */
  2885. /* <Description> */
  2886. /* This function is used to return the next character code in the */
  2887. /* current charmap of a given face following the value `char_code', */
  2888. /* as well as the corresponding glyph index. */
  2889. /* */
  2890. /* <Input> */
  2891. /* face :: A handle to the source face object. */
  2892. /* char_code :: The starting character code. */
  2893. /* */
  2894. /* <Output> */
  2895. /* agindex :: Glyph index of next character code. 0~if charmap */
  2896. /* is empty. */
  2897. /* */
  2898. /* <Return> */
  2899. /* The charmap's next character code. */
  2900. /* */
  2901. /* <Note> */
  2902. /* You should use this function with @FT_Get_First_Char to walk */
  2903. /* over all character codes available in a given charmap. See the */
  2904. /* note for this function for a simple code example. */
  2905. /* */
  2906. /* Note that `*agindex' is set to~0 when there are no more codes in */
  2907. /* the charmap. */
  2908. /* */
  2909. FT_EXPORT( FT_ULong )
  2910. FT_Get_Next_Char( FT_Face face,
  2911. FT_ULong char_code,
  2912. FT_UInt *agindex );
  2913. /*************************************************************************/
  2914. /* */
  2915. /* <Function> */
  2916. /* FT_Get_Name_Index */
  2917. /* */
  2918. /* <Description> */
  2919. /* Return the glyph index of a given glyph name. This function uses */
  2920. /* driver specific objects to do the translation. */
  2921. /* */
  2922. /* <Input> */
  2923. /* face :: A handle to the source face object. */
  2924. /* */
  2925. /* glyph_name :: The glyph name. */
  2926. /* */
  2927. /* <Return> */
  2928. /* The glyph index. 0~means `undefined character code'. */
  2929. /* */
  2930. FT_EXPORT( FT_UInt )
  2931. FT_Get_Name_Index( FT_Face face,
  2932. FT_String* glyph_name );
  2933. /*************************************************************************
  2934. *
  2935. * @macro:
  2936. * FT_SUBGLYPH_FLAG_XXX
  2937. *
  2938. * @description:
  2939. * A list of constants used to describe subglyphs. Please refer to the
  2940. * TrueType specification for the meaning of the various flags.
  2941. *
  2942. * @values:
  2943. * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
  2944. * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
  2945. * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
  2946. * FT_SUBGLYPH_FLAG_SCALE ::
  2947. * FT_SUBGLYPH_FLAG_XY_SCALE ::
  2948. * FT_SUBGLYPH_FLAG_2X2 ::
  2949. * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
  2950. *
  2951. */
  2952. #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
  2953. #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
  2954. #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
  2955. #define FT_SUBGLYPH_FLAG_SCALE 8
  2956. #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
  2957. #define FT_SUBGLYPH_FLAG_2X2 0x80
  2958. #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
  2959. /*************************************************************************
  2960. *
  2961. * @func:
  2962. * FT_Get_SubGlyph_Info
  2963. *
  2964. * @description:
  2965. * Retrieve a description of a given subglyph. Only use it if
  2966. * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
  2967. * returned otherwise.
  2968. *
  2969. * @input:
  2970. * glyph ::
  2971. * The source glyph slot.
  2972. *
  2973. * sub_index ::
  2974. * The index of the subglyph. Must be less than
  2975. * `glyph->num_subglyphs'.
  2976. *
  2977. * @output:
  2978. * p_index ::
  2979. * The glyph index of the subglyph.
  2980. *
  2981. * p_flags ::
  2982. * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
  2983. *
  2984. * p_arg1 ::
  2985. * The subglyph's first argument (if any).
  2986. *
  2987. * p_arg2 ::
  2988. * The subglyph's second argument (if any).
  2989. *
  2990. * p_transform ::
  2991. * The subglyph transformation (if any).
  2992. *
  2993. * @return:
  2994. * FreeType error code. 0~means success.
  2995. *
  2996. * @note:
  2997. * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
  2998. * interpreted depending on the flags returned in `*p_flags'. See the
  2999. * TrueType specification for details.
  3000. *
  3001. */
  3002. FT_EXPORT( FT_Error )
  3003. FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
  3004. FT_UInt sub_index,
  3005. FT_Int *p_index,
  3006. FT_UInt *p_flags,
  3007. FT_Int *p_arg1,
  3008. FT_Int *p_arg2,
  3009. FT_Matrix *p_transform );
  3010. /*************************************************************************/
  3011. /* */
  3012. /* <Enum> */
  3013. /* FT_FSTYPE_XXX */
  3014. /* */
  3015. /* <Description> */
  3016. /* A list of bit flags used in the `fsType' field of the OS/2 table */
  3017. /* in a TrueType or OpenType font and the `FSType' entry in a */
  3018. /* PostScript font. These bit flags are returned by */
  3019. /* @FT_Get_FSType_Flags; they inform client applications of embedding */
  3020. /* and subsetting restrictions associated with a font. */
  3021. /* */
  3022. /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
  3023. /* more details. */
  3024. /* */
  3025. /* <Values> */
  3026. /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
  3027. /* Fonts with no fsType bit set may be embedded and permanently */
  3028. /* installed on the remote system by an application. */
  3029. /* */
  3030. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
  3031. /* Fonts that have only this bit set must not be modified, embedded */
  3032. /* or exchanged in any manner without first obtaining permission of */
  3033. /* the font software copyright owner. */
  3034. /* */
  3035. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
  3036. /* If this bit is set, the font may be embedded and temporarily */
  3037. /* loaded on the remote system. Documents containing Preview & */
  3038. /* Print fonts must be opened `read-only'; no edits can be applied */
  3039. /* to the document. */
  3040. /* */
  3041. /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
  3042. /* If this bit is set, the font may be embedded but must only be */
  3043. /* installed temporarily on other systems. In contrast to Preview */
  3044. /* & Print fonts, documents containing editable fonts may be opened */
  3045. /* for reading, editing is permitted, and changes may be saved. */
  3046. /* */
  3047. /* FT_FSTYPE_NO_SUBSETTING :: */
  3048. /* If this bit is set, the font may not be subsetted prior to */
  3049. /* embedding. */
  3050. /* */
  3051. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
  3052. /* If this bit is set, only bitmaps contained in the font may be */
  3053. /* embedded; no outline data may be embedded. If there are no */
  3054. /* bitmaps available in the font, then the font is unembeddable. */
  3055. /* */
  3056. /* <Note> */
  3057. /* While the fsType flags can indicate that a font may be embedded, a */
  3058. /* license with the font vendor may be separately required to use the */
  3059. /* font in this way. */
  3060. /* */
  3061. #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
  3062. #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
  3063. #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
  3064. #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
  3065. #define FT_FSTYPE_NO_SUBSETTING 0x0100
  3066. #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
  3067. /*************************************************************************/
  3068. /* */
  3069. /* <Function> */
  3070. /* FT_Get_FSType_Flags */
  3071. /* */
  3072. /* <Description> */
  3073. /* Return the fsType flags for a font. */
  3074. /* */
  3075. /* <Input> */
  3076. /* face :: A handle to the source face object. */
  3077. /* */
  3078. /* <Return> */
  3079. /* The fsType flags, @FT_FSTYPE_XXX. */
  3080. /* */
  3081. /* <Note> */
  3082. /* Use this function rather than directly reading the `fs_type' field */
  3083. /* in the @PS_FontInfoRec structure which is only guaranteed to */
  3084. /* return the correct results for Type~1 fonts. */
  3085. /* */
  3086. FT_EXPORT( FT_UShort )
  3087. FT_Get_FSType_Flags( FT_Face face );
  3088. /*************************************************************************/
  3089. /* */
  3090. /* <Section> */
  3091. /* glyph_variants */
  3092. /* */
  3093. /* <Title> */
  3094. /* Glyph Variants */
  3095. /* */
  3096. /* <Abstract> */
  3097. /* The FreeType~2 interface to Unicode Ideographic Variation */
  3098. /* Sequences (IVS), using the SFNT cmap format~14. */
  3099. /* */
  3100. /* <Description> */
  3101. /* Many CJK characters have variant forms. They are a sort of grey */
  3102. /* area somewhere between being totally irrelevant and semantically */
  3103. /* distinct; for this reason, the Unicode consortium decided to */
  3104. /* introduce Ideographic Variation Sequences (IVS), consisting of a */
  3105. /* Unicode base character and one of 240 variant selectors */
  3106. /* (U+E0100-U+E01EF), instead of further extending the already huge */
  3107. /* code range for CJK characters. */
  3108. /* */
  3109. /* An IVS is registered and unique; for further details please refer */
  3110. /* to Unicode Technical Report #37, the Ideographic Variation */
  3111. /* Database. To date (October 2007), the character with the most */
  3112. /* variants is U+908A, having 8~such IVS. */
  3113. /* */
  3114. /* Adobe and MS decided to support IVS with a new cmap subtable */
  3115. /* (format~14). It is an odd subtable because it is not a mapping of */
  3116. /* input code points to glyphs, but contains lists of all variants */
  3117. /* supported by the font. */
  3118. /* */
  3119. /* A variant may be either `default' or `non-default'. A default */
  3120. /* variant is the one you will get for that code point if you look it */
  3121. /* up in the standard Unicode cmap. A non-default variant is a */
  3122. /* different glyph. */
  3123. /* */
  3124. /*************************************************************************/
  3125. /*************************************************************************/
  3126. /* */
  3127. /* <Function> */
  3128. /* FT_Face_GetCharVariantIndex */
  3129. /* */
  3130. /* <Description> */
  3131. /* Return the glyph index of a given character code as modified by */
  3132. /* the variation selector. */
  3133. /* */
  3134. /* <Input> */
  3135. /* face :: */
  3136. /* A handle to the source face object. */
  3137. /* */
  3138. /* charcode :: */
  3139. /* The character code point in Unicode. */
  3140. /* */
  3141. /* variantSelector :: */
  3142. /* The Unicode code point of the variation selector. */
  3143. /* */
  3144. /* <Return> */
  3145. /* The glyph index. 0~means either `undefined character code', or */
  3146. /* `undefined selector code', or `no variation selector cmap */
  3147. /* subtable', or `current CharMap is not Unicode'. */
  3148. /* */
  3149. /* <Note> */
  3150. /* If you use FreeType to manipulate the contents of font files */
  3151. /* directly, be aware that the glyph index returned by this function */
  3152. /* doesn't always correspond to the internal indices used within */
  3153. /* the file. This is done to ensure that value~0 always corresponds */
  3154. /* to the `missing glyph'. */
  3155. /* */
  3156. /* This function is only meaningful if */
  3157. /* a) the font has a variation selector cmap sub table, */
  3158. /* and */
  3159. /* b) the current charmap has a Unicode encoding. */
  3160. /* */
  3161. /* <Since> */
  3162. /* 2.3.6 */
  3163. /* */
  3164. FT_EXPORT( FT_UInt )
  3165. FT_Face_GetCharVariantIndex( FT_Face face,
  3166. FT_ULong charcode,
  3167. FT_ULong variantSelector );
  3168. /*************************************************************************/
  3169. /* */
  3170. /* <Function> */
  3171. /* FT_Face_GetCharVariantIsDefault */
  3172. /* */
  3173. /* <Description> */
  3174. /* Check whether this variant of this Unicode character is the one to */
  3175. /* be found in the `cmap'. */
  3176. /* */
  3177. /* <Input> */
  3178. /* face :: */
  3179. /* A handle to the source face object. */
  3180. /* */
  3181. /* charcode :: */
  3182. /* The character codepoint in Unicode. */
  3183. /* */
  3184. /* variantSelector :: */
  3185. /* The Unicode codepoint of the variation selector. */
  3186. /* */
  3187. /* <Return> */
  3188. /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
  3189. /* variation selector cmap, or -1 if it is not a variant. */
  3190. /* */
  3191. /* <Note> */
  3192. /* This function is only meaningful if the font has a variation */
  3193. /* selector cmap subtable. */
  3194. /* */
  3195. /* <Since> */
  3196. /* 2.3.6 */
  3197. /* */
  3198. FT_EXPORT( FT_Int )
  3199. FT_Face_GetCharVariantIsDefault( FT_Face face,
  3200. FT_ULong charcode,
  3201. FT_ULong variantSelector );
  3202. /*************************************************************************/
  3203. /* */
  3204. /* <Function> */
  3205. /* FT_Face_GetVariantSelectors */
  3206. /* */
  3207. /* <Description> */
  3208. /* Return a zero-terminated list of Unicode variant selectors found */
  3209. /* in the font. */
  3210. /* */
  3211. /* <Input> */
  3212. /* face :: */
  3213. /* A handle to the source face object. */
  3214. /* */
  3215. /* <Return> */
  3216. /* A pointer to an array of selector code points, or NULL if there is */
  3217. /* no valid variant selector cmap subtable. */
  3218. /* */
  3219. /* <Note> */
  3220. /* The last item in the array is~0; the array is owned by the */
  3221. /* @FT_Face object but can be overwritten or released on the next */
  3222. /* call to a FreeType function. */
  3223. /* */
  3224. /* <Since> */
  3225. /* 2.3.6 */
  3226. /* */
  3227. FT_EXPORT( FT_UInt32* )
  3228. FT_Face_GetVariantSelectors( FT_Face face );
  3229. /*************************************************************************/
  3230. /* */
  3231. /* <Function> */
  3232. /* FT_Face_GetVariantsOfChar */
  3233. /* */
  3234. /* <Description> */
  3235. /* Return a zero-terminated list of Unicode variant selectors found */
  3236. /* for the specified character code. */
  3237. /* */
  3238. /* <Input> */
  3239. /* face :: */
  3240. /* A handle to the source face object. */
  3241. /* */
  3242. /* charcode :: */
  3243. /* The character codepoint in Unicode. */
  3244. /* */
  3245. /* <Return> */
  3246. /* A pointer to an array of variant selector code points which are */
  3247. /* active for the given character, or NULL if the corresponding list */
  3248. /* is empty. */
  3249. /* */
  3250. /* <Note> */
  3251. /* The last item in the array is~0; the array is owned by the */
  3252. /* @FT_Face object but can be overwritten or released on the next */
  3253. /* call to a FreeType function. */
  3254. /* */
  3255. /* <Since> */
  3256. /* 2.3.6 */
  3257. /* */
  3258. FT_EXPORT( FT_UInt32* )
  3259. FT_Face_GetVariantsOfChar( FT_Face face,
  3260. FT_ULong charcode );
  3261. /*************************************************************************/
  3262. /* */
  3263. /* <Function> */
  3264. /* FT_Face_GetCharsOfVariant */
  3265. /* */
  3266. /* <Description> */
  3267. /* Return a zero-terminated list of Unicode character codes found for */
  3268. /* the specified variant selector. */
  3269. /* */
  3270. /* <Input> */
  3271. /* face :: */
  3272. /* A handle to the source face object. */
  3273. /* */
  3274. /* variantSelector :: */
  3275. /* The variant selector code point in Unicode. */
  3276. /* */
  3277. /* <Return> */
  3278. /* A list of all the code points which are specified by this selector */
  3279. /* (both default and non-default codes are returned) or NULL if there */
  3280. /* is no valid cmap or the variant selector is invalid. */
  3281. /* */
  3282. /* <Note> */
  3283. /* The last item in the array is~0; the array is owned by the */
  3284. /* @FT_Face object but can be overwritten or released on the next */
  3285. /* call to a FreeType function. */
  3286. /* */
  3287. /* <Since> */
  3288. /* 2.3.6 */
  3289. /* */
  3290. FT_EXPORT( FT_UInt32* )
  3291. FT_Face_GetCharsOfVariant( FT_Face face,
  3292. FT_ULong variantSelector );
  3293. /*************************************************************************/
  3294. /* */
  3295. /* <Section> */
  3296. /* computations */
  3297. /* */
  3298. /* <Title> */
  3299. /* Computations */
  3300. /* */
  3301. /* <Abstract> */
  3302. /* Crunching fixed numbers and vectors. */
  3303. /* */
  3304. /* <Description> */
  3305. /* This section contains various functions used to perform */
  3306. /* computations on 16.16 fixed-float numbers or 2d vectors. */
  3307. /* */
  3308. /* <Order> */
  3309. /* FT_MulDiv */
  3310. /* FT_MulFix */
  3311. /* FT_DivFix */
  3312. /* FT_RoundFix */
  3313. /* FT_CeilFix */
  3314. /* FT_FloorFix */
  3315. /* FT_Vector_Transform */
  3316. /* FT_Matrix_Multiply */
  3317. /* FT_Matrix_Invert */
  3318. /* */
  3319. /*************************************************************************/
  3320. /*************************************************************************/
  3321. /* */
  3322. /* <Function> */
  3323. /* FT_MulDiv */
  3324. /* */
  3325. /* <Description> */
  3326. /* A very simple function used to perform the computation `(a*b)/c' */
  3327. /* with maximal accuracy (it uses a 64-bit intermediate integer */
  3328. /* whenever necessary). */
  3329. /* */
  3330. /* This function isn't necessarily as fast as some processor specific */
  3331. /* operations, but is at least completely portable. */
  3332. /* */
  3333. /* <Input> */
  3334. /* a :: The first multiplier. */
  3335. /* b :: The second multiplier. */
  3336. /* c :: The divisor. */
  3337. /* */
  3338. /* <Return> */
  3339. /* The result of `(a*b)/c'. This function never traps when trying to */
  3340. /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
  3341. /* on the signs of `a' and `b'. */
  3342. /* */
  3343. FT_EXPORT( FT_Long )
  3344. FT_MulDiv( FT_Long a,
  3345. FT_Long b,
  3346. FT_Long c );
  3347. /* */
  3348. /* The following #if 0 ... #endif is for the documentation formatter, */
  3349. /* hiding the internal `FT_MULFIX_INLINED' macro. */
  3350. #if 0
  3351. /*************************************************************************/
  3352. /* */
  3353. /* <Function> */
  3354. /* FT_MulFix */
  3355. /* */
  3356. /* <Description> */
  3357. /* A very simple function used to perform the computation */
  3358. /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
  3359. /* used to multiply a given value by a 16.16 fixed float factor. */
  3360. /* */
  3361. /* <Input> */
  3362. /* a :: The first multiplier. */
  3363. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  3364. /* possible (see note below). */
  3365. /* */
  3366. /* <Return> */
  3367. /* The result of `(a*b)/0x10000'. */
  3368. /* */
  3369. /* <Note> */
  3370. /* This function has been optimized for the case where the absolute */
  3371. /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
  3372. /* As this happens mainly when scaling from notional units to */
  3373. /* fractional pixels in FreeType, it resulted in noticeable speed */
  3374. /* improvements between versions 2.x and 1.x. */
  3375. /* */
  3376. /* As a conclusion, always try to place a 16.16 factor as the */
  3377. /* _second_ argument of this function; this can make a great */
  3378. /* difference. */
  3379. /* */
  3380. FT_EXPORT( FT_Long )
  3381. FT_MulFix( FT_Long a,
  3382. FT_Long b );
  3383. /* */
  3384. #endif
  3385. #ifdef FT_MULFIX_INLINED
  3386. #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
  3387. #else
  3388. FT_EXPORT( FT_Long )
  3389. FT_MulFix( FT_Long a,
  3390. FT_Long b );
  3391. #endif
  3392. /*************************************************************************/
  3393. /* */
  3394. /* <Function> */
  3395. /* FT_DivFix */
  3396. /* */
  3397. /* <Description> */
  3398. /* A very simple function used to perform the computation */
  3399. /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
  3400. /* used to divide a given value by a 16.16 fixed float factor. */
  3401. /* */
  3402. /* <Input> */
  3403. /* a :: The first multiplier. */
  3404. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  3405. /* possible (see note below). */
  3406. /* */
  3407. /* <Return> */
  3408. /* The result of `(a*0x10000)/b'. */
  3409. /* */
  3410. /* <Note> */
  3411. /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
  3412. /* 32~bits, then the division is computed directly. Otherwise, we */
  3413. /* use a specialized version of @FT_MulDiv. */
  3414. /* */
  3415. FT_EXPORT( FT_Long )
  3416. FT_DivFix( FT_Long a,
  3417. FT_Long b );
  3418. /*************************************************************************/
  3419. /* */
  3420. /* <Function> */
  3421. /* FT_RoundFix */
  3422. /* */
  3423. /* <Description> */
  3424. /* A very simple function used to round a 16.16 fixed number. */
  3425. /* */
  3426. /* <Input> */
  3427. /* a :: The number to be rounded. */
  3428. /* */
  3429. /* <Return> */
  3430. /* The result of `(a + 0x8000) & -0x10000'. */
  3431. /* */
  3432. FT_EXPORT( FT_Fixed )
  3433. FT_RoundFix( FT_Fixed a );
  3434. /*************************************************************************/
  3435. /* */
  3436. /* <Function> */
  3437. /* FT_CeilFix */
  3438. /* */
  3439. /* <Description> */
  3440. /* A very simple function used to compute the ceiling function of a */
  3441. /* 16.16 fixed number. */
  3442. /* */
  3443. /* <Input> */
  3444. /* a :: The number for which the ceiling function is to be computed. */
  3445. /* */
  3446. /* <Return> */
  3447. /* The result of `(a + 0x10000 - 1) & -0x10000'. */
  3448. /* */
  3449. FT_EXPORT( FT_Fixed )
  3450. FT_CeilFix( FT_Fixed a );
  3451. /*************************************************************************/
  3452. /* */
  3453. /* <Function> */
  3454. /* FT_FloorFix */
  3455. /* */
  3456. /* <Description> */
  3457. /* A very simple function used to compute the floor function of a */
  3458. /* 16.16 fixed number. */
  3459. /* */
  3460. /* <Input> */
  3461. /* a :: The number for which the floor function is to be computed. */
  3462. /* */
  3463. /* <Return> */
  3464. /* The result of `a & -0x10000'. */
  3465. /* */
  3466. FT_EXPORT( FT_Fixed )
  3467. FT_FloorFix( FT_Fixed a );
  3468. /*************************************************************************/
  3469. /* */
  3470. /* <Function> */
  3471. /* FT_Vector_Transform */
  3472. /* */
  3473. /* <Description> */
  3474. /* Transform a single vector through a 2x2 matrix. */
  3475. /* */
  3476. /* <InOut> */
  3477. /* vector :: The target vector to transform. */
  3478. /* */
  3479. /* <Input> */
  3480. /* matrix :: A pointer to the source 2x2 matrix. */
  3481. /* */
  3482. /* <Note> */
  3483. /* The result is undefined if either `vector' or `matrix' is invalid. */
  3484. /* */
  3485. FT_EXPORT( void )
  3486. FT_Vector_Transform( FT_Vector* vec,
  3487. const FT_Matrix* matrix );
  3488. /*************************************************************************/
  3489. /* */
  3490. /* <Section> */
  3491. /* version */
  3492. /* */
  3493. /* <Title> */
  3494. /* FreeType Version */
  3495. /* */
  3496. /* <Abstract> */
  3497. /* Functions and macros related to FreeType versions. */
  3498. /* */
  3499. /* <Description> */
  3500. /* Note that those functions and macros are of limited use because */
  3501. /* even a new release of FreeType with only documentation changes */
  3502. /* increases the version number. */
  3503. /* */
  3504. /*************************************************************************/
  3505. /*************************************************************************
  3506. *
  3507. * @enum:
  3508. * FREETYPE_XXX
  3509. *
  3510. * @description:
  3511. * These three macros identify the FreeType source code version.
  3512. * Use @FT_Library_Version to access them at runtime.
  3513. *
  3514. * @values:
  3515. * FREETYPE_MAJOR :: The major version number.
  3516. * FREETYPE_MINOR :: The minor version number.
  3517. * FREETYPE_PATCH :: The patch level.
  3518. *
  3519. * @note:
  3520. * The version number of FreeType if built as a dynamic link library
  3521. * with the `libtool' package is _not_ controlled by these three
  3522. * macros.
  3523. *
  3524. */
  3525. #define FREETYPE_MAJOR 2
  3526. #define FREETYPE_MINOR 4
  3527. #define FREETYPE_PATCH 3
  3528. /*************************************************************************/
  3529. /* */
  3530. /* <Function> */
  3531. /* FT_Library_Version */
  3532. /* */
  3533. /* <Description> */
  3534. /* Return the version of the FreeType library being used. This is */
  3535. /* useful when dynamically linking to the library, since one cannot */
  3536. /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
  3537. /* @FREETYPE_PATCH. */
  3538. /* */
  3539. /* <Input> */
  3540. /* library :: A source library handle. */
  3541. /* */
  3542. /* <Output> */
  3543. /* amajor :: The major version number. */
  3544. /* */
  3545. /* aminor :: The minor version number. */
  3546. /* */
  3547. /* apatch :: The patch version number. */
  3548. /* */
  3549. /* <Note> */
  3550. /* The reason why this function takes a `library' argument is because */
  3551. /* certain programs implement library initialization in a custom way */
  3552. /* that doesn't use @FT_Init_FreeType. */
  3553. /* */
  3554. /* In such cases, the library version might not be available before */
  3555. /* the library object has been created. */
  3556. /* */
  3557. FT_EXPORT( void )
  3558. FT_Library_Version( FT_Library library,
  3559. FT_Int *amajor,
  3560. FT_Int *aminor,
  3561. FT_Int *apatch );
  3562. /*************************************************************************/
  3563. /* */
  3564. /* <Function> */
  3565. /* FT_Face_CheckTrueTypePatents */
  3566. /* */
  3567. /* <Description> */
  3568. /* Parse all bytecode instructions of a TrueType font file to check */
  3569. /* whether any of the patented opcodes are used. This is only useful */
  3570. /* if you want to be able to use the unpatented hinter with */
  3571. /* fonts that do *not* use these opcodes. */
  3572. /* */
  3573. /* Note that this function parses *all* glyph instructions in the */
  3574. /* font file, which may be slow. */
  3575. /* */
  3576. /* <Input> */
  3577. /* face :: A face handle. */
  3578. /* */
  3579. /* <Return> */
  3580. /* 1~if this is a TrueType font that uses one of the patented */
  3581. /* opcodes, 0~otherwise. */
  3582. /* */
  3583. /* <Note> */
  3584. /* Since May 2010, TrueType hinting is no longer patented. */
  3585. /* */
  3586. /* <Since> */
  3587. /* 2.3.5 */
  3588. /* */
  3589. FT_EXPORT( FT_Bool )
  3590. FT_Face_CheckTrueTypePatents( FT_Face face );
  3591. /*************************************************************************/
  3592. /* */
  3593. /* <Function> */
  3594. /* FT_Face_SetUnpatentedHinting */
  3595. /* */
  3596. /* <Description> */
  3597. /* Enable or disable the unpatented hinter for a given face. */
  3598. /* Only enable it if you have determined that the face doesn't */
  3599. /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
  3600. /* */
  3601. /* <Input> */
  3602. /* face :: A face handle. */
  3603. /* */
  3604. /* value :: New boolean setting. */
  3605. /* */
  3606. /* <Return> */
  3607. /* The old setting value. This will always be false if this is not */
  3608. /* an SFNT font, or if the unpatented hinter is not compiled in this */
  3609. /* instance of the library. */
  3610. /* */
  3611. /* <Note> */
  3612. /* Since May 2010, TrueType hinting is no longer patented. */
  3613. /* */
  3614. /* <Since> */
  3615. /* 2.3.5 */
  3616. /* */
  3617. FT_EXPORT( FT_Bool )
  3618. FT_Face_SetUnpatentedHinting( FT_Face face,
  3619. FT_Bool value );
  3620. /* */
  3621. FT_END_HEADER
  3622. #endif /* __FREETYPE_H__ */
  3623. /* END */