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

/src/freetype/include/freetype/freetype.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 3945 lines | 481 code | 296 blank | 3168 comment | 0 complexity | 1144f01f2dfaa56d1237f8b041059b89 MD5 | raw file
Possible License(s): LGPL-3.0, BSD-3-Clause, CPL-1.0, Unlicense, GPL-2.0, GPL-3.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, BSD-2-Clause, LGPL-2.1
  1. /***************************************************************************/
  2. /* */
  3. /* freetype.h */
  4. /* */
  5. /* FreeType high-level API and common types (specification only). */
  6. /* */
  7. /* Copyright 1996-2012 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef FT_FREETYPE_H
  18. #error "`ft2build.h' hasn't been included yet!"
  19. #error "Please always use macros to include FreeType header files."
  20. #error "Example:"
  21. #error " #include <ft2build.h>"
  22. #error " #include FT_FREETYPE_H"
  23. #endif
  24. #ifndef __FREETYPE_H__
  25. #define __FREETYPE_H__
  26. #include <ft2build.h>
  27. #include FT_CONFIG_CONFIG_H
  28. #include FT_ERRORS_H
  29. #include FT_TYPES_H
  30. FT_BEGIN_HEADER
  31. /*************************************************************************/
  32. /* */
  33. /* <Section> */
  34. /* user_allocation */
  35. /* */
  36. /* <Title> */
  37. /* User allocation */
  38. /* */
  39. /* <Abstract> */
  40. /* How client applications should allocate FreeType data structures. */
  41. /* */
  42. /* <Description> */
  43. /* FreeType assumes that structures allocated by the user and passed */
  44. /* as arguments are zeroed out except for the actual data. In other */
  45. /* words, it is recommended to use `calloc' (or variants of it) */
  46. /* instead of `malloc' for allocation. */
  47. /* */
  48. /*************************************************************************/
  49. /*************************************************************************/
  50. /*************************************************************************/
  51. /* */
  52. /* B A S I C T Y P E S */
  53. /* */
  54. /*************************************************************************/
  55. /*************************************************************************/
  56. /*************************************************************************/
  57. /* */
  58. /* <Section> */
  59. /* base_interface */
  60. /* */
  61. /* <Title> */
  62. /* Base Interface */
  63. /* */
  64. /* <Abstract> */
  65. /* The FreeType~2 base font interface. */
  66. /* */
  67. /* <Description> */
  68. /* This section describes the public high-level API of FreeType~2. */
  69. /* */
  70. /* <Order> */
  71. /* FT_Library */
  72. /* FT_Face */
  73. /* FT_Size */
  74. /* FT_GlyphSlot */
  75. /* FT_CharMap */
  76. /* FT_Encoding */
  77. /* */
  78. /* FT_FaceRec */
  79. /* */
  80. /* FT_FACE_FLAG_SCALABLE */
  81. /* FT_FACE_FLAG_FIXED_SIZES */
  82. /* FT_FACE_FLAG_FIXED_WIDTH */
  83. /* FT_FACE_FLAG_HORIZONTAL */
  84. /* FT_FACE_FLAG_VERTICAL */
  85. /* FT_FACE_FLAG_SFNT */
  86. /* FT_FACE_FLAG_KERNING */
  87. /* FT_FACE_FLAG_MULTIPLE_MASTERS */
  88. /* FT_FACE_FLAG_GLYPH_NAMES */
  89. /* FT_FACE_FLAG_EXTERNAL_STREAM */
  90. /* FT_FACE_FLAG_FAST_GLYPHS */
  91. /* FT_FACE_FLAG_HINTER */
  92. /* */
  93. /* FT_STYLE_FLAG_BOLD */
  94. /* FT_STYLE_FLAG_ITALIC */
  95. /* */
  96. /* FT_SizeRec */
  97. /* FT_Size_Metrics */
  98. /* */
  99. /* FT_GlyphSlotRec */
  100. /* FT_Glyph_Metrics */
  101. /* FT_SubGlyph */
  102. /* */
  103. /* FT_Bitmap_Size */
  104. /* */
  105. /* FT_Init_FreeType */
  106. /* FT_Done_FreeType */
  107. /* */
  108. /* FT_New_Face */
  109. /* FT_Done_Face */
  110. /* FT_New_Memory_Face */
  111. /* FT_Open_Face */
  112. /* FT_Open_Args */
  113. /* FT_Parameter */
  114. /* FT_Attach_File */
  115. /* FT_Attach_Stream */
  116. /* */
  117. /* FT_Set_Char_Size */
  118. /* FT_Set_Pixel_Sizes */
  119. /* FT_Request_Size */
  120. /* FT_Select_Size */
  121. /* FT_Size_Request_Type */
  122. /* FT_Size_Request */
  123. /* FT_Set_Transform */
  124. /* FT_Load_Glyph */
  125. /* FT_Get_Char_Index */
  126. /* FT_Get_Name_Index */
  127. /* FT_Load_Char */
  128. /* */
  129. /* FT_OPEN_MEMORY */
  130. /* FT_OPEN_STREAM */
  131. /* FT_OPEN_PATHNAME */
  132. /* FT_OPEN_DRIVER */
  133. /* FT_OPEN_PARAMS */
  134. /* */
  135. /* FT_LOAD_DEFAULT */
  136. /* FT_LOAD_RENDER */
  137. /* FT_LOAD_MONOCHROME */
  138. /* FT_LOAD_LINEAR_DESIGN */
  139. /* FT_LOAD_NO_SCALE */
  140. /* FT_LOAD_NO_HINTING */
  141. /* FT_LOAD_NO_BITMAP */
  142. /* FT_LOAD_CROP_BITMAP */
  143. /* */
  144. /* FT_LOAD_VERTICAL_LAYOUT */
  145. /* FT_LOAD_IGNORE_TRANSFORM */
  146. /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */
  147. /* FT_LOAD_FORCE_AUTOHINT */
  148. /* FT_LOAD_NO_RECURSE */
  149. /* FT_LOAD_PEDANTIC */
  150. /* */
  151. /* FT_LOAD_TARGET_NORMAL */
  152. /* FT_LOAD_TARGET_LIGHT */
  153. /* FT_LOAD_TARGET_MONO */
  154. /* FT_LOAD_TARGET_LCD */
  155. /* FT_LOAD_TARGET_LCD_V */
  156. /* */
  157. /* FT_Render_Glyph */
  158. /* FT_Render_Mode */
  159. /* FT_Get_Kerning */
  160. /* FT_Kerning_Mode */
  161. /* FT_Get_Track_Kerning */
  162. /* FT_Get_Glyph_Name */
  163. /* FT_Get_Postscript_Name */
  164. /* */
  165. /* FT_CharMapRec */
  166. /* FT_Select_Charmap */
  167. /* FT_Set_Charmap */
  168. /* FT_Get_Charmap_Index */
  169. /* */
  170. /* FT_FSTYPE_INSTALLABLE_EMBEDDING */
  171. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */
  172. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */
  173. /* FT_FSTYPE_EDITABLE_EMBEDDING */
  174. /* FT_FSTYPE_NO_SUBSETTING */
  175. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */
  176. /* */
  177. /* FT_Get_FSType_Flags */
  178. /* */
  179. /*************************************************************************/
  180. /*************************************************************************/
  181. /* */
  182. /* <Struct> */
  183. /* FT_Glyph_Metrics */
  184. /* */
  185. /* <Description> */
  186. /* A structure used to model the metrics of a single glyph. The */
  187. /* values are expressed in 26.6 fractional pixel format; if the flag */
  188. /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */
  189. /* are expressed in font units instead. */
  190. /* */
  191. /* <Fields> */
  192. /* width :: */
  193. /* The glyph's width. */
  194. /* */
  195. /* height :: */
  196. /* The glyph's height. */
  197. /* */
  198. /* horiBearingX :: */
  199. /* Left side bearing for horizontal layout. */
  200. /* */
  201. /* horiBearingY :: */
  202. /* Top side bearing for horizontal layout. */
  203. /* */
  204. /* horiAdvance :: */
  205. /* Advance width for horizontal layout. */
  206. /* */
  207. /* vertBearingX :: */
  208. /* Left side bearing for vertical layout. */
  209. /* */
  210. /* vertBearingY :: */
  211. /* Top side bearing for vertical layout. Larger positive values */
  212. /* mean further below the vertical glyph origin. */
  213. /* */
  214. /* vertAdvance :: */
  215. /* Advance height for vertical layout. Positive values mean the */
  216. /* glyph has a positive advance downward. */
  217. /* */
  218. /* <Note> */
  219. /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
  220. /* dimensions of the hinted glyph (in case hinting is applicable). */
  221. /* */
  222. typedef struct FT_Glyph_Metrics_
  223. {
  224. FT_Pos width;
  225. FT_Pos height;
  226. FT_Pos horiBearingX;
  227. FT_Pos horiBearingY;
  228. FT_Pos horiAdvance;
  229. FT_Pos vertBearingX;
  230. FT_Pos vertBearingY;
  231. FT_Pos vertAdvance;
  232. } FT_Glyph_Metrics;
  233. /*************************************************************************/
  234. /* */
  235. /* <Struct> */
  236. /* FT_Bitmap_Size */
  237. /* */
  238. /* <Description> */
  239. /* This structure models the metrics of a bitmap strike (i.e., a set */
  240. /* of glyphs for a given point size and resolution) in a bitmap font. */
  241. /* It is used for the `available_sizes' field of @FT_Face. */
  242. /* */
  243. /* <Fields> */
  244. /* height :: The vertical distance, in pixels, between two */
  245. /* consecutive baselines. It is always positive. */
  246. /* */
  247. /* width :: The average width, in pixels, of all glyphs in the */
  248. /* strike. */
  249. /* */
  250. /* size :: The nominal size of the strike in 26.6 fractional */
  251. /* points. This field is not very useful. */
  252. /* */
  253. /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */
  254. /* pixels. */
  255. /* */
  256. /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */
  257. /* pixels. */
  258. /* */
  259. /* <Note> */
  260. /* Windows FNT: */
  261. /* The nominal size given in a FNT font is not reliable. Thus when */
  262. /* the driver finds it incorrect, it sets `size' to some calculated */
  263. /* values and sets `x_ppem' and `y_ppem' to the pixel width and */
  264. /* height given in the font, respectively. */
  265. /* */
  266. /* TrueType embedded bitmaps: */
  267. /* `size', `width', and `height' values are not contained in the */
  268. /* bitmap strike itself. They are computed from the global font */
  269. /* parameters. */
  270. /* */
  271. typedef struct FT_Bitmap_Size_
  272. {
  273. FT_Short height;
  274. FT_Short width;
  275. FT_Pos size;
  276. FT_Pos x_ppem;
  277. FT_Pos y_ppem;
  278. } FT_Bitmap_Size;
  279. /*************************************************************************/
  280. /*************************************************************************/
  281. /* */
  282. /* O B J E C T C L A S S E S */
  283. /* */
  284. /*************************************************************************/
  285. /*************************************************************************/
  286. /*************************************************************************/
  287. /* */
  288. /* <Type> */
  289. /* FT_Library */
  290. /* */
  291. /* <Description> */
  292. /* A handle to a FreeType library instance. Each `library' is */
  293. /* completely independent from the others; it is the `root' of a set */
  294. /* of objects like fonts, faces, sizes, etc. */
  295. /* */
  296. /* It also embeds a memory manager (see @FT_Memory), as well as a */
  297. /* scan-line converter object (see @FT_Raster). */
  298. /* */
  299. /* For multi-threading applications each thread should have its own */
  300. /* FT_Library object. */
  301. /* */
  302. /* <Note> */
  303. /* Library objects are normally created by @FT_Init_FreeType, and */
  304. /* destroyed with @FT_Done_FreeType. */
  305. /* */
  306. typedef struct FT_LibraryRec_ *FT_Library;
  307. /*************************************************************************/
  308. /* */
  309. /* <Type> */
  310. /* FT_Module */
  311. /* */
  312. /* <Description> */
  313. /* A handle to a given FreeType module object. Each module can be a */
  314. /* font driver, a renderer, or anything else that provides services */
  315. /* to the formers. */
  316. /* */
  317. typedef struct FT_ModuleRec_* FT_Module;
  318. /*************************************************************************/
  319. /* */
  320. /* <Type> */
  321. /* FT_Driver */
  322. /* */
  323. /* <Description> */
  324. /* A handle to a given FreeType font driver object. Each font driver */
  325. /* is a special module capable of creating faces from font files. */
  326. /* */
  327. typedef struct FT_DriverRec_* FT_Driver;
  328. /*************************************************************************/
  329. /* */
  330. /* <Type> */
  331. /* FT_Renderer */
  332. /* */
  333. /* <Description> */
  334. /* A handle to a given FreeType renderer. A renderer is a special */
  335. /* module in charge of converting a glyph image to a bitmap, when */
  336. /* necessary. Each renderer supports a given glyph image format, and */
  337. /* one or more target surface depths. */
  338. /* */
  339. typedef struct FT_RendererRec_* FT_Renderer;
  340. /*************************************************************************/
  341. /* */
  342. /* <Type> */
  343. /* FT_Face */
  344. /* */
  345. /* <Description> */
  346. /* A handle to a given typographic face object. A face object models */
  347. /* a given typeface, in a given style. */
  348. /* */
  349. /* <Note> */
  350. /* Each face object also owns a single @FT_GlyphSlot object, as well */
  351. /* as one or more @FT_Size objects. */
  352. /* */
  353. /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */
  354. /* a given filepathname or a custom input stream. */
  355. /* */
  356. /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */
  357. /* */
  358. /* <Also> */
  359. /* See @FT_FaceRec for the publicly accessible fields of a given face */
  360. /* object. */
  361. /* */
  362. typedef struct FT_FaceRec_* FT_Face;
  363. /*************************************************************************/
  364. /* */
  365. /* <Type> */
  366. /* FT_Size */
  367. /* */
  368. /* <Description> */
  369. /* A handle to an object used to model a face scaled to a given */
  370. /* character size. */
  371. /* */
  372. /* <Note> */
  373. /* Each @FT_Face has an _active_ @FT_Size object that is used by */
  374. /* functions like @FT_Load_Glyph to determine the scaling */
  375. /* transformation which is used to load and hint glyphs and metrics. */
  376. /* */
  377. /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */
  378. /* @FT_Request_Size or even @FT_Select_Size to change the content */
  379. /* (i.e., the scaling values) of the active @FT_Size. */
  380. /* */
  381. /* You can use @FT_New_Size to create additional size objects for a */
  382. /* given @FT_Face, but they won't be used by other functions until */
  383. /* you activate it through @FT_Activate_Size. Only one size can be */
  384. /* activated at any given time per face. */
  385. /* */
  386. /* <Also> */
  387. /* See @FT_SizeRec for the publicly accessible fields of a given size */
  388. /* object. */
  389. /* */
  390. typedef struct FT_SizeRec_* FT_Size;
  391. /*************************************************************************/
  392. /* */
  393. /* <Type> */
  394. /* FT_GlyphSlot */
  395. /* */
  396. /* <Description> */
  397. /* A handle to a given `glyph slot'. A slot is a container where it */
  398. /* is possible to load any of the glyphs contained in its parent */
  399. /* face. */
  400. /* */
  401. /* In other words, each time you call @FT_Load_Glyph or */
  402. /* @FT_Load_Char, the slot's content is erased by the new glyph data, */
  403. /* i.e., the glyph's metrics, its image (bitmap or outline), and */
  404. /* other control information. */
  405. /* */
  406. /* <Also> */
  407. /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */
  408. /* */
  409. typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;
  410. /*************************************************************************/
  411. /* */
  412. /* <Type> */
  413. /* FT_CharMap */
  414. /* */
  415. /* <Description> */
  416. /* A handle to a given character map. A charmap is used to translate */
  417. /* character codes in a given encoding into glyph indexes for its */
  418. /* parent's face. Some font formats may provide several charmaps per */
  419. /* font. */
  420. /* */
  421. /* Each face object owns zero or more charmaps, but only one of them */
  422. /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */
  423. /* */
  424. /* The list of available charmaps in a face is available through the */
  425. /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */
  426. /* */
  427. /* The currently active charmap is available as `face->charmap'. */
  428. /* You should call @FT_Set_Charmap to change it. */
  429. /* */
  430. /* <Note> */
  431. /* When a new face is created (either through @FT_New_Face or */
  432. /* @FT_Open_Face), the library looks for a Unicode charmap within */
  433. /* the list and automatically activates it. */
  434. /* */
  435. /* <Also> */
  436. /* See @FT_CharMapRec for the publicly accessible fields of a given */
  437. /* character map. */
  438. /* */
  439. typedef struct FT_CharMapRec_* FT_CharMap;
  440. /*************************************************************************/
  441. /* */
  442. /* <Macro> */
  443. /* FT_ENC_TAG */
  444. /* */
  445. /* <Description> */
  446. /* This macro converts four-letter tags into an unsigned long. It is */
  447. /* used to define `encoding' identifiers (see @FT_Encoding). */
  448. /* */
  449. /* <Note> */
  450. /* Since many 16-bit compilers don't like 32-bit enumerations, you */
  451. /* should redefine this macro in case of problems to something like */
  452. /* this: */
  453. /* */
  454. /* { */
  455. /* #define FT_ENC_TAG( value, a, b, c, d ) value */
  456. /* } */
  457. /* */
  458. /* to get a simple enumeration without assigning special numbers. */
  459. /* */
  460. #ifndef FT_ENC_TAG
  461. #define FT_ENC_TAG( value, a, b, c, d ) \
  462. value = ( ( (FT_UInt32)(a) << 24 ) | \
  463. ( (FT_UInt32)(b) << 16 ) | \
  464. ( (FT_UInt32)(c) << 8 ) | \
  465. (FT_UInt32)(d) )
  466. #endif /* FT_ENC_TAG */
  467. /*************************************************************************/
  468. /* */
  469. /* <Enum> */
  470. /* FT_Encoding */
  471. /* */
  472. /* <Description> */
  473. /* An enumeration used to specify character sets supported by */
  474. /* charmaps. Used in the @FT_Select_Charmap API function. */
  475. /* */
  476. /* <Note> */
  477. /* Despite the name, this enumeration lists specific character */
  478. /* repertories (i.e., charsets), and not text encoding methods (e.g., */
  479. /* UTF-8, UTF-16, etc.). */
  480. /* */
  481. /* Other encodings might be defined in the future. */
  482. /* */
  483. /* <Values> */
  484. /* FT_ENCODING_NONE :: */
  485. /* The encoding value~0 is reserved. */
  486. /* */
  487. /* FT_ENCODING_UNICODE :: */
  488. /* Corresponds to the Unicode character set. This value covers */
  489. /* all versions of the Unicode repertoire, including ASCII and */
  490. /* Latin-1. Most fonts include a Unicode charmap, but not all */
  491. /* of them. */
  492. /* */
  493. /* For example, if you want to access Unicode value U+1F028 (and */
  494. /* the font contains it), use value 0x1F028 as the input value for */
  495. /* @FT_Get_Char_Index. */
  496. /* */
  497. /* FT_ENCODING_MS_SYMBOL :: */
  498. /* Corresponds to the Microsoft Symbol encoding, used to encode */
  499. /* mathematical symbols in the 32..255 character code range. For */
  500. /* more information, see `http://www.ceviz.net/symbol.htm'. */
  501. /* */
  502. /* FT_ENCODING_SJIS :: */
  503. /* Corresponds to Japanese SJIS encoding. More info at */
  504. /* at `http://langsupport.japanreference.com/encoding.shtml'. */
  505. /* See note on multi-byte encodings below. */
  506. /* */
  507. /* FT_ENCODING_GB2312 :: */
  508. /* Corresponds to an encoding system for Simplified Chinese as used */
  509. /* used in mainland China. */
  510. /* */
  511. /* FT_ENCODING_BIG5 :: */
  512. /* Corresponds to an encoding system for Traditional Chinese as */
  513. /* used in Taiwan and Hong Kong. */
  514. /* */
  515. /* FT_ENCODING_WANSUNG :: */
  516. /* Corresponds to the Korean encoding system known as Wansung. */
  517. /* For more information see */
  518. /* `http://www.microsoft.com/typography/unicode/949.txt'. */
  519. /* */
  520. /* FT_ENCODING_JOHAB :: */
  521. /* The Korean standard character set (KS~C 5601-1992), which */
  522. /* corresponds to MS Windows code page 1361. This character set */
  523. /* includes all possible Hangeul character combinations. */
  524. /* */
  525. /* FT_ENCODING_ADOBE_LATIN_1 :: */
  526. /* Corresponds to a Latin-1 encoding as defined in a Type~1 */
  527. /* PostScript font. It is limited to 256 character codes. */
  528. /* */
  529. /* FT_ENCODING_ADOBE_STANDARD :: */
  530. /* Corresponds to the Adobe Standard encoding, as found in Type~1, */
  531. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  532. /* codes. */
  533. /* */
  534. /* FT_ENCODING_ADOBE_EXPERT :: */
  535. /* Corresponds to the Adobe Expert encoding, as found in Type~1, */
  536. /* CFF, and OpenType/CFF fonts. It is limited to 256 character */
  537. /* codes. */
  538. /* */
  539. /* FT_ENCODING_ADOBE_CUSTOM :: */
  540. /* Corresponds to a custom encoding, as found in Type~1, CFF, and */
  541. /* OpenType/CFF fonts. It is limited to 256 character codes. */
  542. /* */
  543. /* FT_ENCODING_APPLE_ROMAN :: */
  544. /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */
  545. /* and OpenType fonts contain a charmap for this encoding, since */
  546. /* older versions of Mac OS are able to use it. */
  547. /* */
  548. /* FT_ENCODING_OLD_LATIN_2 :: */
  549. /* This value is deprecated and was never used nor reported by */
  550. /* FreeType. Don't use or test for it. */
  551. /* */
  552. /* FT_ENCODING_MS_SJIS :: */
  553. /* Same as FT_ENCODING_SJIS. Deprecated. */
  554. /* */
  555. /* FT_ENCODING_MS_GB2312 :: */
  556. /* Same as FT_ENCODING_GB2312. Deprecated. */
  557. /* */
  558. /* FT_ENCODING_MS_BIG5 :: */
  559. /* Same as FT_ENCODING_BIG5. Deprecated. */
  560. /* */
  561. /* FT_ENCODING_MS_WANSUNG :: */
  562. /* Same as FT_ENCODING_WANSUNG. Deprecated. */
  563. /* */
  564. /* FT_ENCODING_MS_JOHAB :: */
  565. /* Same as FT_ENCODING_JOHAB. Deprecated. */
  566. /* */
  567. /* <Note> */
  568. /* By default, FreeType automatically synthesizes a Unicode charmap */
  569. /* for PostScript fonts, using their glyph names dictionaries. */
  570. /* However, it also reports the encodings defined explicitly in the */
  571. /* font file, for the cases when they are needed, with the Adobe */
  572. /* values as well. */
  573. /* */
  574. /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
  575. /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
  576. /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */
  577. /* which encoding is really present. If, for example, the */
  578. /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
  579. /* the font is encoded in KOI8-R. */
  580. /* */
  581. /* FT_ENCODING_NONE is always set (with a single exception) by the */
  582. /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */
  583. /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */
  584. /* which encoding is really present. For example, */
  585. /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */
  586. /* Russian). */
  587. /* */
  588. /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */
  589. /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */
  590. /* FT_ENCODING_APPLE_ROMAN). */
  591. /* */
  592. /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */
  593. /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */
  594. /* be needed to be able to distinguish Apple encoding variants. See */
  595. /* */
  596. /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
  597. /* */
  598. /* to get an idea how to do that. Basically, if the language ID */
  599. /* is~0, don't use it, otherwise subtract 1 from the language ID. */
  600. /* Then examine `encoding_id'. If, for example, `encoding_id' is */
  601. /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */
  602. /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
  603. /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */
  604. /* variant the Arabic encoding. */
  605. /* */
  606. typedef enum FT_Encoding_
  607. {
  608. FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
  609. FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
  610. FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
  611. FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
  612. FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
  613. FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
  614. FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
  615. FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
  616. /* for backwards compatibility */
  617. FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
  618. FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
  619. FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
  620. FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
  621. FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
  622. FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
  623. FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
  624. FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),
  625. FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),
  626. FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),
  627. FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )
  628. } FT_Encoding;
  629. /*************************************************************************/
  630. /* */
  631. /* <Enum> */
  632. /* ft_encoding_xxx */
  633. /* */
  634. /* <Description> */
  635. /* These constants are deprecated; use the corresponding @FT_Encoding */
  636. /* values instead. */
  637. /* */
  638. #define ft_encoding_none FT_ENCODING_NONE
  639. #define ft_encoding_unicode FT_ENCODING_UNICODE
  640. #define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
  641. #define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
  642. #define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
  643. #define ft_encoding_sjis FT_ENCODING_SJIS
  644. #define ft_encoding_gb2312 FT_ENCODING_GB2312
  645. #define ft_encoding_big5 FT_ENCODING_BIG5
  646. #define ft_encoding_wansung FT_ENCODING_WANSUNG
  647. #define ft_encoding_johab FT_ENCODING_JOHAB
  648. #define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
  649. #define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
  650. #define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
  651. #define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
  652. /*************************************************************************/
  653. /* */
  654. /* <Struct> */
  655. /* FT_CharMapRec */
  656. /* */
  657. /* <Description> */
  658. /* The base charmap structure. */
  659. /* */
  660. /* <Fields> */
  661. /* face :: A handle to the parent face object. */
  662. /* */
  663. /* encoding :: An @FT_Encoding tag identifying the charmap. Use */
  664. /* this with @FT_Select_Charmap. */
  665. /* */
  666. /* platform_id :: An ID number describing the platform for the */
  667. /* following encoding ID. This comes directly from */
  668. /* the TrueType specification and should be emulated */
  669. /* for other formats. */
  670. /* */
  671. /* encoding_id :: A platform specific encoding number. This also */
  672. /* comes from the TrueType specification and should be */
  673. /* emulated similarly. */
  674. /* */
  675. typedef struct FT_CharMapRec_
  676. {
  677. FT_Face face;
  678. FT_Encoding encoding;
  679. FT_UShort platform_id;
  680. FT_UShort encoding_id;
  681. } FT_CharMapRec;
  682. /*************************************************************************/
  683. /*************************************************************************/
  684. /* */
  685. /* B A S E O B J E C T C L A S S E S */
  686. /* */
  687. /*************************************************************************/
  688. /*************************************************************************/
  689. /*************************************************************************/
  690. /* */
  691. /* <Type> */
  692. /* FT_Face_Internal */
  693. /* */
  694. /* <Description> */
  695. /* An opaque handle to an `FT_Face_InternalRec' structure, used to */
  696. /* model private data of a given @FT_Face object. */
  697. /* */
  698. /* This structure might change between releases of FreeType~2 and is */
  699. /* not generally available to client applications. */
  700. /* */
  701. typedef struct FT_Face_InternalRec_* FT_Face_Internal;
  702. /*************************************************************************/
  703. /* */
  704. /* <Struct> */
  705. /* FT_FaceRec */
  706. /* */
  707. /* <Description> */
  708. /* FreeType root face class structure. A face object models a */
  709. /* typeface in a font file. */
  710. /* */
  711. /* <Fields> */
  712. /* num_faces :: The number of faces in the font file. Some */
  713. /* font formats can have multiple faces in */
  714. /* a font file. */
  715. /* */
  716. /* face_index :: The index of the face in the font file. It */
  717. /* is set to~0 if there is only one face in */
  718. /* the font file. */
  719. /* */
  720. /* face_flags :: A set of bit flags that give important */
  721. /* information about the face; see */
  722. /* @FT_FACE_FLAG_XXX for the details. */
  723. /* */
  724. /* style_flags :: A set of bit flags indicating the style of */
  725. /* the face; see @FT_STYLE_FLAG_XXX for the */
  726. /* details. */
  727. /* */
  728. /* num_glyphs :: The number of glyphs in the face. If the */
  729. /* face is scalable and has sbits (see */
  730. /* `num_fixed_sizes'), it is set to the number */
  731. /* of outline glyphs. */
  732. /* */
  733. /* For CID-keyed fonts, this value gives the */
  734. /* highest CID used in the font. */
  735. /* */
  736. /* family_name :: The face's family name. This is an ASCII */
  737. /* string, usually in English, which describes */
  738. /* the typeface's family (like `Times New */
  739. /* Roman', `Bodoni', `Garamond', etc). This */
  740. /* is a least common denominator used to list */
  741. /* fonts. Some formats (TrueType & OpenType) */
  742. /* provide localized and Unicode versions of */
  743. /* this string. Applications should use the */
  744. /* format specific interface to access them. */
  745. /* Can be NULL (e.g., in fonts embedded in a */
  746. /* PDF file). */
  747. /* */
  748. /* style_name :: The face's style name. This is an ASCII */
  749. /* string, usually in English, which describes */
  750. /* the typeface's style (like `Italic', */
  751. /* `Bold', `Condensed', etc). Not all font */
  752. /* formats provide a style name, so this field */
  753. /* is optional, and can be set to NULL. As */
  754. /* for `family_name', some formats provide */
  755. /* localized and Unicode versions of this */
  756. /* string. Applications should use the format */
  757. /* specific interface to access them. */
  758. /* */
  759. /* num_fixed_sizes :: The number of bitmap strikes in the face. */
  760. /* Even if the face is scalable, there might */
  761. /* still be bitmap strikes, which are called */
  762. /* `sbits' in that case. */
  763. /* */
  764. /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */
  765. /* strikes in the face. It is set to NULL if */
  766. /* there is no bitmap strike. */
  767. /* */
  768. /* num_charmaps :: The number of charmaps in the face. */
  769. /* */
  770. /* charmaps :: An array of the charmaps of the face. */
  771. /* */
  772. /* generic :: A field reserved for client uses. See the */
  773. /* @FT_Generic type description. */
  774. /* */
  775. /* bbox :: The font bounding box. Coordinates are */
  776. /* expressed in font units (see */
  777. /* `units_per_EM'). The box is large enough */
  778. /* to contain any glyph from the font. Thus, */
  779. /* `bbox.yMax' can be seen as the `maximal */
  780. /* ascender', and `bbox.yMin' as the `minimal */
  781. /* descender'. Only relevant for scalable */
  782. /* formats. */
  783. /* */
  784. /* Note that the bounding box might be off by */
  785. /* (at least) one pixel for hinted fonts. See */
  786. /* @FT_Size_Metrics for further discussion. */
  787. /* */
  788. /* units_per_EM :: The number of font units per EM square for */
  789. /* this face. This is typically 2048 for */
  790. /* TrueType fonts, and 1000 for Type~1 fonts. */
  791. /* Only relevant for scalable formats. */
  792. /* */
  793. /* ascender :: The typographic ascender of the face, */
  794. /* expressed in font units. For font formats */
  795. /* not having this information, it is set to */
  796. /* `bbox.yMax'. Only relevant for scalable */
  797. /* formats. */
  798. /* */
  799. /* descender :: The typographic descender of the face, */
  800. /* expressed in font units. For font formats */
  801. /* not having this information, it is set to */
  802. /* `bbox.yMin'. Note that this field is */
  803. /* usually negative. Only relevant for */
  804. /* scalable formats. */
  805. /* */
  806. /* height :: The height is the vertical distance */
  807. /* between two consecutive baselines, */
  808. /* expressed in font units. It is always */
  809. /* positive. Only relevant for scalable */
  810. /* formats. */
  811. /* */
  812. /* max_advance_width :: The maximal advance width, in font units, */
  813. /* for all glyphs in this face. This can be */
  814. /* used to make word wrapping computations */
  815. /* faster. Only relevant for scalable */
  816. /* formats. */
  817. /* */
  818. /* max_advance_height :: The maximal advance height, in font units, */
  819. /* for all glyphs in this face. This is only */
  820. /* relevant for vertical layouts, and is set */
  821. /* to `height' for fonts that do not provide */
  822. /* vertical metrics. Only relevant for */
  823. /* scalable formats. */
  824. /* */
  825. /* underline_position :: The position, in font units, of the */
  826. /* underline line for this face. It is the */
  827. /* center of the underlining stem. Only */
  828. /* relevant for scalable formats. */
  829. /* */
  830. /* underline_thickness :: The thickness, in font units, of the */
  831. /* underline for this face. Only relevant for */
  832. /* scalable formats. */
  833. /* */
  834. /* glyph :: The face's associated glyph slot(s). */
  835. /* */
  836. /* size :: The current active size for this face. */
  837. /* */
  838. /* charmap :: The current active charmap for this face. */
  839. /* */
  840. /* <Note> */
  841. /* Fields may be changed after a call to @FT_Attach_File or */
  842. /* @FT_Attach_Stream. */
  843. /* */
  844. typedef struct FT_FaceRec_
  845. {
  846. FT_Long num_faces;
  847. FT_Long face_index;
  848. FT_Long face_flags;
  849. FT_Long style_flags;
  850. FT_Long num_glyphs;
  851. FT_String* family_name;
  852. FT_String* style_name;
  853. FT_Int num_fixed_sizes;
  854. FT_Bitmap_Size* available_sizes;
  855. FT_Int num_charmaps;
  856. FT_CharMap* charmaps;
  857. FT_Generic generic;
  858. /*# The following member variables (down to `underline_thickness') */
  859. /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */
  860. /*# for bitmap fonts. */
  861. FT_BBox bbox;
  862. FT_UShort units_per_EM;
  863. FT_Short ascender;
  864. FT_Short descender;
  865. FT_Short height;
  866. FT_Short max_advance_width;
  867. FT_Short max_advance_height;
  868. FT_Short underline_position;
  869. FT_Short underline_thickness;
  870. FT_GlyphSlot glyph;
  871. FT_Size size;
  872. FT_CharMap charmap;
  873. /*@private begin */
  874. FT_Driver driver;
  875. FT_Memory memory;
  876. FT_Stream stream;
  877. FT_ListRec sizes_list;
  878. FT_Generic autohint; /* face-specific auto-hinter data */
  879. void* extensions; /* unused */
  880. FT_Face_Internal internal;
  881. /*@private end */
  882. } FT_FaceRec;
  883. /*************************************************************************/
  884. /* */
  885. /* <Enum> */
  886. /* FT_FACE_FLAG_XXX */
  887. /* */
  888. /* <Description> */
  889. /* A list of bit flags used in the `face_flags' field of the */
  890. /* @FT_FaceRec structure. They inform client applications of */
  891. /* properties of the corresponding face. */
  892. /* */
  893. /* <Values> */
  894. /* FT_FACE_FLAG_SCALABLE :: */
  895. /* Indicates that the face contains outline glyphs. This doesn't */
  896. /* prevent bitmap strikes, i.e., a face can have both this and */
  897. /* and @FT_FACE_FLAG_FIXED_SIZES set. */
  898. /* */
  899. /* FT_FACE_FLAG_FIXED_SIZES :: */
  900. /* Indicates that the face contains bitmap strikes. See also the */
  901. /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */
  902. /* */
  903. /* FT_FACE_FLAG_FIXED_WIDTH :: */
  904. /* Indicates that the face contains fixed-width characters (like */
  905. /* Courier, Lucido, MonoType, etc.). */
  906. /* */
  907. /* FT_FACE_FLAG_SFNT :: */
  908. /* Indicates that the face uses the `sfnt' storage scheme. For */
  909. /* now, this means TrueType and OpenType. */
  910. /* */
  911. /* FT_FACE_FLAG_HORIZONTAL :: */
  912. /* Indicates that the face contains horizontal glyph metrics. This */
  913. /* should be set for all common formats. */
  914. /* */
  915. /* FT_FACE_FLAG_VERTICAL :: */
  916. /* Indicates that the face contains vertical glyph metrics. This */
  917. /* is only available in some formats, not all of them. */
  918. /* */
  919. /* FT_FACE_FLAG_KERNING :: */
  920. /* Indicates that the face contains kerning information. If set, */
  921. /* the kerning distance can be retrieved through the function */
  922. /* @FT_Get_Kerning. Otherwise the function always return the */
  923. /* vector (0,0). Note that FreeType doesn't handle kerning data */
  924. /* from the `GPOS' table (as present in some OpenType fonts). */
  925. /* */
  926. /* FT_FACE_FLAG_FAST_GLYPHS :: */
  927. /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */
  928. /* */
  929. /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */
  930. /* Indicates that the font contains multiple masters and is capable */
  931. /* of interpolating between them. See the multiple-masters */
  932. /* specific API for details. */
  933. /* */
  934. /* FT_FACE_FLAG_GLYPH_NAMES :: */
  935. /* Indicates that the font contains glyph names that can be */
  936. /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
  937. /* fonts contain broken glyph name tables. Use the function */
  938. /* @FT_Has_PS_Glyph_Names when needed. */
  939. /* */
  940. /* FT_FACE_FLAG_EXTERNAL_STREAM :: */
  941. /* Used internally by FreeType to indicate that a face's stream was */
  942. /* provided by the client application and should not be destroyed */
  943. /* when @FT_Done_Face is called. Don't read or test this flag. */
  944. /* */
  945. /* FT_FACE_FLAG_HINTER :: */
  946. /* Set if the font driver has a hinting machine of its own. For */
  947. /* example, with TrueType fonts, it makes sense to use data from */
  948. /* the SFNT `gasp' table only if the native TrueType hinting engine */
  949. /* (with the bytecode interpreter) is available and active. */
  950. /* */
  951. /* FT_FACE_FLAG_CID_KEYED :: */
  952. /* Set if the font is CID-keyed. In that case, the font is not */
  953. /* accessed by glyph indices but by CID values. For subsetted */
  954. /* CID-keyed fonts this has the consequence that not all index */
  955. /* values are a valid argument to FT_Load_Glyph. Only the CID */
  956. /* values for which corresponding glyphs in the subsetted font */
  957. /* exist make FT_Load_Glyph return successfully; in all other cases */
  958. /* you get an `FT_Err_Invalid_Argument' error. */
  959. /* */
  960. /* Note that CID-keyed fonts which are in an SFNT wrapper don't */
  961. /* have this flag set since the glyphs are accessed in the normal */
  962. /* way (using contiguous indices); the `CID-ness' isn't visible to */
  963. /* the application. */
  964. /* */
  965. /* FT_FACE_FLAG_TRICKY :: */
  966. /* Set if the font is `tricky', this is, it always needs the */
  967. /* font format's native hinting engine to get a reasonable result. */
  968. /* A typical example is the Chinese font `mingli.ttf' which uses */
  969. /* TrueType bytecode instructions to move and scale all of its */
  970. /* subglyphs. */
  971. /* */
  972. /* It is not possible to autohint such fonts using */
  973. /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */
  974. /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */
  975. /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */
  976. /* probably never want this except for demonstration purposes. */
  977. /* */
  978. /* Currently, there are about a dozen TrueType fonts in the list of */
  979. /* tricky fonts; they are hard-coded in file `ttobjs.c'. */
  980. /* */
  981. #define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
  982. #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
  983. #define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
  984. #define FT_FACE_FLAG_SFNT ( 1L << 3 )
  985. #define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )
  986. #define FT_FACE_FLAG_VERTICAL ( 1L << 5 )
  987. #define FT_FACE_FLAG_KERNING ( 1L << 6 )
  988. #define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )
  989. #define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
  990. #define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
  991. #define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
  992. #define FT_FACE_FLAG_HINTER ( 1L << 11 )
  993. #define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )
  994. #define FT_FACE_FLAG_TRICKY ( 1L << 13 )
  995. /*************************************************************************
  996. *
  997. * @macro:
  998. * FT_HAS_HORIZONTAL( face )
  999. *
  1000. * @description:
  1001. * A macro that returns true whenever a face object contains
  1002. * horizontal metrics (this is true for all font formats though).
  1003. *
  1004. * @also:
  1005. * @FT_HAS_VERTICAL can be used to check for vertical metrics.
  1006. *
  1007. */
  1008. #define FT_HAS_HORIZONTAL( face ) \
  1009. ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
  1010. /*************************************************************************
  1011. *
  1012. * @macro:
  1013. * FT_HAS_VERTICAL( face )
  1014. *
  1015. * @description:
  1016. * A macro that returns true whenever a face object contains vertical
  1017. * metrics.
  1018. *
  1019. */
  1020. #define FT_HAS_VERTICAL( face ) \
  1021. ( face->face_flags & FT_FACE_FLAG_VERTICAL )
  1022. /*************************************************************************
  1023. *
  1024. * @macro:
  1025. * FT_HAS_KERNING( face )
  1026. *
  1027. * @description:
  1028. * A macro that returns true whenever a face object contains kerning
  1029. * data that can be accessed with @FT_Get_Kerning.
  1030. *
  1031. */
  1032. #define FT_HAS_KERNING( face ) \
  1033. ( face->face_flags & FT_FACE_FLAG_KERNING )
  1034. /*************************************************************************
  1035. *
  1036. * @macro:
  1037. * FT_IS_SCALABLE( face )
  1038. *
  1039. * @description:
  1040. * A macro that returns true whenever a face object contains a scalable
  1041. * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF,
  1042. * and PFR font formats.
  1043. *
  1044. */
  1045. #define FT_IS_SCALABLE( face ) \
  1046. ( face->face_flags & FT_FACE_FLAG_SCALABLE )
  1047. /*************************************************************************
  1048. *
  1049. * @macro:
  1050. * FT_IS_SFNT( face )
  1051. *
  1052. * @description:
  1053. * A macro that returns true whenever a face object contains a font
  1054. * whose format is based on the SFNT storage scheme. This usually
  1055. * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded
  1056. * bitmap fonts.
  1057. *
  1058. * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and
  1059. * @FT_TRUETYPE_TABLES_H are available.
  1060. *
  1061. */
  1062. #define FT_IS_SFNT( face ) \
  1063. ( face->face_flags & FT_FACE_FLAG_SFNT )
  1064. /*************************************************************************
  1065. *
  1066. * @macro:
  1067. * FT_IS_FIXED_WIDTH( face )
  1068. *
  1069. * @description:
  1070. * A macro that returns true whenever a face object contains a font face
  1071. * that contains fixed-width (or `monospace', `fixed-pitch', etc.)
  1072. * glyphs.
  1073. *
  1074. */
  1075. #define FT_IS_FIXED_WIDTH( face ) \
  1076. ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
  1077. /*************************************************************************
  1078. *
  1079. * @macro:
  1080. * FT_HAS_FIXED_SIZES( face )
  1081. *
  1082. * @description:
  1083. * A macro that returns true whenever a face object contains some
  1084. * embedded bitmaps. See the `available_sizes' field of the
  1085. * @FT_FaceRec structure.
  1086. *
  1087. */
  1088. #define FT_HAS_FIXED_SIZES( face ) \
  1089. ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
  1090. /*************************************************************************
  1091. *
  1092. * @macro:
  1093. * FT_HAS_FAST_GLYPHS( face )
  1094. *
  1095. * @description:
  1096. * Deprecated.
  1097. *
  1098. */
  1099. #define FT_HAS_FAST_GLYPHS( face ) 0
  1100. /*************************************************************************
  1101. *
  1102. * @macro:
  1103. * FT_HAS_GLYPH_NAMES( face )
  1104. *
  1105. * @description:
  1106. * A macro that returns true whenever a face object contains some glyph
  1107. * names that can be accessed through @FT_Get_Glyph_Name.
  1108. *
  1109. */
  1110. #define FT_HAS_GLYPH_NAMES( face ) \
  1111. ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
  1112. /*************************************************************************
  1113. *
  1114. * @macro:
  1115. * FT_HAS_MULTIPLE_MASTERS( face )
  1116. *
  1117. * @description:
  1118. * A macro that returns true whenever a face object contains some
  1119. * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H
  1120. * are then available to choose the exact design you want.
  1121. *
  1122. */
  1123. #define FT_HAS_MULTIPLE_MASTERS( face ) \
  1124. ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
  1125. /*************************************************************************
  1126. *
  1127. * @macro:
  1128. * FT_IS_CID_KEYED( face )
  1129. *
  1130. * @description:
  1131. * A macro that returns true whenever a face object contains a CID-keyed
  1132. * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more
  1133. * details.
  1134. *
  1135. * If this macro is true, all functions defined in @FT_CID_H are
  1136. * available.
  1137. *
  1138. */
  1139. #define FT_IS_CID_KEYED( face ) \
  1140. ( face->face_flags & FT_FACE_FLAG_CID_KEYED )
  1141. /*************************************************************************
  1142. *
  1143. * @macro:
  1144. * FT_IS_TRICKY( face )
  1145. *
  1146. * @description:
  1147. * A macro that returns true whenever a face represents a `tricky' font.
  1148. * See the discussion of @FT_FACE_FLAG_TRICKY for more details.
  1149. *
  1150. */
  1151. #define FT_IS_TRICKY( face ) \
  1152. ( face->face_flags & FT_FACE_FLAG_TRICKY )
  1153. /*************************************************************************/
  1154. /* */
  1155. /* <Const> */
  1156. /* FT_STYLE_FLAG_XXX */
  1157. /* */
  1158. /* <Description> */
  1159. /* A list of bit-flags used to indicate the style of a given face. */
  1160. /* These are used in the `style_flags' field of @FT_FaceRec. */
  1161. /* */
  1162. /* <Values> */
  1163. /* FT_STYLE_FLAG_ITALIC :: */
  1164. /* Indicates that a given face style is italic or oblique. */
  1165. /* */
  1166. /* FT_STYLE_FLAG_BOLD :: */
  1167. /* Indicates that a given face is bold. */
  1168. /* */
  1169. /* <Note> */
  1170. /* The style information as provided by FreeType is very basic. More */
  1171. /* details are beyond the scope and should be done on a higher level */
  1172. /* (for example, by analyzing various fields of the `OS/2' table in */
  1173. /* SFNT based fonts). */
  1174. /* */
  1175. #define FT_STYLE_FLAG_ITALIC ( 1 << 0 )
  1176. #define FT_STYLE_FLAG_BOLD ( 1 << 1 )
  1177. /*************************************************************************/
  1178. /* */
  1179. /* <Type> */
  1180. /* FT_Size_Internal */
  1181. /* */
  1182. /* <Description> */
  1183. /* An opaque handle to an `FT_Size_InternalRec' structure, used to */
  1184. /* model private data of a given @FT_Size object. */
  1185. /* */
  1186. typedef struct FT_Size_InternalRec_* FT_Size_Internal;
  1187. /*************************************************************************/
  1188. /* */
  1189. /* <Struct> */
  1190. /* FT_Size_Metrics */
  1191. /* */
  1192. /* <Description> */
  1193. /* The size metrics structure gives the metrics of a size object. */
  1194. /* */
  1195. /* <Fields> */
  1196. /* x_ppem :: The width of the scaled EM square in pixels, hence */
  1197. /* the term `ppem' (pixels per EM). It is also */
  1198. /* referred to as `nominal width'. */
  1199. /* */
  1200. /* y_ppem :: The height of the scaled EM square in pixels, */
  1201. /* hence the term `ppem' (pixels per EM). It is also */
  1202. /* referred to as `nominal height'. */
  1203. /* */
  1204. /* x_scale :: A 16.16 fractional scaling value used to convert */
  1205. /* horizontal metrics from font units to 26.6 */
  1206. /* fractional pixels. Only relevant for scalable */
  1207. /* font formats. */
  1208. /* */
  1209. /* y_scale :: A 16.16 fractional scaling value used to convert */
  1210. /* vertical metrics from font units to 26.6 */
  1211. /* fractional pixels. Only relevant for scalable */
  1212. /* font formats. */
  1213. /* */
  1214. /* ascender :: The ascender in 26.6 fractional pixels. See */
  1215. /* @FT_FaceRec for the details. */
  1216. /* */
  1217. /* descender :: The descender in 26.6 fractional pixels. See */
  1218. /* @FT_FaceRec for the details. */
  1219. /* */
  1220. /* height :: The height in 26.6 fractional pixels. See */
  1221. /* @FT_FaceRec for the details. */
  1222. /* */
  1223. /* max_advance :: The maximal advance width in 26.6 fractional */
  1224. /* pixels. See @FT_FaceRec for the details. */
  1225. /* */
  1226. /* <Note> */
  1227. /* The scaling values, if relevant, are determined first during a */
  1228. /* size changing operation. The remaining fields are then set by the */
  1229. /* driver. For scalable formats, they are usually set to scaled */
  1230. /* values of the corresponding fields in @FT_FaceRec. */
  1231. /* */
  1232. /* Note that due to glyph hinting, these values might not be exact */
  1233. /* for certain fonts. Thus they must be treated as unreliable */
  1234. /* with an error margin of at least one pixel! */
  1235. /* */
  1236. /* Indeed, the only way to get the exact metrics is to render _all_ */
  1237. /* glyphs. As this would be a definite performance hit, it is up to */
  1238. /* client applications to perform such computations. */
  1239. /* */
  1240. /* The FT_Size_Metrics structure is valid for bitmap fonts also. */
  1241. /* */
  1242. typedef struct FT_Size_Metrics_
  1243. {
  1244. FT_UShort x_ppem; /* horizontal pixels per EM */
  1245. FT_UShort y_ppem; /* vertical pixels per EM */
  1246. FT_Fixed x_scale; /* scaling values used to convert font */
  1247. FT_Fixed y_scale; /* units to 26.6 fractional pixels */
  1248. FT_Pos ascender; /* ascender in 26.6 frac. pixels */
  1249. FT_Pos descender; /* descender in 26.6 frac. pixels */
  1250. FT_Pos height; /* text height in 26.6 frac. pixels */
  1251. FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */
  1252. } FT_Size_Metrics;
  1253. /*************************************************************************/
  1254. /* */
  1255. /* <Struct> */
  1256. /* FT_SizeRec */
  1257. /* */
  1258. /* <Description> */
  1259. /* FreeType root size class structure. A size object models a face */
  1260. /* object at a given size. */
  1261. /* */
  1262. /* <Fields> */
  1263. /* face :: Handle to the parent face object. */
  1264. /* */
  1265. /* generic :: A typeless pointer, which is unused by the FreeType */
  1266. /* library or any of its drivers. It can be used by */
  1267. /* client applications to link their own data to each size */
  1268. /* object. */
  1269. /* */
  1270. /* metrics :: Metrics for this size object. This field is read-only. */
  1271. /* */
  1272. typedef struct FT_SizeRec_
  1273. {
  1274. FT_Face face; /* parent face object */
  1275. FT_Generic generic; /* generic pointer for client uses */
  1276. FT_Size_Metrics metrics; /* size metrics */
  1277. FT_Size_Internal internal;
  1278. } FT_SizeRec;
  1279. /*************************************************************************/
  1280. /* */
  1281. /* <Struct> */
  1282. /* FT_SubGlyph */
  1283. /* */
  1284. /* <Description> */
  1285. /* The subglyph structure is an internal object used to describe */
  1286. /* subglyphs (for example, in the case of composites). */
  1287. /* */
  1288. /* <Note> */
  1289. /* The subglyph implementation is not part of the high-level API, */
  1290. /* hence the forward structure declaration. */
  1291. /* */
  1292. /* You can however retrieve subglyph information with */
  1293. /* @FT_Get_SubGlyph_Info. */
  1294. /* */
  1295. typedef struct FT_SubGlyphRec_* FT_SubGlyph;
  1296. /*************************************************************************/
  1297. /* */
  1298. /* <Type> */
  1299. /* FT_Slot_Internal */
  1300. /* */
  1301. /* <Description> */
  1302. /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */
  1303. /* model private data of a given @FT_GlyphSlot object. */
  1304. /* */
  1305. typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;
  1306. /*************************************************************************/
  1307. /* */
  1308. /* <Struct> */
  1309. /* FT_GlyphSlotRec */
  1310. /* */
  1311. /* <Description> */
  1312. /* FreeType root glyph slot class structure. A glyph slot is a */
  1313. /* container where individual glyphs can be loaded, be they in */
  1314. /* outline or bitmap format. */
  1315. /* */
  1316. /* <Fields> */
  1317. /* library :: A handle to the FreeType library instance */
  1318. /* this slot belongs to. */
  1319. /* */
  1320. /* face :: A handle to the parent face object. */
  1321. /* */
  1322. /* next :: In some cases (like some font tools), several */
  1323. /* glyph slots per face object can be a good */
  1324. /* thing. As this is rare, the glyph slots are */
  1325. /* listed through a direct, single-linked list */
  1326. /* using its `next' field. */
  1327. /* */
  1328. /* generic :: A typeless pointer which is unused by the */
  1329. /* FreeType library or any of its drivers. It */
  1330. /* can be used by client applications to link */
  1331. /* their own data to each glyph slot object. */
  1332. /* */
  1333. /* metrics :: The metrics of the last loaded glyph in the */
  1334. /* slot. The returned values depend on the last */
  1335. /* load flags (see the @FT_Load_Glyph API */
  1336. /* function) and can be expressed either in 26.6 */
  1337. /* fractional pixels or font units. */
  1338. /* */
  1339. /* Note that even when the glyph image is */
  1340. /* transformed, the metrics are not. */
  1341. /* */
  1342. /* linearHoriAdvance :: The advance width of the unhinted glyph. */
  1343. /* Its value is expressed in 16.16 fractional */
  1344. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1345. /* when loading the glyph. This field can be */
  1346. /* important to perform correct WYSIWYG layout. */
  1347. /* Only relevant for outline glyphs. */
  1348. /* */
  1349. /* linearVertAdvance :: The advance height of the unhinted glyph. */
  1350. /* Its value is expressed in 16.16 fractional */
  1351. /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */
  1352. /* when loading the glyph. This field can be */
  1353. /* important to perform correct WYSIWYG layout. */
  1354. /* Only relevant for outline glyphs. */
  1355. /* */
  1356. /* advance :: This shorthand is, depending on */
  1357. /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */
  1358. /* advance width for the glyph (in 26.6 */
  1359. /* fractional pixel format). As specified with */
  1360. /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */
  1361. /* `horiAdvance' or the `vertAdvance' value of */
  1362. /* `metrics' field. */
  1363. /* */
  1364. /* format :: This field indicates the format of the image */
  1365. /* contained in the glyph slot. Typically */
  1366. /* @FT_GLYPH_FORMAT_BITMAP, */
  1367. /* @FT_GLYPH_FORMAT_OUTLINE, or */
  1368. /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */
  1369. /* possible. */
  1370. /* */
  1371. /* bitmap :: This field is used as a bitmap descriptor */
  1372. /* when the slot format is */
  1373. /* @FT_GLYPH_FORMAT_BITMAP. Note that the */
  1374. /* address and content of the bitmap buffer can */
  1375. /* change between calls of @FT_Load_Glyph and a */
  1376. /* few other functions. */
  1377. /* */
  1378. /* bitmap_left :: This is the bitmap's left bearing expressed */
  1379. /* in integer pixels. Of course, this is only */
  1380. /* valid if the format is */
  1381. /* @FT_GLYPH_FORMAT_BITMAP. */
  1382. /* */
  1383. /* bitmap_top :: This is the bitmap's top bearing expressed in */
  1384. /* integer pixels. Remember that this is the */
  1385. /* distance from the baseline to the top-most */
  1386. /* glyph scanline, upwards y~coordinates being */
  1387. /* *positive*. */
  1388. /* */
  1389. /* outline :: The outline descriptor for the current glyph */
  1390. /* image if its format is */
  1391. /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */
  1392. /* loaded, `outline' can be transformed, */
  1393. /* distorted, embolded, etc. However, it must */
  1394. /* not be freed. */
  1395. /* */
  1396. /* num_subglyphs :: The number of subglyphs in a composite glyph. */
  1397. /* This field is only valid for the composite */
  1398. /* glyph format that should normally only be */
  1399. /* loaded with the @FT_LOAD_NO_RECURSE flag. */
  1400. /* For now this is internal to FreeType. */
  1401. /* */
  1402. /* subglyphs :: An array of subglyph descriptors for */
  1403. /* composite glyphs. There are `num_subglyphs' */
  1404. /* elements in there. Currently internal to */
  1405. /* FreeType. */
  1406. /* */
  1407. /* control_data :: Certain font drivers can also return the */
  1408. /* control data for a given glyph image (e.g. */
  1409. /* TrueType bytecode, Type~1 charstrings, etc.). */
  1410. /* This field is a pointer to such data. */
  1411. /* */
  1412. /* control_len :: This is the length in bytes of the control */
  1413. /* data. */
  1414. /* */
  1415. /* other :: Really wicked formats can use this pointer to */
  1416. /* present their own glyph image to client */
  1417. /* applications. Note that the application */
  1418. /* needs to know about the image format. */
  1419. /* */
  1420. /* lsb_delta :: The difference between hinted and unhinted */
  1421. /* left side bearing while autohinting is */
  1422. /* active. Zero otherwise. */
  1423. /* */
  1424. /* rsb_delta :: The difference between hinted and unhinted */
  1425. /* right side bearing while autohinting is */
  1426. /* active. Zero otherwise. */
  1427. /* */
  1428. /* <Note> */
  1429. /* If @FT_Load_Glyph is called with default flags (see */
  1430. /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */
  1431. /* its native format (e.g., an outline glyph for TrueType and Type~1 */
  1432. /* formats). */
  1433. /* */
  1434. /* This image can later be converted into a bitmap by calling */
  1435. /* @FT_Render_Glyph. This function finds the current renderer for */
  1436. /* the native image's format, then invokes it. */
  1437. /* */
  1438. /* The renderer is in charge of transforming the native image through */
  1439. /* the slot's face transformation fields, then converting it into a */
  1440. /* bitmap that is returned in `slot->bitmap'. */
  1441. /* */
  1442. /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
  1443. /* to specify the position of the bitmap relative to the current pen */
  1444. /* position (e.g., coordinates (0,0) on the baseline). Of course, */
  1445. /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */
  1446. /* */
  1447. /* <Note> */
  1448. /* Here a small pseudo code fragment which shows how to use */
  1449. /* `lsb_delta' and `rsb_delta': */
  1450. /* */
  1451. /* { */
  1452. /* FT_Pos origin_x = 0; */
  1453. /* FT_Pos prev_rsb_delta = 0; */
  1454. /* */
  1455. /* */
  1456. /* for all glyphs do */
  1457. /* <compute kern between current and previous glyph and add it to */
  1458. /* `origin_x'> */
  1459. /* */
  1460. /* <load glyph with `FT_Load_Glyph'> */
  1461. /* */
  1462. /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */
  1463. /* origin_x -= 64; */
  1464. /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */
  1465. /* origin_x += 64; */
  1466. /* */
  1467. /* prev_rsb_delta = face->glyph->rsb_delta; */
  1468. /* */
  1469. /* <save glyph image, or render glyph, or ...> */
  1470. /* */
  1471. /* origin_x += face->glyph->advance.x; */
  1472. /* endfor */
  1473. /* } */
  1474. /* */
  1475. typedef struct FT_GlyphSlotRec_
  1476. {
  1477. FT_Library library;
  1478. FT_Face face;
  1479. FT_GlyphSlot next;
  1480. FT_UInt reserved; /* retained for binary compatibility */
  1481. FT_Generic generic;
  1482. FT_Glyph_Metrics metrics;
  1483. FT_Fixed linearHoriAdvance;
  1484. FT_Fixed linearVertAdvance;
  1485. FT_Vector advance;
  1486. FT_Glyph_Format format;
  1487. FT_Bitmap bitmap;
  1488. FT_Int bitmap_left;
  1489. FT_Int bitmap_top;
  1490. FT_Outline outline;
  1491. FT_UInt num_subglyphs;
  1492. FT_SubGlyph subglyphs;
  1493. void* control_data;
  1494. long control_len;
  1495. FT_Pos lsb_delta;
  1496. FT_Pos rsb_delta;
  1497. void* other;
  1498. FT_Slot_Internal internal;
  1499. } FT_GlyphSlotRec;
  1500. /*************************************************************************/
  1501. /*************************************************************************/
  1502. /* */
  1503. /* F U N C T I O N S */
  1504. /* */
  1505. /*************************************************************************/
  1506. /*************************************************************************/
  1507. /*************************************************************************/
  1508. /* */
  1509. /* <Function> */
  1510. /* FT_Init_FreeType */
  1511. /* */
  1512. /* <Description> */
  1513. /* Initialize a new FreeType library object. The set of modules */
  1514. /* that are registered by this function is determined at build time. */
  1515. /* */
  1516. /* <Output> */
  1517. /* alibrary :: A handle to a new library object. */
  1518. /* */
  1519. /* <Return> */
  1520. /* FreeType error code. 0~means success. */
  1521. /* */
  1522. /* <Note> */
  1523. /* In case you want to provide your own memory allocating routines, */
  1524. /* use @FT_New_Library instead, followed by a call to */
  1525. /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
  1526. /* */
  1527. /* For multi-threading applications each thread should have its own */
  1528. /* FT_Library object. */
  1529. /* */
  1530. FT_EXPORT( FT_Error )
  1531. FT_Init_FreeType( FT_Library *alibrary );
  1532. /*************************************************************************/
  1533. /* */
  1534. /* <Function> */
  1535. /* FT_Done_FreeType */
  1536. /* */
  1537. /* <Description> */
  1538. /* Destroy a given FreeType library object and all of its children, */
  1539. /* including resources, drivers, faces, sizes, etc. */
  1540. /* */
  1541. /* <Input> */
  1542. /* library :: A handle to the target library object. */
  1543. /* */
  1544. /* <Return> */
  1545. /* FreeType error code. 0~means success. */
  1546. /* */
  1547. FT_EXPORT( FT_Error )
  1548. FT_Done_FreeType( FT_Library library );
  1549. /*************************************************************************/
  1550. /* */
  1551. /* <Enum> */
  1552. /* FT_OPEN_XXX */
  1553. /* */
  1554. /* <Description> */
  1555. /* A list of bit-field constants used within the `flags' field of the */
  1556. /* @FT_Open_Args structure. */
  1557. /* */
  1558. /* <Values> */
  1559. /* FT_OPEN_MEMORY :: This is a memory-based stream. */
  1560. /* */
  1561. /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
  1562. /* */
  1563. /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */
  1564. /* name. */
  1565. /* */
  1566. /* FT_OPEN_DRIVER :: Use the `driver' field. */
  1567. /* */
  1568. /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */
  1569. /* */
  1570. /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
  1571. /* */
  1572. /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
  1573. /* */
  1574. /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
  1575. /* */
  1576. /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
  1577. /* */
  1578. /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
  1579. /* */
  1580. /* <Note> */
  1581. /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
  1582. /* flags are mutually exclusive. */
  1583. /* */
  1584. #define FT_OPEN_MEMORY 0x1
  1585. #define FT_OPEN_STREAM 0x2
  1586. #define FT_OPEN_PATHNAME 0x4
  1587. #define FT_OPEN_DRIVER 0x8
  1588. #define FT_OPEN_PARAMS 0x10
  1589. #define ft_open_memory FT_OPEN_MEMORY /* deprecated */
  1590. #define ft_open_stream FT_OPEN_STREAM /* deprecated */
  1591. #define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
  1592. #define ft_open_driver FT_OPEN_DRIVER /* deprecated */
  1593. #define ft_open_params FT_OPEN_PARAMS /* deprecated */
  1594. /*************************************************************************/
  1595. /* */
  1596. /* <Struct> */
  1597. /* FT_Parameter */
  1598. /* */
  1599. /* <Description> */
  1600. /* A simple structure used to pass more or less generic parameters to */
  1601. /* @FT_Open_Face. */
  1602. /* */
  1603. /* <Fields> */
  1604. /* tag :: A four-byte identification tag. */
  1605. /* */
  1606. /* data :: A pointer to the parameter data. */
  1607. /* */
  1608. /* <Note> */
  1609. /* The ID and function of parameters are driver-specific. See the */
  1610. /* various FT_PARAM_TAG_XXX flags for more information. */
  1611. /* */
  1612. typedef struct FT_Parameter_
  1613. {
  1614. FT_ULong tag;
  1615. FT_Pointer data;
  1616. } FT_Parameter;
  1617. /*************************************************************************/
  1618. /* */
  1619. /* <Struct> */
  1620. /* FT_Open_Args */
  1621. /* */
  1622. /* <Description> */
  1623. /* A structure used to indicate how to open a new font file or */
  1624. /* stream. A pointer to such a structure can be used as a parameter */
  1625. /* for the functions @FT_Open_Face and @FT_Attach_Stream. */
  1626. /* */
  1627. /* <Fields> */
  1628. /* flags :: A set of bit flags indicating how to use the */
  1629. /* structure. */
  1630. /* */
  1631. /* memory_base :: The first byte of the file in memory. */
  1632. /* */
  1633. /* memory_size :: The size in bytes of the file in memory. */
  1634. /* */
  1635. /* pathname :: A pointer to an 8-bit file pathname. */
  1636. /* */
  1637. /* stream :: A handle to a source stream object. */
  1638. /* */
  1639. /* driver :: This field is exclusively used by @FT_Open_Face; */
  1640. /* it simply specifies the font driver to use to open */
  1641. /* the face. If set to~0, FreeType tries to load the */
  1642. /* face with each one of the drivers in its list. */
  1643. /* */
  1644. /* num_params :: The number of extra parameters. */
  1645. /* */
  1646. /* params :: Extra parameters passed to the font driver when */
  1647. /* opening a new face. */
  1648. /* */
  1649. /* <Note> */
  1650. /* The stream type is determined by the contents of `flags' which */
  1651. /* are tested in the following order by @FT_Open_Face: */
  1652. /* */
  1653. /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */
  1654. /* memory file of `memory_size' bytes, located at `memory_address'. */
  1655. /* The data are are not copied, and the client is responsible for */
  1656. /* releasing and destroying them _after_ the corresponding call to */
  1657. /* @FT_Done_Face. */
  1658. /* */
  1659. /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */
  1660. /* custom input stream `stream' is used. */
  1661. /* */
  1662. /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */
  1663. /* is a normal file and use `pathname' to open it. */
  1664. /* */
  1665. /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */
  1666. /* open the file with the driver whose handler is in `driver'. */
  1667. /* */
  1668. /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */
  1669. /* `num_params' and `params' is used. They are ignored otherwise. */
  1670. /* */
  1671. /* Ideally, both the `pathname' and `params' fields should be tagged */
  1672. /* as `const'; this is missing for API backwards compatibility. In */
  1673. /* other words, applications should treat them as read-only. */
  1674. /* */
  1675. typedef struct FT_Open_Args_
  1676. {
  1677. FT_UInt flags;
  1678. const FT_Byte* memory_base;
  1679. FT_Long memory_size;
  1680. FT_String* pathname;
  1681. FT_Stream stream;
  1682. FT_Module driver;
  1683. FT_Int num_params;
  1684. FT_Parameter* params;
  1685. } FT_Open_Args;
  1686. /*************************************************************************/
  1687. /* */
  1688. /* <Function> */
  1689. /* FT_New_Face */
  1690. /* */
  1691. /* <Description> */
  1692. /* This function calls @FT_Open_Face to open a font by its pathname. */
  1693. /* */
  1694. /* <InOut> */
  1695. /* library :: A handle to the library resource. */
  1696. /* */
  1697. /* <Input> */
  1698. /* pathname :: A path to the font file. */
  1699. /* */
  1700. /* face_index :: The index of the face within the font. The first */
  1701. /* face has index~0. */
  1702. /* */
  1703. /* <Output> */
  1704. /* aface :: A handle to a new face object. If `face_index' is */
  1705. /* greater than or equal to zero, it must be non-NULL. */
  1706. /* See @FT_Open_Face for more details. */
  1707. /* */
  1708. /* <Return> */
  1709. /* FreeType error code. 0~means success. */
  1710. /* */
  1711. FT_EXPORT( FT_Error )
  1712. FT_New_Face( FT_Library library,
  1713. const char* filepathname,
  1714. FT_Long face_index,
  1715. FT_Face *aface );
  1716. /*************************************************************************/
  1717. /* */
  1718. /* <Function> */
  1719. /* FT_New_Memory_Face */
  1720. /* */
  1721. /* <Description> */
  1722. /* This function calls @FT_Open_Face to open a font which has been */
  1723. /* loaded into memory. */
  1724. /* */
  1725. /* <InOut> */
  1726. /* library :: A handle to the library resource. */
  1727. /* */
  1728. /* <Input> */
  1729. /* file_base :: A pointer to the beginning of the font data. */
  1730. /* */
  1731. /* file_size :: The size of the memory chunk used by the font data. */
  1732. /* */
  1733. /* face_index :: The index of the face within the font. The first */
  1734. /* face has index~0. */
  1735. /* */
  1736. /* <Output> */
  1737. /* aface :: A handle to a new face object. If `face_index' is */
  1738. /* greater than or equal to zero, it must be non-NULL. */
  1739. /* See @FT_Open_Face for more details. */
  1740. /* */
  1741. /* <Return> */
  1742. /* FreeType error code. 0~means success. */
  1743. /* */
  1744. /* <Note> */
  1745. /* You must not deallocate the memory before calling @FT_Done_Face. */
  1746. /* */
  1747. FT_EXPORT( FT_Error )
  1748. FT_New_Memory_Face( FT_Library library,
  1749. const FT_Byte* file_base,
  1750. FT_Long file_size,
  1751. FT_Long face_index,
  1752. FT_Face *aface );
  1753. /*************************************************************************/
  1754. /* */
  1755. /* <Function> */
  1756. /* FT_Open_Face */
  1757. /* */
  1758. /* <Description> */
  1759. /* Create a face object from a given resource described by */
  1760. /* @FT_Open_Args. */
  1761. /* */
  1762. /* <InOut> */
  1763. /* library :: A handle to the library resource. */
  1764. /* */
  1765. /* <Input> */
  1766. /* args :: A pointer to an `FT_Open_Args' structure which must */
  1767. /* be filled by the caller. */
  1768. /* */
  1769. /* face_index :: The index of the face within the font. The first */
  1770. /* face has index~0. */
  1771. /* */
  1772. /* <Output> */
  1773. /* aface :: A handle to a new face object. If `face_index' is */
  1774. /* greater than or equal to zero, it must be non-NULL. */
  1775. /* See note below. */
  1776. /* */
  1777. /* <Return> */
  1778. /* FreeType error code. 0~means success. */
  1779. /* */
  1780. /* <Note> */
  1781. /* Unlike FreeType 1.x, this function automatically creates a glyph */
  1782. /* slot for the face object which can be accessed directly through */
  1783. /* `face->glyph'. */
  1784. /* */
  1785. /* FT_Open_Face can be used to quickly check whether the font */
  1786. /* format of a given font resource is supported by FreeType. If the */
  1787. /* `face_index' field is negative, the function's return value is~0 */
  1788. /* if the font format is recognized, or non-zero otherwise; */
  1789. /* the function returns a more or less empty face handle in `*aface' */
  1790. /* (if `aface' isn't NULL). The only useful field in this special */
  1791. /* case is `face->num_faces' which gives the number of faces within */
  1792. /* the font file. After examination, the returned @FT_Face structure */
  1793. /* should be deallocated with a call to @FT_Done_Face. */
  1794. /* */
  1795. /* Each new face object created with this function also owns a */
  1796. /* default @FT_Size object, accessible as `face->size'. */
  1797. /* */
  1798. /* One @FT_Library instance can have multiple face objects, this is, */
  1799. /* @FT_Open_Face and its siblings can be called multiple times using */
  1800. /* the same `library' argument. */
  1801. /* */
  1802. /* See the discussion of reference counters in the description of */
  1803. /* @FT_Reference_Face. */
  1804. /* */
  1805. FT_EXPORT( FT_Error )
  1806. FT_Open_Face( FT_Library library,
  1807. const FT_Open_Args* args,
  1808. FT_Long face_index,
  1809. FT_Face *aface );
  1810. /*************************************************************************/
  1811. /* */
  1812. /* <Function> */
  1813. /* FT_Attach_File */
  1814. /* */
  1815. /* <Description> */
  1816. /* This function calls @FT_Attach_Stream to attach a file. */
  1817. /* */
  1818. /* <InOut> */
  1819. /* face :: The target face object. */
  1820. /* */
  1821. /* <Input> */
  1822. /* filepathname :: The pathname. */
  1823. /* */
  1824. /* <Return> */
  1825. /* FreeType error code. 0~means success. */
  1826. /* */
  1827. FT_EXPORT( FT_Error )
  1828. FT_Attach_File( FT_Face face,
  1829. const char* filepathname );
  1830. /*************************************************************************/
  1831. /* */
  1832. /* <Function> */
  1833. /* FT_Attach_Stream */
  1834. /* */
  1835. /* <Description> */
  1836. /* `Attach' data to a face object. Normally, this is used to read */
  1837. /* additional information for the face object. For example, you can */
  1838. /* attach an AFM file that comes with a Type~1 font to get the */
  1839. /* kerning values and other metrics. */
  1840. /* */
  1841. /* <InOut> */
  1842. /* face :: The target face object. */
  1843. /* */
  1844. /* <Input> */
  1845. /* parameters :: A pointer to @FT_Open_Args which must be filled by */
  1846. /* the caller. */
  1847. /* */
  1848. /* <Return> */
  1849. /* FreeType error code. 0~means success. */
  1850. /* */
  1851. /* <Note> */
  1852. /* The meaning of the `attach' (i.e., what really happens when the */
  1853. /* new file is read) is not fixed by FreeType itself. It really */
  1854. /* depends on the font format (and thus the font driver). */
  1855. /* */
  1856. /* Client applications are expected to know what they are doing */
  1857. /* when invoking this function. Most drivers simply do not implement */
  1858. /* file attachments. */
  1859. /* */
  1860. FT_EXPORT( FT_Error )
  1861. FT_Attach_Stream( FT_Face face,
  1862. FT_Open_Args* parameters );
  1863. /*************************************************************************/
  1864. /* */
  1865. /* <Function> */
  1866. /* FT_Reference_Face */
  1867. /* */
  1868. /* <Description> */
  1869. /* A counter gets initialized to~1 at the time an @FT_Face structure */
  1870. /* is created. This function increments the counter. @FT_Done_Face */
  1871. /* then only destroys a face if the counter is~1, otherwise it simply */
  1872. /* decrements the counter. */
  1873. /* */
  1874. /* This function helps in managing life-cycles of structures which */
  1875. /* reference @FT_Face objects. */
  1876. /* */
  1877. /* <Input> */
  1878. /* face :: A handle to a target face object. */
  1879. /* */
  1880. /* <Return> */
  1881. /* FreeType error code. 0~means success. */
  1882. /* */
  1883. /* <Since> */
  1884. /* 2.4.2 */
  1885. /* */
  1886. FT_EXPORT( FT_Error )
  1887. FT_Reference_Face( FT_Face face );
  1888. /*************************************************************************/
  1889. /* */
  1890. /* <Function> */
  1891. /* FT_Done_Face */
  1892. /* */
  1893. /* <Description> */
  1894. /* Discard a given face object, as well as all of its child slots and */
  1895. /* sizes. */
  1896. /* */
  1897. /* <Input> */
  1898. /* face :: A handle to a target face object. */
  1899. /* */
  1900. /* <Return> */
  1901. /* FreeType error code. 0~means success. */
  1902. /* */
  1903. /* <Note> */
  1904. /* See the discussion of reference counters in the description of */
  1905. /* @FT_Reference_Face. */
  1906. /* */
  1907. FT_EXPORT( FT_Error )
  1908. FT_Done_Face( FT_Face face );
  1909. /*************************************************************************/
  1910. /* */
  1911. /* <Function> */
  1912. /* FT_Select_Size */
  1913. /* */
  1914. /* <Description> */
  1915. /* Select a bitmap strike. */
  1916. /* */
  1917. /* <InOut> */
  1918. /* face :: A handle to a target face object. */
  1919. /* */
  1920. /* <Input> */
  1921. /* strike_index :: The index of the bitmap strike in the */
  1922. /* `available_sizes' field of @FT_FaceRec structure. */
  1923. /* */
  1924. /* <Return> */
  1925. /* FreeType error code. 0~means success. */
  1926. /* */
  1927. FT_EXPORT( FT_Error )
  1928. FT_Select_Size( FT_Face face,
  1929. FT_Int strike_index );
  1930. /*************************************************************************/
  1931. /* */
  1932. /* <Enum> */
  1933. /* FT_Size_Request_Type */
  1934. /* */
  1935. /* <Description> */
  1936. /* An enumeration type that lists the supported size request types. */
  1937. /* */
  1938. /* <Values> */
  1939. /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */
  1940. /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */
  1941. /* used to determine both scaling values. */
  1942. /* */
  1943. /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */
  1944. /* The real dimension. The sum of the the `ascender' and (minus */
  1945. /* of) the `descender' fields of @FT_FaceRec are used to determine */
  1946. /* both scaling values. */
  1947. /* */
  1948. /* FT_SIZE_REQUEST_TYPE_BBOX :: */
  1949. /* The font bounding box. The width and height of the `bbox' field */
  1950. /* of @FT_FaceRec are used to determine the horizontal and vertical */
  1951. /* scaling value, respectively. */
  1952. /* */
  1953. /* FT_SIZE_REQUEST_TYPE_CELL :: */
  1954. /* The `max_advance_width' field of @FT_FaceRec is used to */
  1955. /* determine the horizontal scaling value; the vertical scaling */
  1956. /* value is determined the same way as */
  1957. /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */
  1958. /* values are set to the smaller one. This type is useful if you */
  1959. /* want to specify the font size for, say, a window of a given */
  1960. /* dimension and 80x24 cells. */
  1961. /* */
  1962. /* FT_SIZE_REQUEST_TYPE_SCALES :: */
  1963. /* Specify the scaling values directly. */
  1964. /* */
  1965. /* <Note> */
  1966. /* The above descriptions only apply to scalable formats. For bitmap */
  1967. /* formats, the behaviour is up to the driver. */
  1968. /* */
  1969. /* See the note section of @FT_Size_Metrics if you wonder how size */
  1970. /* requesting relates to scaling values. */
  1971. /* */
  1972. typedef enum FT_Size_Request_Type_
  1973. {
  1974. FT_SIZE_REQUEST_TYPE_NOMINAL,
  1975. FT_SIZE_REQUEST_TYPE_REAL_DIM,
  1976. FT_SIZE_REQUEST_TYPE_BBOX,
  1977. FT_SIZE_REQUEST_TYPE_CELL,
  1978. FT_SIZE_REQUEST_TYPE_SCALES,
  1979. FT_SIZE_REQUEST_TYPE_MAX
  1980. } FT_Size_Request_Type;
  1981. /*************************************************************************/
  1982. /* */
  1983. /* <Struct> */
  1984. /* FT_Size_RequestRec */
  1985. /* */
  1986. /* <Description> */
  1987. /* A structure used to model a size request. */
  1988. /* */
  1989. /* <Fields> */
  1990. /* type :: See @FT_Size_Request_Type. */
  1991. /* */
  1992. /* width :: The desired width. */
  1993. /* */
  1994. /* height :: The desired height. */
  1995. /* */
  1996. /* horiResolution :: The horizontal resolution. If set to zero, */
  1997. /* `width' is treated as a 26.6 fractional pixel */
  1998. /* value. */
  1999. /* */
  2000. /* vertResolution :: The vertical resolution. If set to zero, */
  2001. /* `height' is treated as a 26.6 fractional pixel */
  2002. /* value. */
  2003. /* */
  2004. /* <Note> */
  2005. /* If `width' is zero, then the horizontal scaling value is set equal */
  2006. /* to the vertical scaling value, and vice versa. */
  2007. /* */
  2008. typedef struct FT_Size_RequestRec_
  2009. {
  2010. FT_Size_Request_Type type;
  2011. FT_Long width;
  2012. FT_Long height;
  2013. FT_UInt horiResolution;
  2014. FT_UInt vertResolution;
  2015. } FT_Size_RequestRec;
  2016. /*************************************************************************/
  2017. /* */
  2018. /* <Struct> */
  2019. /* FT_Size_Request */
  2020. /* */
  2021. /* <Description> */
  2022. /* A handle to a size request structure. */
  2023. /* */
  2024. typedef struct FT_Size_RequestRec_ *FT_Size_Request;
  2025. /*************************************************************************/
  2026. /* */
  2027. /* <Function> */
  2028. /* FT_Request_Size */
  2029. /* */
  2030. /* <Description> */
  2031. /* Resize the scale of the active @FT_Size object in a face. */
  2032. /* */
  2033. /* <InOut> */
  2034. /* face :: A handle to a target face object. */
  2035. /* */
  2036. /* <Input> */
  2037. /* req :: A pointer to a @FT_Size_RequestRec. */
  2038. /* */
  2039. /* <Return> */
  2040. /* FreeType error code. 0~means success. */
  2041. /* */
  2042. /* <Note> */
  2043. /* Although drivers may select the bitmap strike matching the */
  2044. /* request, you should not rely on this if you intend to select a */
  2045. /* particular bitmap strike. Use @FT_Select_Size instead in that */
  2046. /* case. */
  2047. /* */
  2048. FT_EXPORT( FT_Error )
  2049. FT_Request_Size( FT_Face face,
  2050. FT_Size_Request req );
  2051. /*************************************************************************/
  2052. /* */
  2053. /* <Function> */
  2054. /* FT_Set_Char_Size */
  2055. /* */
  2056. /* <Description> */
  2057. /* This function calls @FT_Request_Size to request the nominal size */
  2058. /* (in points). */
  2059. /* */
  2060. /* <InOut> */
  2061. /* face :: A handle to a target face object. */
  2062. /* */
  2063. /* <Input> */
  2064. /* char_width :: The nominal width, in 26.6 fractional points. */
  2065. /* */
  2066. /* char_height :: The nominal height, in 26.6 fractional points. */
  2067. /* */
  2068. /* horz_resolution :: The horizontal resolution in dpi. */
  2069. /* */
  2070. /* vert_resolution :: The vertical resolution in dpi. */
  2071. /* */
  2072. /* <Return> */
  2073. /* FreeType error code. 0~means success. */
  2074. /* */
  2075. /* <Note> */
  2076. /* If either the character width or height is zero, it is set equal */
  2077. /* to the other value. */
  2078. /* */
  2079. /* If either the horizontal or vertical resolution is zero, it is set */
  2080. /* equal to the other value. */
  2081. /* */
  2082. /* A character width or height smaller than 1pt is set to 1pt; if */
  2083. /* both resolution values are zero, they are set to 72dpi. */
  2084. /* */
  2085. /* Don't use this function if you are using the FreeType cache API. */
  2086. /* */
  2087. FT_EXPORT( FT_Error )
  2088. FT_Set_Char_Size( FT_Face face,
  2089. FT_F26Dot6 char_width,
  2090. FT_F26Dot6 char_height,
  2091. FT_UInt horz_resolution,
  2092. FT_UInt vert_resolution );
  2093. /*************************************************************************/
  2094. /* */
  2095. /* <Function> */
  2096. /* FT_Set_Pixel_Sizes */
  2097. /* */
  2098. /* <Description> */
  2099. /* This function calls @FT_Request_Size to request the nominal size */
  2100. /* (in pixels). */
  2101. /* */
  2102. /* <InOut> */
  2103. /* face :: A handle to the target face object. */
  2104. /* */
  2105. /* <Input> */
  2106. /* pixel_width :: The nominal width, in pixels. */
  2107. /* */
  2108. /* pixel_height :: The nominal height, in pixels. */
  2109. /* */
  2110. /* <Return> */
  2111. /* FreeType error code. 0~means success. */
  2112. /* */
  2113. FT_EXPORT( FT_Error )
  2114. FT_Set_Pixel_Sizes( FT_Face face,
  2115. FT_UInt pixel_width,
  2116. FT_UInt pixel_height );
  2117. /*************************************************************************/
  2118. /* */
  2119. /* <Function> */
  2120. /* FT_Load_Glyph */
  2121. /* */
  2122. /* <Description> */
  2123. /* A function used to load a single glyph into the glyph slot of a */
  2124. /* face object. */
  2125. /* */
  2126. /* <InOut> */
  2127. /* face :: A handle to the target face object where the glyph */
  2128. /* is loaded. */
  2129. /* */
  2130. /* <Input> */
  2131. /* glyph_index :: The index of the glyph in the font file. For */
  2132. /* CID-keyed fonts (either in PS or in CFF format) */
  2133. /* this argument specifies the CID value. */
  2134. /* */
  2135. /* load_flags :: A flag indicating what to load for this glyph. The */
  2136. /* @FT_LOAD_XXX constants can be used to control the */
  2137. /* glyph loading process (e.g., whether the outline */
  2138. /* should be scaled, whether to load bitmaps or not, */
  2139. /* whether to hint the outline, etc). */
  2140. /* */
  2141. /* <Return> */
  2142. /* FreeType error code. 0~means success. */
  2143. /* */
  2144. /* <Note> */
  2145. /* The loaded glyph may be transformed. See @FT_Set_Transform for */
  2146. /* the details. */
  2147. /* */
  2148. /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */
  2149. /* returned for invalid CID values (this is, for CID values which */
  2150. /* don't have a corresponding glyph in the font). See the discussion */
  2151. /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */
  2152. /* */
  2153. FT_EXPORT( FT_Error )
  2154. FT_Load_Glyph( FT_Face face,
  2155. FT_UInt glyph_index,
  2156. FT_Int32 load_flags );
  2157. /*************************************************************************/
  2158. /* */
  2159. /* <Function> */
  2160. /* FT_Load_Char */
  2161. /* */
  2162. /* <Description> */
  2163. /* A function used to load a single glyph into the glyph slot of a */
  2164. /* face object, according to its character code. */
  2165. /* */
  2166. /* <InOut> */
  2167. /* face :: A handle to a target face object where the glyph */
  2168. /* is loaded. */
  2169. /* */
  2170. /* <Input> */
  2171. /* char_code :: The glyph's character code, according to the */
  2172. /* current charmap used in the face. */
  2173. /* */
  2174. /* load_flags :: A flag indicating what to load for this glyph. The */
  2175. /* @FT_LOAD_XXX constants can be used to control the */
  2176. /* glyph loading process (e.g., whether the outline */
  2177. /* should be scaled, whether to load bitmaps or not, */
  2178. /* whether to hint the outline, etc). */
  2179. /* */
  2180. /* <Return> */
  2181. /* FreeType error code. 0~means success. */
  2182. /* */
  2183. /* <Note> */
  2184. /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */
  2185. /* */
  2186. FT_EXPORT( FT_Error )
  2187. FT_Load_Char( FT_Face face,
  2188. FT_ULong char_code,
  2189. FT_Int32 load_flags );
  2190. /*************************************************************************
  2191. *
  2192. * @enum:
  2193. * FT_LOAD_XXX
  2194. *
  2195. * @description:
  2196. * A list of bit-field constants used with @FT_Load_Glyph to indicate
  2197. * what kind of operations to perform during glyph loading.
  2198. *
  2199. * @values:
  2200. * FT_LOAD_DEFAULT ::
  2201. * Corresponding to~0, this value is used as the default glyph load
  2202. * operation. In this case, the following happens:
  2203. *
  2204. * 1. FreeType looks for a bitmap for the glyph corresponding to the
  2205. * face's current size. If one is found, the function returns.
  2206. * The bitmap data can be accessed from the glyph slot (see note
  2207. * below).
  2208. *
  2209. * 2. If no embedded bitmap is searched or found, FreeType looks for a
  2210. * scalable outline. If one is found, it is loaded from the font
  2211. * file, scaled to device pixels, then `hinted' to the pixel grid
  2212. * in order to optimize it. The outline data can be accessed from
  2213. * the glyph slot (see note below).
  2214. *
  2215. * Note that by default, the glyph loader doesn't render outlines into
  2216. * bitmaps. The following flags are used to modify this default
  2217. * behaviour to more specific and useful cases.
  2218. *
  2219. * FT_LOAD_NO_SCALE ::
  2220. * Don't scale the outline glyph loaded, but keep it in font units.
  2221. *
  2222. * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
  2223. * unsets @FT_LOAD_RENDER.
  2224. *
  2225. * FT_LOAD_NO_HINTING ::
  2226. * Disable hinting. This generally generates `blurrier' bitmap glyph
  2227. * when the glyph is rendered in any of the anti-aliased modes. See
  2228. * also the note below.
  2229. *
  2230. * This flag is implied by @FT_LOAD_NO_SCALE.
  2231. *
  2232. * FT_LOAD_RENDER ::
  2233. * Call @FT_Render_Glyph after the glyph is loaded. By default, the
  2234. * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be
  2235. * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME.
  2236. *
  2237. * This flag is unset by @FT_LOAD_NO_SCALE.
  2238. *
  2239. * FT_LOAD_NO_BITMAP ::
  2240. * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this
  2241. * flag.
  2242. *
  2243. * @FT_LOAD_NO_SCALE always sets this flag.
  2244. *
  2245. * FT_LOAD_VERTICAL_LAYOUT ::
  2246. * Load the glyph for vertical text layout. _Don't_ use it as it is
  2247. * problematic currently.
  2248. *
  2249. * FT_LOAD_FORCE_AUTOHINT ::
  2250. * Indicates that the auto-hinter is preferred over the font's native
  2251. * hinter. See also the note below.
  2252. *
  2253. * FT_LOAD_CROP_BITMAP ::
  2254. * Indicates that the font driver should crop the loaded bitmap glyph
  2255. * (i.e., remove all space around its black bits). Not all drivers
  2256. * implement this.
  2257. *
  2258. * FT_LOAD_PEDANTIC ::
  2259. * Indicates that the font driver should perform pedantic verifications
  2260. * during glyph loading. This is mostly used to detect broken glyphs
  2261. * in fonts. By default, FreeType tries to handle broken fonts also.
  2262. *
  2263. * In particular, errors from the TrueType bytecode engine are not
  2264. * passed to the application if this flag is not set; this might
  2265. * result in partially hinted or distorted glyphs in case a glyph's
  2266. * bytecode is buggy.
  2267. *
  2268. * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
  2269. * Ignored. Deprecated.
  2270. *
  2271. * FT_LOAD_NO_RECURSE ::
  2272. * This flag is only used internally. It merely indicates that the
  2273. * font driver should not load composite glyphs recursively. Instead,
  2274. * it should set the `num_subglyph' and `subglyphs' values of the
  2275. * glyph slot accordingly, and set `glyph->format' to
  2276. * @FT_GLYPH_FORMAT_COMPOSITE.
  2277. *
  2278. * The description of sub-glyphs is not available to client
  2279. * applications for now.
  2280. *
  2281. * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM.
  2282. *
  2283. * FT_LOAD_IGNORE_TRANSFORM ::
  2284. * Indicates that the transform matrix set by @FT_Set_Transform should
  2285. * be ignored.
  2286. *
  2287. * FT_LOAD_MONOCHROME ::
  2288. * This flag is used with @FT_LOAD_RENDER to indicate that you want to
  2289. * render an outline glyph to a 1-bit monochrome bitmap glyph, with
  2290. * 8~pixels packed into each byte of the bitmap data.
  2291. *
  2292. * Note that this has no effect on the hinting algorithm used. You
  2293. * should rather use @FT_LOAD_TARGET_MONO so that the
  2294. * monochrome-optimized hinting algorithm is used.
  2295. *
  2296. * FT_LOAD_LINEAR_DESIGN ::
  2297. * Indicates that the `linearHoriAdvance' and `linearVertAdvance'
  2298. * fields of @FT_GlyphSlotRec should be kept in font units. See
  2299. * @FT_GlyphSlotRec for details.
  2300. *
  2301. * FT_LOAD_NO_AUTOHINT ::
  2302. * Disable auto-hinter. See also the note below.
  2303. *
  2304. * @note:
  2305. * By default, hinting is enabled and the font's native hinter (see
  2306. * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can
  2307. * disable hinting by setting @FT_LOAD_NO_HINTING or change the
  2308. * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set
  2309. * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be
  2310. * used at all.
  2311. *
  2312. * See the description of @FT_FACE_FLAG_TRICKY for a special exception
  2313. * (affecting only a handful of Asian fonts).
  2314. *
  2315. * Besides deciding which hinter to use, you can also decide which
  2316. * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
  2317. *
  2318. */
  2319. #define FT_LOAD_DEFAULT 0x0
  2320. #define FT_LOAD_NO_SCALE ( 1L << 0 )
  2321. #define FT_LOAD_NO_HINTING ( 1L << 1 )
  2322. #define FT_LOAD_RENDER ( 1L << 2 )
  2323. #define FT_LOAD_NO_BITMAP ( 1L << 3 )
  2324. #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
  2325. #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
  2326. #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
  2327. #define FT_LOAD_PEDANTIC ( 1L << 7 )
  2328. #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
  2329. #define FT_LOAD_NO_RECURSE ( 1L << 10 )
  2330. #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
  2331. #define FT_LOAD_MONOCHROME ( 1L << 12 )
  2332. #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
  2333. #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
  2334. /* */
  2335. /* used internally only by certain font drivers! */
  2336. #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
  2337. #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
  2338. /**************************************************************************
  2339. *
  2340. * @enum:
  2341. * FT_LOAD_TARGET_XXX
  2342. *
  2343. * @description:
  2344. * A list of values that are used to select a specific hinting algorithm
  2345. * to use by the hinter. You should OR one of these values to your
  2346. * `load_flags' when calling @FT_Load_Glyph.
  2347. *
  2348. * Note that font's native hinters may ignore the hinting algorithm you
  2349. * have specified (e.g., the TrueType bytecode interpreter). You can set
  2350. * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
  2351. *
  2352. * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
  2353. * always implies @FT_LOAD_FORCE_AUTOHINT.
  2354. *
  2355. * @values:
  2356. * FT_LOAD_TARGET_NORMAL ::
  2357. * This corresponds to the default hinting algorithm, optimized for
  2358. * standard gray-level rendering. For monochrome output, use
  2359. * @FT_LOAD_TARGET_MONO instead.
  2360. *
  2361. * FT_LOAD_TARGET_LIGHT ::
  2362. * A lighter hinting algorithm for non-monochrome modes. Many
  2363. * generated glyphs are more fuzzy but better resemble its original
  2364. * shape. A bit like rendering on Mac OS~X.
  2365. *
  2366. * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
  2367. *
  2368. * FT_LOAD_TARGET_MONO ::
  2369. * Strong hinting algorithm that should only be used for monochrome
  2370. * output. The result is probably unpleasant if the glyph is rendered
  2371. * in non-monochrome modes.
  2372. *
  2373. * FT_LOAD_TARGET_LCD ::
  2374. * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally
  2375. * decimated LCD displays.
  2376. *
  2377. * FT_LOAD_TARGET_LCD_V ::
  2378. * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically
  2379. * decimated LCD displays.
  2380. *
  2381. * @note:
  2382. * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your
  2383. * `load_flags'. They can't be ORed.
  2384. *
  2385. * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
  2386. * corresponding mode (i.e., the mode which matches the used algorithm
  2387. * best) unless @FT_LOAD_MONOCHROME is set.
  2388. *
  2389. * You can use a hinting algorithm that doesn't correspond to the same
  2390. * rendering mode. As an example, it is possible to use the `light'
  2391. * hinting algorithm and have the results rendered in horizontal LCD
  2392. * pixel mode, with code like
  2393. *
  2394. * {
  2395. * FT_Load_Glyph( face, glyph_index,
  2396. * load_flags | FT_LOAD_TARGET_LIGHT );
  2397. *
  2398. * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
  2399. * }
  2400. *
  2401. */
  2402. #define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 )
  2403. #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  2404. #define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT )
  2405. #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO )
  2406. #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
  2407. #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
  2408. /**************************************************************************
  2409. *
  2410. * @macro:
  2411. * FT_LOAD_TARGET_MODE
  2412. *
  2413. * @description:
  2414. * Return the @FT_Render_Mode corresponding to a given
  2415. * @FT_LOAD_TARGET_XXX value.
  2416. *
  2417. */
  2418. #define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) )
  2419. /*************************************************************************/
  2420. /* */
  2421. /* <Function> */
  2422. /* FT_Set_Transform */
  2423. /* */
  2424. /* <Description> */
  2425. /* A function used to set the transformation that is applied to glyph */
  2426. /* images when they are loaded into a glyph slot through */
  2427. /* @FT_Load_Glyph. */
  2428. /* */
  2429. /* <InOut> */
  2430. /* face :: A handle to the source face object. */
  2431. /* */
  2432. /* <Input> */
  2433. /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */
  2434. /* the identity matrix. */
  2435. /* delta :: A pointer to the translation vector. Use~0 for the null */
  2436. /* vector. */
  2437. /* */
  2438. /* <Note> */
  2439. /* The transformation is only applied to scalable image formats after */
  2440. /* the glyph has been loaded. It means that hinting is unaltered by */
  2441. /* the transformation and is performed on the character size given in */
  2442. /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
  2443. /* */
  2444. /* Note that this also transforms the `face.glyph.advance' field, but */
  2445. /* *not* the values in `face.glyph.metrics'. */
  2446. /* */
  2447. FT_EXPORT( void )
  2448. FT_Set_Transform( FT_Face face,
  2449. FT_Matrix* matrix,
  2450. FT_Vector* delta );
  2451. /*************************************************************************/
  2452. /* */
  2453. /* <Enum> */
  2454. /* FT_Render_Mode */
  2455. /* */
  2456. /* <Description> */
  2457. /* An enumeration type that lists the render modes supported by */
  2458. /* FreeType~2. Each mode corresponds to a specific type of scanline */
  2459. /* conversion performed on the outline. */
  2460. /* */
  2461. /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */
  2462. /* field in the @FT_GlyphSlotRec structure gives the format of the */
  2463. /* returned bitmap. */
  2464. /* */
  2465. /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */
  2466. /* */
  2467. /* <Values> */
  2468. /* FT_RENDER_MODE_NORMAL :: */
  2469. /* This is the default render mode; it corresponds to 8-bit */
  2470. /* anti-aliased bitmaps. */
  2471. /* */
  2472. /* FT_RENDER_MODE_LIGHT :: */
  2473. /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */
  2474. /* defined as a separate value because render modes are also used */
  2475. /* indirectly to define hinting algorithm selectors. See */
  2476. /* @FT_LOAD_TARGET_XXX for details. */
  2477. /* */
  2478. /* FT_RENDER_MODE_MONO :: */
  2479. /* This mode corresponds to 1-bit bitmaps (with 2~levels of */
  2480. /* opacity). */
  2481. /* */
  2482. /* FT_RENDER_MODE_LCD :: */
  2483. /* This mode corresponds to horizontal RGB and BGR sub-pixel */
  2484. /* displays like LCD screens. It produces 8-bit bitmaps that are */
  2485. /* 3~times the width of the original glyph outline in pixels, and */
  2486. /* which use the @FT_PIXEL_MODE_LCD mode. */
  2487. /* */
  2488. /* FT_RENDER_MODE_LCD_V :: */
  2489. /* This mode corresponds to vertical RGB and BGR sub-pixel displays */
  2490. /* (like PDA screens, rotated LCD displays, etc.). It produces */
  2491. /* 8-bit bitmaps that are 3~times the height of the original */
  2492. /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
  2493. /* */
  2494. /* <Note> */
  2495. /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */
  2496. /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */
  2497. /* (not active in the default builds). It is up to the caller to */
  2498. /* either call @FT_Library_SetLcdFilter (if available) or do the */
  2499. /* filtering itself. */
  2500. /* */
  2501. /* The selected render mode only affects vector glyphs of a font. */
  2502. /* Embedded bitmaps often have a different pixel mode like */
  2503. /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */
  2504. /* them into 8-bit pixmaps. */
  2505. /* */
  2506. typedef enum FT_Render_Mode_
  2507. {
  2508. FT_RENDER_MODE_NORMAL = 0,
  2509. FT_RENDER_MODE_LIGHT,
  2510. FT_RENDER_MODE_MONO,
  2511. FT_RENDER_MODE_LCD,
  2512. FT_RENDER_MODE_LCD_V,
  2513. FT_RENDER_MODE_MAX
  2514. } FT_Render_Mode;
  2515. /*************************************************************************/
  2516. /* */
  2517. /* <Enum> */
  2518. /* ft_render_mode_xxx */
  2519. /* */
  2520. /* <Description> */
  2521. /* These constants are deprecated. Use the corresponding */
  2522. /* @FT_Render_Mode values instead. */
  2523. /* */
  2524. /* <Values> */
  2525. /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */
  2526. /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */
  2527. /* */
  2528. #define ft_render_mode_normal FT_RENDER_MODE_NORMAL
  2529. #define ft_render_mode_mono FT_RENDER_MODE_MONO
  2530. /*************************************************************************/
  2531. /* */
  2532. /* <Function> */
  2533. /* FT_Render_Glyph */
  2534. /* */
  2535. /* <Description> */
  2536. /* Convert a given glyph image to a bitmap. It does so by inspecting */
  2537. /* the glyph image format, finding the relevant renderer, and */
  2538. /* invoking it. */
  2539. /* */
  2540. /* <InOut> */
  2541. /* slot :: A handle to the glyph slot containing the image to */
  2542. /* convert. */
  2543. /* */
  2544. /* <Input> */
  2545. /* render_mode :: This is the render mode used to render the glyph */
  2546. /* image into a bitmap. See @FT_Render_Mode for a */
  2547. /* list of possible values. */
  2548. /* */
  2549. /* <Return> */
  2550. /* FreeType error code. 0~means success. */
  2551. /* */
  2552. FT_EXPORT( FT_Error )
  2553. FT_Render_Glyph( FT_GlyphSlot slot,
  2554. FT_Render_Mode render_mode );
  2555. /*************************************************************************/
  2556. /* */
  2557. /* <Enum> */
  2558. /* FT_Kerning_Mode */
  2559. /* */
  2560. /* <Description> */
  2561. /* An enumeration used to specify which kerning values to return in */
  2562. /* @FT_Get_Kerning. */
  2563. /* */
  2564. /* <Values> */
  2565. /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */
  2566. /* distances (value is~0). */
  2567. /* */
  2568. /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */
  2569. /* distances. */
  2570. /* */
  2571. /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */
  2572. /* units. */
  2573. /* */
  2574. typedef enum FT_Kerning_Mode_
  2575. {
  2576. FT_KERNING_DEFAULT = 0,
  2577. FT_KERNING_UNFITTED,
  2578. FT_KERNING_UNSCALED
  2579. } FT_Kerning_Mode;
  2580. /*************************************************************************/
  2581. /* */
  2582. /* <Const> */
  2583. /* ft_kerning_default */
  2584. /* */
  2585. /* <Description> */
  2586. /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */
  2587. /* instead. */
  2588. /* */
  2589. #define ft_kerning_default FT_KERNING_DEFAULT
  2590. /*************************************************************************/
  2591. /* */
  2592. /* <Const> */
  2593. /* ft_kerning_unfitted */
  2594. /* */
  2595. /* <Description> */
  2596. /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */
  2597. /* instead. */
  2598. /* */
  2599. #define ft_kerning_unfitted FT_KERNING_UNFITTED
  2600. /*************************************************************************/
  2601. /* */
  2602. /* <Const> */
  2603. /* ft_kerning_unscaled */
  2604. /* */
  2605. /* <Description> */
  2606. /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */
  2607. /* instead. */
  2608. /* */
  2609. #define ft_kerning_unscaled FT_KERNING_UNSCALED
  2610. /*************************************************************************/
  2611. /* */
  2612. /* <Function> */
  2613. /* FT_Get_Kerning */
  2614. /* */
  2615. /* <Description> */
  2616. /* Return the kerning vector between two glyphs of a same face. */
  2617. /* */
  2618. /* <Input> */
  2619. /* face :: A handle to a source face object. */
  2620. /* */
  2621. /* left_glyph :: The index of the left glyph in the kern pair. */
  2622. /* */
  2623. /* right_glyph :: The index of the right glyph in the kern pair. */
  2624. /* */
  2625. /* kern_mode :: See @FT_Kerning_Mode for more information. */
  2626. /* Determines the scale and dimension of the returned */
  2627. /* kerning vector. */
  2628. /* */
  2629. /* <Output> */
  2630. /* akerning :: The kerning vector. This is either in font units */
  2631. /* or in pixels (26.6 format) for scalable formats, */
  2632. /* and in pixels for fixed-sizes formats. */
  2633. /* */
  2634. /* <Return> */
  2635. /* FreeType error code. 0~means success. */
  2636. /* */
  2637. /* <Note> */
  2638. /* Only horizontal layouts (left-to-right & right-to-left) are */
  2639. /* supported by this method. Other layouts, or more sophisticated */
  2640. /* kernings, are out of the scope of this API function -- they can be */
  2641. /* implemented through format-specific interfaces. */
  2642. /* */
  2643. FT_EXPORT( FT_Error )
  2644. FT_Get_Kerning( FT_Face face,
  2645. FT_UInt left_glyph,
  2646. FT_UInt right_glyph,
  2647. FT_UInt kern_mode,
  2648. FT_Vector *akerning );
  2649. /*************************************************************************/
  2650. /* */
  2651. /* <Function> */
  2652. /* FT_Get_Track_Kerning */
  2653. /* */
  2654. /* <Description> */
  2655. /* Return the track kerning for a given face object at a given size. */
  2656. /* */
  2657. /* <Input> */
  2658. /* face :: A handle to a source face object. */
  2659. /* */
  2660. /* point_size :: The point size in 16.16 fractional points. */
  2661. /* */
  2662. /* degree :: The degree of tightness. Increasingly negative */
  2663. /* values represent tighter track kerning, while */
  2664. /* increasingly positive values represent looser track */
  2665. /* kerning. Value zero means no track kerning. */
  2666. /* */
  2667. /* <Output> */
  2668. /* akerning :: The kerning in 16.16 fractional points, to be */
  2669. /* uniformly applied between all glyphs. */
  2670. /* */
  2671. /* <Return> */
  2672. /* FreeType error code. 0~means success. */
  2673. /* */
  2674. /* <Note> */
  2675. /* Currently, only the Type~1 font driver supports track kerning, */
  2676. /* using data from AFM files (if attached with @FT_Attach_File or */
  2677. /* @FT_Attach_Stream). */
  2678. /* */
  2679. /* Only very few AFM files come with track kerning data; please refer */
  2680. /* to the Adobe's AFM specification for more details. */
  2681. /* */
  2682. FT_EXPORT( FT_Error )
  2683. FT_Get_Track_Kerning( FT_Face face,
  2684. FT_Fixed point_size,
  2685. FT_Int degree,
  2686. FT_Fixed* akerning );
  2687. /*************************************************************************/
  2688. /* */
  2689. /* <Function> */
  2690. /* FT_Get_Glyph_Name */
  2691. /* */
  2692. /* <Description> */
  2693. /* Retrieve the ASCII name of a given glyph in a face. This only */
  2694. /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */
  2695. /* */
  2696. /* <Input> */
  2697. /* face :: A handle to a source face object. */
  2698. /* */
  2699. /* glyph_index :: The glyph index. */
  2700. /* */
  2701. /* buffer_max :: The maximal number of bytes available in the */
  2702. /* buffer. */
  2703. /* */
  2704. /* <Output> */
  2705. /* buffer :: A pointer to a target buffer where the name is */
  2706. /* copied to. */
  2707. /* */
  2708. /* <Return> */
  2709. /* FreeType error code. 0~means success. */
  2710. /* */
  2711. /* <Note> */
  2712. /* An error is returned if the face doesn't provide glyph names or if */
  2713. /* the glyph index is invalid. In all cases of failure, the first */
  2714. /* byte of `buffer' is set to~0 to indicate an empty name. */
  2715. /* */
  2716. /* The glyph name is truncated to fit within the buffer if it is too */
  2717. /* long. The returned string is always zero-terminated. */
  2718. /* */
  2719. /* Be aware that FreeType reorders glyph indices internally so that */
  2720. /* glyph index~0 always corresponds to the `missing glyph' (called */
  2721. /* `.notdef'). */
  2722. /* */
  2723. /* This function is not compiled within the library if the config */
  2724. /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */
  2725. /* `include/freetype/config/ftoptions.h'. */
  2726. /* */
  2727. FT_EXPORT( FT_Error )
  2728. FT_Get_Glyph_Name( FT_Face face,
  2729. FT_UInt glyph_index,
  2730. FT_Pointer buffer,
  2731. FT_UInt buffer_max );
  2732. /*************************************************************************/
  2733. /* */
  2734. /* <Function> */
  2735. /* FT_Get_Postscript_Name */
  2736. /* */
  2737. /* <Description> */
  2738. /* Retrieve the ASCII PostScript name of a given face, if available. */
  2739. /* This only works with PostScript and TrueType fonts. */
  2740. /* */
  2741. /* <Input> */
  2742. /* face :: A handle to the source face object. */
  2743. /* */
  2744. /* <Return> */
  2745. /* A pointer to the face's PostScript name. NULL if unavailable. */
  2746. /* */
  2747. /* <Note> */
  2748. /* The returned pointer is owned by the face and is destroyed with */
  2749. /* it. */
  2750. /* */
  2751. FT_EXPORT( const char* )
  2752. FT_Get_Postscript_Name( FT_Face face );
  2753. /*************************************************************************/
  2754. /* */
  2755. /* <Function> */
  2756. /* FT_Select_Charmap */
  2757. /* */
  2758. /* <Description> */
  2759. /* Select a given charmap by its encoding tag (as listed in */
  2760. /* `freetype.h'). */
  2761. /* */
  2762. /* <InOut> */
  2763. /* face :: A handle to the source face object. */
  2764. /* */
  2765. /* <Input> */
  2766. /* encoding :: A handle to the selected encoding. */
  2767. /* */
  2768. /* <Return> */
  2769. /* FreeType error code. 0~means success. */
  2770. /* */
  2771. /* <Note> */
  2772. /* This function returns an error if no charmap in the face */
  2773. /* corresponds to the encoding queried here. */
  2774. /* */
  2775. /* Because many fonts contain more than a single cmap for Unicode */
  2776. /* encoding, this function has some special code to select the one */
  2777. /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */
  2778. /* is preferred to a UCS-2 cmap). It is thus preferable to */
  2779. /* @FT_Set_Charmap in this case. */
  2780. /* */
  2781. FT_EXPORT( FT_Error )
  2782. FT_Select_Charmap( FT_Face face,
  2783. FT_Encoding encoding );
  2784. /*************************************************************************/
  2785. /* */
  2786. /* <Function> */
  2787. /* FT_Set_Charmap */
  2788. /* */
  2789. /* <Description> */
  2790. /* Select a given charmap for character code to glyph index mapping. */
  2791. /* */
  2792. /* <InOut> */
  2793. /* face :: A handle to the source face object. */
  2794. /* */
  2795. /* <Input> */
  2796. /* charmap :: A handle to the selected charmap. */
  2797. /* */
  2798. /* <Return> */
  2799. /* FreeType error code. 0~means success. */
  2800. /* */
  2801. /* <Note> */
  2802. /* This function returns an error if the charmap is not part of */
  2803. /* the face (i.e., if it is not listed in the `face->charmaps' */
  2804. /* table). */
  2805. /* */
  2806. /* It also fails if a type~14 charmap is selected. */
  2807. /* */
  2808. FT_EXPORT( FT_Error )
  2809. FT_Set_Charmap( FT_Face face,
  2810. FT_CharMap charmap );
  2811. /*************************************************************************
  2812. *
  2813. * @function:
  2814. * FT_Get_Charmap_Index
  2815. *
  2816. * @description:
  2817. * Retrieve index of a given charmap.
  2818. *
  2819. * @input:
  2820. * charmap ::
  2821. * A handle to a charmap.
  2822. *
  2823. * @return:
  2824. * The index into the array of character maps within the face to which
  2825. * `charmap' belongs. If an error occurs, -1 is returned.
  2826. *
  2827. */
  2828. FT_EXPORT( FT_Int )
  2829. FT_Get_Charmap_Index( FT_CharMap charmap );
  2830. /*************************************************************************/
  2831. /* */
  2832. /* <Function> */
  2833. /* FT_Get_Char_Index */
  2834. /* */
  2835. /* <Description> */
  2836. /* Return the glyph index of a given character code. This function */
  2837. /* uses a charmap object to do the mapping. */
  2838. /* */
  2839. /* <Input> */
  2840. /* face :: A handle to the source face object. */
  2841. /* */
  2842. /* charcode :: The character code. */
  2843. /* */
  2844. /* <Return> */
  2845. /* The glyph index. 0~means `undefined character code'. */
  2846. /* */
  2847. /* <Note> */
  2848. /* If you use FreeType to manipulate the contents of font files */
  2849. /* directly, be aware that the glyph index returned by this function */
  2850. /* doesn't always correspond to the internal indices used within */
  2851. /* the file. This is done to ensure that value~0 always corresponds */
  2852. /* to the `missing glyph'. */
  2853. /* */
  2854. FT_EXPORT( FT_UInt )
  2855. FT_Get_Char_Index( FT_Face face,
  2856. FT_ULong charcode );
  2857. /*************************************************************************/
  2858. /* */
  2859. /* <Function> */
  2860. /* FT_Get_First_Char */
  2861. /* */
  2862. /* <Description> */
  2863. /* This function is used to return the first character code in the */
  2864. /* current charmap of a given face. It also returns the */
  2865. /* corresponding glyph index. */
  2866. /* */
  2867. /* <Input> */
  2868. /* face :: A handle to the source face object. */
  2869. /* */
  2870. /* <Output> */
  2871. /* agindex :: Glyph index of first character code. 0~if charmap is */
  2872. /* empty. */
  2873. /* */
  2874. /* <Return> */
  2875. /* The charmap's first character code. */
  2876. /* */
  2877. /* <Note> */
  2878. /* You should use this function with @FT_Get_Next_Char to be able to */
  2879. /* parse all character codes available in a given charmap. The code */
  2880. /* should look like this: */
  2881. /* */
  2882. /* { */
  2883. /* FT_ULong charcode; */
  2884. /* FT_UInt gindex; */
  2885. /* */
  2886. /* */
  2887. /* charcode = FT_Get_First_Char( face, &gindex ); */
  2888. /* while ( gindex != 0 ) */
  2889. /* { */
  2890. /* ... do something with (charcode,gindex) pair ... */
  2891. /* */
  2892. /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */
  2893. /* } */
  2894. /* } */
  2895. /* */
  2896. /* Note that `*agindex' is set to~0 if the charmap is empty. The */
  2897. /* result itself can be~0 in two cases: if the charmap is empty or */
  2898. /* if the value~0 is the first valid character code. */
  2899. /* */
  2900. FT_EXPORT( FT_ULong )
  2901. FT_Get_First_Char( FT_Face face,
  2902. FT_UInt *agindex );
  2903. /*************************************************************************/
  2904. /* */
  2905. /* <Function> */
  2906. /* FT_Get_Next_Char */
  2907. /* */
  2908. /* <Description> */
  2909. /* This function is used to return the next character code in the */
  2910. /* current charmap of a given face following the value `char_code', */
  2911. /* as well as the corresponding glyph index. */
  2912. /* */
  2913. /* <Input> */
  2914. /* face :: A handle to the source face object. */
  2915. /* char_code :: The starting character code. */
  2916. /* */
  2917. /* <Output> */
  2918. /* agindex :: Glyph index of next character code. 0~if charmap */
  2919. /* is empty. */
  2920. /* */
  2921. /* <Return> */
  2922. /* The charmap's next character code. */
  2923. /* */
  2924. /* <Note> */
  2925. /* You should use this function with @FT_Get_First_Char to walk */
  2926. /* over all character codes available in a given charmap. See the */
  2927. /* note for this function for a simple code example. */
  2928. /* */
  2929. /* Note that `*agindex' is set to~0 when there are no more codes in */
  2930. /* the charmap. */
  2931. /* */
  2932. FT_EXPORT( FT_ULong )
  2933. FT_Get_Next_Char( FT_Face face,
  2934. FT_ULong char_code,
  2935. FT_UInt *agindex );
  2936. /*************************************************************************/
  2937. /* */
  2938. /* <Function> */
  2939. /* FT_Get_Name_Index */
  2940. /* */
  2941. /* <Description> */
  2942. /* Return the glyph index of a given glyph name. This function uses */
  2943. /* driver specific objects to do the translation. */
  2944. /* */
  2945. /* <Input> */
  2946. /* face :: A handle to the source face object. */
  2947. /* */
  2948. /* glyph_name :: The glyph name. */
  2949. /* */
  2950. /* <Return> */
  2951. /* The glyph index. 0~means `undefined character code'. */
  2952. /* */
  2953. FT_EXPORT( FT_UInt )
  2954. FT_Get_Name_Index( FT_Face face,
  2955. FT_String* glyph_name );
  2956. /*************************************************************************
  2957. *
  2958. * @macro:
  2959. * FT_SUBGLYPH_FLAG_XXX
  2960. *
  2961. * @description:
  2962. * A list of constants used to describe subglyphs. Please refer to the
  2963. * TrueType specification for the meaning of the various flags.
  2964. *
  2965. * @values:
  2966. * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ::
  2967. * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ::
  2968. * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID ::
  2969. * FT_SUBGLYPH_FLAG_SCALE ::
  2970. * FT_SUBGLYPH_FLAG_XY_SCALE ::
  2971. * FT_SUBGLYPH_FLAG_2X2 ::
  2972. * FT_SUBGLYPH_FLAG_USE_MY_METRICS ::
  2973. *
  2974. */
  2975. #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
  2976. #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
  2977. #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
  2978. #define FT_SUBGLYPH_FLAG_SCALE 8
  2979. #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
  2980. #define FT_SUBGLYPH_FLAG_2X2 0x80
  2981. #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
  2982. /*************************************************************************
  2983. *
  2984. * @func:
  2985. * FT_Get_SubGlyph_Info
  2986. *
  2987. * @description:
  2988. * Retrieve a description of a given subglyph. Only use it if
  2989. * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is
  2990. * returned otherwise.
  2991. *
  2992. * @input:
  2993. * glyph ::
  2994. * The source glyph slot.
  2995. *
  2996. * sub_index ::
  2997. * The index of the subglyph. Must be less than
  2998. * `glyph->num_subglyphs'.
  2999. *
  3000. * @output:
  3001. * p_index ::
  3002. * The glyph index of the subglyph.
  3003. *
  3004. * p_flags ::
  3005. * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX.
  3006. *
  3007. * p_arg1 ::
  3008. * The subglyph's first argument (if any).
  3009. *
  3010. * p_arg2 ::
  3011. * The subglyph's second argument (if any).
  3012. *
  3013. * p_transform ::
  3014. * The subglyph transformation (if any).
  3015. *
  3016. * @return:
  3017. * FreeType error code. 0~means success.
  3018. *
  3019. * @note:
  3020. * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be
  3021. * interpreted depending on the flags returned in `*p_flags'. See the
  3022. * TrueType specification for details.
  3023. *
  3024. */
  3025. FT_EXPORT( FT_Error )
  3026. FT_Get_SubGlyph_Info( FT_GlyphSlot glyph,
  3027. FT_UInt sub_index,
  3028. FT_Int *p_index,
  3029. FT_UInt *p_flags,
  3030. FT_Int *p_arg1,
  3031. FT_Int *p_arg2,
  3032. FT_Matrix *p_transform );
  3033. /*************************************************************************/
  3034. /* */
  3035. /* <Enum> */
  3036. /* FT_FSTYPE_XXX */
  3037. /* */
  3038. /* <Description> */
  3039. /* A list of bit flags used in the `fsType' field of the OS/2 table */
  3040. /* in a TrueType or OpenType font and the `FSType' entry in a */
  3041. /* PostScript font. These bit flags are returned by */
  3042. /* @FT_Get_FSType_Flags; they inform client applications of embedding */
  3043. /* and subsetting restrictions associated with a font. */
  3044. /* */
  3045. /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */
  3046. /* more details. */
  3047. /* */
  3048. /* <Values> */
  3049. /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */
  3050. /* Fonts with no fsType bit set may be embedded and permanently */
  3051. /* installed on the remote system by an application. */
  3052. /* */
  3053. /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */
  3054. /* Fonts that have only this bit set must not be modified, embedded */
  3055. /* or exchanged in any manner without first obtaining permission of */
  3056. /* the font software copyright owner. */
  3057. /* */
  3058. /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */
  3059. /* If this bit is set, the font may be embedded and temporarily */
  3060. /* loaded on the remote system. Documents containing Preview & */
  3061. /* Print fonts must be opened `read-only'; no edits can be applied */
  3062. /* to the document. */
  3063. /* */
  3064. /* FT_FSTYPE_EDITABLE_EMBEDDING :: */
  3065. /* If this bit is set, the font may be embedded but must only be */
  3066. /* installed temporarily on other systems. In contrast to Preview */
  3067. /* & Print fonts, documents containing editable fonts may be opened */
  3068. /* for reading, editing is permitted, and changes may be saved. */
  3069. /* */
  3070. /* FT_FSTYPE_NO_SUBSETTING :: */
  3071. /* If this bit is set, the font may not be subsetted prior to */
  3072. /* embedding. */
  3073. /* */
  3074. /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */
  3075. /* If this bit is set, only bitmaps contained in the font may be */
  3076. /* embedded; no outline data may be embedded. If there are no */
  3077. /* bitmaps available in the font, then the font is unembeddable. */
  3078. /* */
  3079. /* <Note> */
  3080. /* While the fsType flags can indicate that a font may be embedded, a */
  3081. /* license with the font vendor may be separately required to use the */
  3082. /* font in this way. */
  3083. /* */
  3084. #define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000
  3085. #define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002
  3086. #define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004
  3087. #define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008
  3088. #define FT_FSTYPE_NO_SUBSETTING 0x0100
  3089. #define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200
  3090. /*************************************************************************/
  3091. /* */
  3092. /* <Function> */
  3093. /* FT_Get_FSType_Flags */
  3094. /* */
  3095. /* <Description> */
  3096. /* Return the fsType flags for a font. */
  3097. /* */
  3098. /* <Input> */
  3099. /* face :: A handle to the source face object. */
  3100. /* */
  3101. /* <Return> */
  3102. /* The fsType flags, @FT_FSTYPE_XXX. */
  3103. /* */
  3104. /* <Note> */
  3105. /* Use this function rather than directly reading the `fs_type' field */
  3106. /* in the @PS_FontInfoRec structure which is only guaranteed to */
  3107. /* return the correct results for Type~1 fonts. */
  3108. /* */
  3109. /* <Since> */
  3110. /* 2.3.8 */
  3111. /* */
  3112. FT_EXPORT( FT_UShort )
  3113. FT_Get_FSType_Flags( FT_Face face );
  3114. /*************************************************************************/
  3115. /* */
  3116. /* <Section> */
  3117. /* glyph_variants */
  3118. /* */
  3119. /* <Title> */
  3120. /* Glyph Variants */
  3121. /* */
  3122. /* <Abstract> */
  3123. /* The FreeType~2 interface to Unicode Ideographic Variation */
  3124. /* Sequences (IVS), using the SFNT cmap format~14. */
  3125. /* */
  3126. /* <Description> */
  3127. /* Many CJK characters have variant forms. They are a sort of grey */
  3128. /* area somewhere between being totally irrelevant and semantically */
  3129. /* distinct; for this reason, the Unicode consortium decided to */
  3130. /* introduce Ideographic Variation Sequences (IVS), consisting of a */
  3131. /* Unicode base character and one of 240 variant selectors */
  3132. /* (U+E0100-U+E01EF), instead of further extending the already huge */
  3133. /* code range for CJK characters. */
  3134. /* */
  3135. /* An IVS is registered and unique; for further details please refer */
  3136. /* to Unicode Technical Report #37, the Ideographic Variation */
  3137. /* Database. To date (October 2007), the character with the most */
  3138. /* variants is U+908A, having 8~such IVS. */
  3139. /* */
  3140. /* Adobe and MS decided to support IVS with a new cmap subtable */
  3141. /* (format~14). It is an odd subtable because it is not a mapping of */
  3142. /* input code points to glyphs, but contains lists of all variants */
  3143. /* supported by the font. */
  3144. /* */
  3145. /* A variant may be either `default' or `non-default'. A default */
  3146. /* variant is the one you will get for that code point if you look it */
  3147. /* up in the standard Unicode cmap. A non-default variant is a */
  3148. /* different glyph. */
  3149. /* */
  3150. /*************************************************************************/
  3151. /*************************************************************************/
  3152. /* */
  3153. /* <Function> */
  3154. /* FT_Face_GetCharVariantIndex */
  3155. /* */
  3156. /* <Description> */
  3157. /* Return the glyph index of a given character code as modified by */
  3158. /* the variation selector. */
  3159. /* */
  3160. /* <Input> */
  3161. /* face :: */
  3162. /* A handle to the source face object. */
  3163. /* */
  3164. /* charcode :: */
  3165. /* The character code point in Unicode. */
  3166. /* */
  3167. /* variantSelector :: */
  3168. /* The Unicode code point of the variation selector. */
  3169. /* */
  3170. /* <Return> */
  3171. /* The glyph index. 0~means either `undefined character code', or */
  3172. /* `undefined selector code', or `no variation selector cmap */
  3173. /* subtable', or `current CharMap is not Unicode'. */
  3174. /* */
  3175. /* <Note> */
  3176. /* If you use FreeType to manipulate the contents of font files */
  3177. /* directly, be aware that the glyph index returned by this function */
  3178. /* doesn't always correspond to the internal indices used within */
  3179. /* the file. This is done to ensure that value~0 always corresponds */
  3180. /* to the `missing glyph'. */
  3181. /* */
  3182. /* This function is only meaningful if */
  3183. /* a) the font has a variation selector cmap sub table, */
  3184. /* and */
  3185. /* b) the current charmap has a Unicode encoding. */
  3186. /* */
  3187. /* <Since> */
  3188. /* 2.3.6 */
  3189. /* */
  3190. FT_EXPORT( FT_UInt )
  3191. FT_Face_GetCharVariantIndex( FT_Face face,
  3192. FT_ULong charcode,
  3193. FT_ULong variantSelector );
  3194. /*************************************************************************/
  3195. /* */
  3196. /* <Function> */
  3197. /* FT_Face_GetCharVariantIsDefault */
  3198. /* */
  3199. /* <Description> */
  3200. /* Check whether this variant of this Unicode character is the one to */
  3201. /* be found in the `cmap'. */
  3202. /* */
  3203. /* <Input> */
  3204. /* face :: */
  3205. /* A handle to the source face object. */
  3206. /* */
  3207. /* charcode :: */
  3208. /* The character codepoint in Unicode. */
  3209. /* */
  3210. /* variantSelector :: */
  3211. /* The Unicode codepoint of the variation selector. */
  3212. /* */
  3213. /* <Return> */
  3214. /* 1~if found in the standard (Unicode) cmap, 0~if found in the */
  3215. /* variation selector cmap, or -1 if it is not a variant. */
  3216. /* */
  3217. /* <Note> */
  3218. /* This function is only meaningful if the font has a variation */
  3219. /* selector cmap subtable. */
  3220. /* */
  3221. /* <Since> */
  3222. /* 2.3.6 */
  3223. /* */
  3224. FT_EXPORT( FT_Int )
  3225. FT_Face_GetCharVariantIsDefault( FT_Face face,
  3226. FT_ULong charcode,
  3227. FT_ULong variantSelector );
  3228. /*************************************************************************/
  3229. /* */
  3230. /* <Function> */
  3231. /* FT_Face_GetVariantSelectors */
  3232. /* */
  3233. /* <Description> */
  3234. /* Return a zero-terminated list of Unicode variant selectors found */
  3235. /* in the font. */
  3236. /* */
  3237. /* <Input> */
  3238. /* face :: */
  3239. /* A handle to the source face object. */
  3240. /* */
  3241. /* <Return> */
  3242. /* A pointer to an array of selector code points, or NULL if there is */
  3243. /* no valid variant selector cmap subtable. */
  3244. /* */
  3245. /* <Note> */
  3246. /* The last item in the array is~0; the array is owned by the */
  3247. /* @FT_Face object but can be overwritten or released on the next */
  3248. /* call to a FreeType function. */
  3249. /* */
  3250. /* <Since> */
  3251. /* 2.3.6 */
  3252. /* */
  3253. FT_EXPORT( FT_UInt32* )
  3254. FT_Face_GetVariantSelectors( FT_Face face );
  3255. /*************************************************************************/
  3256. /* */
  3257. /* <Function> */
  3258. /* FT_Face_GetVariantsOfChar */
  3259. /* */
  3260. /* <Description> */
  3261. /* Return a zero-terminated list of Unicode variant selectors found */
  3262. /* for the specified character code. */
  3263. /* */
  3264. /* <Input> */
  3265. /* face :: */
  3266. /* A handle to the source face object. */
  3267. /* */
  3268. /* charcode :: */
  3269. /* The character codepoint in Unicode. */
  3270. /* */
  3271. /* <Return> */
  3272. /* A pointer to an array of variant selector code points which are */
  3273. /* active for the given character, or NULL if the corresponding list */
  3274. /* is empty. */
  3275. /* */
  3276. /* <Note> */
  3277. /* The last item in the array is~0; the array is owned by the */
  3278. /* @FT_Face object but can be overwritten or released on the next */
  3279. /* call to a FreeType function. */
  3280. /* */
  3281. /* <Since> */
  3282. /* 2.3.6 */
  3283. /* */
  3284. FT_EXPORT( FT_UInt32* )
  3285. FT_Face_GetVariantsOfChar( FT_Face face,
  3286. FT_ULong charcode );
  3287. /*************************************************************************/
  3288. /* */
  3289. /* <Function> */
  3290. /* FT_Face_GetCharsOfVariant */
  3291. /* */
  3292. /* <Description> */
  3293. /* Return a zero-terminated list of Unicode character codes found for */
  3294. /* the specified variant selector. */
  3295. /* */
  3296. /* <Input> */
  3297. /* face :: */
  3298. /* A handle to the source face object. */
  3299. /* */
  3300. /* variantSelector :: */
  3301. /* The variant selector code point in Unicode. */
  3302. /* */
  3303. /* <Return> */
  3304. /* A list of all the code points which are specified by this selector */
  3305. /* (both default and non-default codes are returned) or NULL if there */
  3306. /* is no valid cmap or the variant selector is invalid. */
  3307. /* */
  3308. /* <Note> */
  3309. /* The last item in the array is~0; the array is owned by the */
  3310. /* @FT_Face object but can be overwritten or released on the next */
  3311. /* call to a FreeType function. */
  3312. /* */
  3313. /* <Since> */
  3314. /* 2.3.6 */
  3315. /* */
  3316. FT_EXPORT( FT_UInt32* )
  3317. FT_Face_GetCharsOfVariant( FT_Face face,
  3318. FT_ULong variantSelector );
  3319. /*************************************************************************/
  3320. /* */
  3321. /* <Section> */
  3322. /* computations */
  3323. /* */
  3324. /* <Title> */
  3325. /* Computations */
  3326. /* */
  3327. /* <Abstract> */
  3328. /* Crunching fixed numbers and vectors. */
  3329. /* */
  3330. /* <Description> */
  3331. /* This section contains various functions used to perform */
  3332. /* computations on 16.16 fixed-float numbers or 2d vectors. */
  3333. /* */
  3334. /* <Order> */
  3335. /* FT_MulDiv */
  3336. /* FT_MulFix */
  3337. /* FT_DivFix */
  3338. /* FT_RoundFix */
  3339. /* FT_CeilFix */
  3340. /* FT_FloorFix */
  3341. /* FT_Vector_Transform */
  3342. /* FT_Matrix_Multiply */
  3343. /* FT_Matrix_Invert */
  3344. /* */
  3345. /*************************************************************************/
  3346. /*************************************************************************/
  3347. /* */
  3348. /* <Function> */
  3349. /* FT_MulDiv */
  3350. /* */
  3351. /* <Description> */
  3352. /* A very simple function used to perform the computation `(a*b)/c' */
  3353. /* with maximal accuracy (it uses a 64-bit intermediate integer */
  3354. /* whenever necessary). */
  3355. /* */
  3356. /* This function isn't necessarily as fast as some processor specific */
  3357. /* operations, but is at least completely portable. */
  3358. /* */
  3359. /* <Input> */
  3360. /* a :: The first multiplier. */
  3361. /* b :: The second multiplier. */
  3362. /* c :: The divisor. */
  3363. /* */
  3364. /* <Return> */
  3365. /* The result of `(a*b)/c'. This function never traps when trying to */
  3366. /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
  3367. /* on the signs of `a' and `b'. */
  3368. /* */
  3369. FT_EXPORT( FT_Long )
  3370. FT_MulDiv( FT_Long a,
  3371. FT_Long b,
  3372. FT_Long c );
  3373. /* */
  3374. /* The following #if 0 ... #endif is for the documentation formatter, */
  3375. /* hiding the internal `FT_MULFIX_INLINED' macro. */
  3376. #if 0
  3377. /*************************************************************************/
  3378. /* */
  3379. /* <Function> */
  3380. /* FT_MulFix */
  3381. /* */
  3382. /* <Description> */
  3383. /* A very simple function used to perform the computation */
  3384. /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */
  3385. /* used to multiply a given value by a 16.16 fixed float factor. */
  3386. /* */
  3387. /* <Input> */
  3388. /* a :: The first multiplier. */
  3389. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  3390. /* possible (see note below). */
  3391. /* */
  3392. /* <Return> */
  3393. /* The result of `(a*b)/0x10000'. */
  3394. /* */
  3395. /* <Note> */
  3396. /* This function has been optimized for the case where the absolute */
  3397. /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
  3398. /* As this happens mainly when scaling from notional units to */
  3399. /* fractional pixels in FreeType, it resulted in noticeable speed */
  3400. /* improvements between versions 2.x and 1.x. */
  3401. /* */
  3402. /* As a conclusion, always try to place a 16.16 factor as the */
  3403. /* _second_ argument of this function; this can make a great */
  3404. /* difference. */
  3405. /* */
  3406. FT_EXPORT( FT_Long )
  3407. FT_MulFix( FT_Long a,
  3408. FT_Long b );
  3409. /* */
  3410. #endif
  3411. #ifdef FT_MULFIX_INLINED
  3412. #define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b )
  3413. #else
  3414. FT_EXPORT( FT_Long )
  3415. FT_MulFix( FT_Long a,
  3416. FT_Long b );
  3417. #endif
  3418. /*************************************************************************/
  3419. /* */
  3420. /* <Function> */
  3421. /* FT_DivFix */
  3422. /* */
  3423. /* <Description> */
  3424. /* A very simple function used to perform the computation */
  3425. /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
  3426. /* used to divide a given value by a 16.16 fixed float factor. */
  3427. /* */
  3428. /* <Input> */
  3429. /* a :: The first multiplier. */
  3430. /* b :: The second multiplier. Use a 16.16 factor here whenever */
  3431. /* possible (see note below). */
  3432. /* */
  3433. /* <Return> */
  3434. /* The result of `(a*0x10000)/b'. */
  3435. /* */
  3436. /* <Note> */
  3437. /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */
  3438. /* 32~bits, then the division is computed directly. Otherwise, we */
  3439. /* use a specialized version of @FT_MulDiv. */
  3440. /* */
  3441. FT_EXPORT( FT_Long )
  3442. FT_DivFix( FT_Long a,
  3443. FT_Long b );
  3444. /*************************************************************************/
  3445. /* */
  3446. /* <Function> */
  3447. /* FT_RoundFix */
  3448. /* */
  3449. /* <Description> */
  3450. /* A very simple function used to round a 16.16 fixed number. */
  3451. /* */
  3452. /* <Input> */
  3453. /* a :: The number to be rounded. */
  3454. /* */
  3455. /* <Return> */
  3456. /* The result of `(a + 0x8000) & -0x10000'. */
  3457. /* */
  3458. FT_EXPORT( FT_Fixed )
  3459. FT_RoundFix( FT_Fixed a );
  3460. /*************************************************************************/
  3461. /* */
  3462. /* <Function> */
  3463. /* FT_CeilFix */
  3464. /* */
  3465. /* <Description> */
  3466. /* A very simple function used to compute the ceiling function of a */
  3467. /* 16.16 fixed number. */
  3468. /* */
  3469. /* <Input> */
  3470. /* a :: The number for which the ceiling function is to be computed. */
  3471. /* */
  3472. /* <Return> */
  3473. /* The result of `(a + 0x10000 - 1) & -0x10000'. */
  3474. /* */
  3475. FT_EXPORT( FT_Fixed )
  3476. FT_CeilFix( FT_Fixed a );
  3477. /*************************************************************************/
  3478. /* */
  3479. /* <Function> */
  3480. /* FT_FloorFix */
  3481. /* */
  3482. /* <Description> */
  3483. /* A very simple function used to compute the floor function of a */
  3484. /* 16.16 fixed number. */
  3485. /* */
  3486. /* <Input> */
  3487. /* a :: The number for which the floor function is to be computed. */
  3488. /* */
  3489. /* <Return> */
  3490. /* The result of `a & -0x10000'. */
  3491. /* */
  3492. FT_EXPORT( FT_Fixed )
  3493. FT_FloorFix( FT_Fixed a );
  3494. /*************************************************************************/
  3495. /* */
  3496. /* <Function> */
  3497. /* FT_Vector_Transform */
  3498. /* */
  3499. /* <Description> */
  3500. /* Transform a single vector through a 2x2 matrix. */
  3501. /* */
  3502. /* <InOut> */
  3503. /* vector :: The target vector to transform. */
  3504. /* */
  3505. /* <Input> */
  3506. /* matrix :: A pointer to the source 2x2 matrix. */
  3507. /* */
  3508. /* <Note> */
  3509. /* The result is undefined if either `vector' or `matrix' is invalid. */
  3510. /* */
  3511. FT_EXPORT( void )
  3512. FT_Vector_Transform( FT_Vector* vec,
  3513. const FT_Matrix* matrix );
  3514. /*************************************************************************/
  3515. /* */
  3516. /* <Section> */
  3517. /* version */
  3518. /* */
  3519. /* <Title> */
  3520. /* FreeType Version */
  3521. /* */
  3522. /* <Abstract> */
  3523. /* Functions and macros related to FreeType versions. */
  3524. /* */
  3525. /* <Description> */
  3526. /* Note that those functions and macros are of limited use because */
  3527. /* even a new release of FreeType with only documentation changes */
  3528. /* increases the version number. */
  3529. /* */
  3530. /*************************************************************************/
  3531. /*************************************************************************
  3532. *
  3533. * @enum:
  3534. * FREETYPE_XXX
  3535. *
  3536. * @description:
  3537. * These three macros identify the FreeType source code version.
  3538. * Use @FT_Library_Version to access them at runtime.
  3539. *
  3540. * @values:
  3541. * FREETYPE_MAJOR :: The major version number.
  3542. * FREETYPE_MINOR :: The minor version number.
  3543. * FREETYPE_PATCH :: The patch level.
  3544. *
  3545. * @note:
  3546. * The version number of FreeType if built as a dynamic link library
  3547. * with the `libtool' package is _not_ controlled by these three
  3548. * macros.
  3549. *
  3550. */
  3551. #define FREETYPE_MAJOR 2
  3552. #define FREETYPE_MINOR 4
  3553. #define FREETYPE_PATCH 9
  3554. /*************************************************************************/
  3555. /* */
  3556. /* <Function> */
  3557. /* FT_Library_Version */
  3558. /* */
  3559. /* <Description> */
  3560. /* Return the version of the FreeType library being used. This is */
  3561. /* useful when dynamically linking to the library, since one cannot */
  3562. /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */
  3563. /* @FREETYPE_PATCH. */
  3564. /* */
  3565. /* <Input> */
  3566. /* library :: A source library handle. */
  3567. /* */
  3568. /* <Output> */
  3569. /* amajor :: The major version number. */
  3570. /* */
  3571. /* aminor :: The minor version number. */
  3572. /* */
  3573. /* apatch :: The patch version number. */
  3574. /* */
  3575. /* <Note> */
  3576. /* The reason why this function takes a `library' argument is because */
  3577. /* certain programs implement library initialization in a custom way */
  3578. /* that doesn't use @FT_Init_FreeType. */
  3579. /* */
  3580. /* In such cases, the library version might not be available before */
  3581. /* the library object has been created. */
  3582. /* */
  3583. FT_EXPORT( void )
  3584. FT_Library_Version( FT_Library library,
  3585. FT_Int *amajor,
  3586. FT_Int *aminor,
  3587. FT_Int *apatch );
  3588. /*************************************************************************/
  3589. /* */
  3590. /* <Function> */
  3591. /* FT_Face_CheckTrueTypePatents */
  3592. /* */
  3593. /* <Description> */
  3594. /* Parse all bytecode instructions of a TrueType font file to check */
  3595. /* whether any of the patented opcodes are used. This is only useful */
  3596. /* if you want to be able to use the unpatented hinter with */
  3597. /* fonts that do *not* use these opcodes. */
  3598. /* */
  3599. /* Note that this function parses *all* glyph instructions in the */
  3600. /* font file, which may be slow. */
  3601. /* */
  3602. /* <Input> */
  3603. /* face :: A face handle. */
  3604. /* */
  3605. /* <Return> */
  3606. /* 1~if this is a TrueType font that uses one of the patented */
  3607. /* opcodes, 0~otherwise. */
  3608. /* */
  3609. /* <Note> */
  3610. /* Since May 2010, TrueType hinting is no longer patented. */
  3611. /* */
  3612. /* <Since> */
  3613. /* 2.3.5 */
  3614. /* */
  3615. FT_EXPORT( FT_Bool )
  3616. FT_Face_CheckTrueTypePatents( FT_Face face );
  3617. /*************************************************************************/
  3618. /* */
  3619. /* <Function> */
  3620. /* FT_Face_SetUnpatentedHinting */
  3621. /* */
  3622. /* <Description> */
  3623. /* Enable or disable the unpatented hinter for a given face. */
  3624. /* Only enable it if you have determined that the face doesn't */
  3625. /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */
  3626. /* */
  3627. /* <Input> */
  3628. /* face :: A face handle. */
  3629. /* */
  3630. /* value :: New boolean setting. */
  3631. /* */
  3632. /* <Return> */
  3633. /* The old setting value. This will always be false if this is not */
  3634. /* an SFNT font, or if the unpatented hinter is not compiled in this */
  3635. /* instance of the library. */
  3636. /* */
  3637. /* <Note> */
  3638. /* Since May 2010, TrueType hinting is no longer patented. */
  3639. /* */
  3640. /* <Since> */
  3641. /* 2.3.5 */
  3642. /* */
  3643. FT_EXPORT( FT_Bool )
  3644. FT_Face_SetUnpatentedHinting( FT_Face face,
  3645. FT_Bool value );
  3646. /* */
  3647. FT_END_HEADER
  3648. #endif /* __FREETYPE_H__ */
  3649. /* END */