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

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 1313 lines · 214 code · 130 blank · 969 comment · 0 complexity · bc174332cf41b1f8a3490ecdb40bff7c MD5 · raw file

Large files are truncated click here to view the full file

  1. /***************************************************************************/
  2. /* */
  3. /* ftimage.h */
  4. /* */
  5. /* FreeType glyph image formats and default raster interface */
  6. /* (specification). */
  7. /* */
  8. /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
  9. /* 2010 by */
  10. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  11. /* */
  12. /* This file is part of the FreeType project, and may only be used, */
  13. /* modified, and distributed under the terms of the FreeType project */
  14. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  15. /* this file you indicate that you have read the license and */
  16. /* understand and accept it fully. */
  17. /* */
  18. /***************************************************************************/
  19. /*************************************************************************/
  20. /* */
  21. /* Note: A `raster' is simply a scan-line converter, used to render */
  22. /* FT_Outlines into FT_Bitmaps. */
  23. /* */
  24. /*************************************************************************/
  25. #ifndef __FTIMAGE_H__
  26. #define __FTIMAGE_H__
  27. /* _STANDALONE_ is from ftgrays.c */
  28. #ifndef _STANDALONE_
  29. #include <ft2build.h>
  30. #endif
  31. FT_BEGIN_HEADER
  32. /*************************************************************************/
  33. /* */
  34. /* <Section> */
  35. /* basic_types */
  36. /* */
  37. /*************************************************************************/
  38. /*************************************************************************/
  39. /* */
  40. /* <Type> */
  41. /* FT_Pos */
  42. /* */
  43. /* <Description> */
  44. /* The type FT_Pos is used to store vectorial coordinates. Depending */
  45. /* on the context, these can represent distances in integer font */
  46. /* units, or 16.16, or 26.6 fixed float pixel coordinates. */
  47. /* */
  48. typedef signed long FT_Pos;
  49. /*************************************************************************/
  50. /* */
  51. /* <Struct> */
  52. /* FT_Vector */
  53. /* */
  54. /* <Description> */
  55. /* A simple structure used to store a 2D vector; coordinates are of */
  56. /* the FT_Pos type. */
  57. /* */
  58. /* <Fields> */
  59. /* x :: The horizontal coordinate. */
  60. /* y :: The vertical coordinate. */
  61. /* */
  62. typedef struct FT_Vector_
  63. {
  64. FT_Pos x;
  65. FT_Pos y;
  66. } FT_Vector;
  67. /*************************************************************************/
  68. /* */
  69. /* <Struct> */
  70. /* FT_BBox */
  71. /* */
  72. /* <Description> */
  73. /* A structure used to hold an outline's bounding box, i.e., the */
  74. /* coordinates of its extrema in the horizontal and vertical */
  75. /* directions. */
  76. /* */
  77. /* <Fields> */
  78. /* xMin :: The horizontal minimum (left-most). */
  79. /* */
  80. /* yMin :: The vertical minimum (bottom-most). */
  81. /* */
  82. /* xMax :: The horizontal maximum (right-most). */
  83. /* */
  84. /* yMax :: The vertical maximum (top-most). */
  85. /* */
  86. /* <Note> */
  87. /* The bounding box is specified with the coordinates of the lower */
  88. /* left and the upper right corner. In PostScript, those values are */
  89. /* often called (llx,lly) and (urx,ury), respectively. */
  90. /* */
  91. /* If `yMin' is negative, this value gives the glyph's descender. */
  92. /* Otherwise, the glyph doesn't descend below the baseline. */
  93. /* Similarly, if `ymax' is positive, this value gives the glyph's */
  94. /* ascender. */
  95. /* */
  96. /* `xMin' gives the horizontal distance from the glyph's origin to */
  97. /* the left edge of the glyph's bounding box. If `xMin' is negative, */
  98. /* the glyph extends to the left of the origin. */
  99. /* */
  100. typedef struct FT_BBox_
  101. {
  102. FT_Pos xMin, yMin;
  103. FT_Pos xMax, yMax;
  104. } FT_BBox;
  105. /*************************************************************************/
  106. /* */
  107. /* <Enum> */
  108. /* FT_Pixel_Mode */
  109. /* */
  110. /* <Description> */
  111. /* An enumeration type used to describe the format of pixels in a */
  112. /* given bitmap. Note that additional formats may be added in the */
  113. /* future. */
  114. /* */
  115. /* <Values> */
  116. /* FT_PIXEL_MODE_NONE :: */
  117. /* Value~0 is reserved. */
  118. /* */
  119. /* FT_PIXEL_MODE_MONO :: */
  120. /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */
  121. /* are stored in most-significant order (MSB), which means that */
  122. /* the left-most pixel in a byte has value 128. */
  123. /* */
  124. /* FT_PIXEL_MODE_GRAY :: */
  125. /* An 8-bit bitmap, generally used to represent anti-aliased glyph */
  126. /* images. Each pixel is stored in one byte. Note that the number */
  127. /* of `gray' levels is stored in the `num_grays' field of the */
  128. /* @FT_Bitmap structure (it generally is 256). */
  129. /* */
  130. /* FT_PIXEL_MODE_GRAY2 :: */
  131. /* A 2-bit per pixel bitmap, used to represent embedded */
  132. /* anti-aliased bitmaps in font files according to the OpenType */
  133. /* specification. We haven't found a single font using this */
  134. /* format, however. */
  135. /* */
  136. /* FT_PIXEL_MODE_GRAY4 :: */
  137. /* A 4-bit per pixel bitmap, representing embedded anti-aliased */
  138. /* bitmaps in font files according to the OpenType specification. */
  139. /* We haven't found a single font using this format, however. */
  140. /* */
  141. /* FT_PIXEL_MODE_LCD :: */
  142. /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
  143. /* used for display on LCD displays; the bitmap is three times */
  144. /* wider than the original glyph image. See also */
  145. /* @FT_RENDER_MODE_LCD. */
  146. /* */
  147. /* FT_PIXEL_MODE_LCD_V :: */
  148. /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */
  149. /* used for display on rotated LCD displays; the bitmap is three */
  150. /* times taller than the original glyph image. See also */
  151. /* @FT_RENDER_MODE_LCD_V. */
  152. /* */
  153. typedef enum FT_Pixel_Mode_
  154. {
  155. FT_PIXEL_MODE_NONE = 0,
  156. FT_PIXEL_MODE_MONO,
  157. FT_PIXEL_MODE_GRAY,
  158. FT_PIXEL_MODE_GRAY2,
  159. FT_PIXEL_MODE_GRAY4,
  160. FT_PIXEL_MODE_LCD,
  161. FT_PIXEL_MODE_LCD_V,
  162. FT_PIXEL_MODE_MAX /* do not remove */
  163. } FT_Pixel_Mode;
  164. /*************************************************************************/
  165. /* */
  166. /* <Enum> */
  167. /* ft_pixel_mode_xxx */
  168. /* */
  169. /* <Description> */
  170. /* A list of deprecated constants. Use the corresponding */
  171. /* @FT_Pixel_Mode values instead. */
  172. /* */
  173. /* <Values> */
  174. /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */
  175. /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */
  176. /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */
  177. /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */
  178. /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */
  179. /* */
  180. #define ft_pixel_mode_none FT_PIXEL_MODE_NONE
  181. #define ft_pixel_mode_mono FT_PIXEL_MODE_MONO
  182. #define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY
  183. #define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2
  184. #define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4
  185. /* */
  186. #if 0
  187. /*************************************************************************/
  188. /* */
  189. /* <Enum> */
  190. /* FT_Palette_Mode */
  191. /* */
  192. /* <Description> */
  193. /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */
  194. /* */
  195. /* An enumeration type to describe the format of a bitmap palette, */
  196. /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */
  197. /* */
  198. /* <Values> */
  199. /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */
  200. /* records. */
  201. /* */
  202. /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */
  203. /* records. */
  204. /* */
  205. /* <Note> */
  206. /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */
  207. /* FreeType, these types are not handled by the library itself. */
  208. /* */
  209. typedef enum FT_Palette_Mode_
  210. {
  211. ft_palette_mode_rgb = 0,
  212. ft_palette_mode_rgba,
  213. ft_palette_mode_max /* do not remove */
  214. } FT_Palette_Mode;
  215. /* */
  216. #endif
  217. /*************************************************************************/
  218. /* */
  219. /* <Struct> */
  220. /* FT_Bitmap */
  221. /* */
  222. /* <Description> */
  223. /* A structure used to describe a bitmap or pixmap to the raster. */
  224. /* Note that we now manage pixmaps of various depths through the */
  225. /* `pixel_mode' field. */
  226. /* */
  227. /* <Fields> */
  228. /* rows :: The number of bitmap rows. */
  229. /* */
  230. /* width :: The number of pixels in bitmap row. */
  231. /* */
  232. /* pitch :: The pitch's absolute value is the number of bytes */
  233. /* taken by one bitmap row, including padding. */
  234. /* However, the pitch is positive when the bitmap has */
  235. /* a `down' flow, and negative when it has an `up' */
  236. /* flow. In all cases, the pitch is an offset to add */
  237. /* to a bitmap pointer in order to go down one row. */
  238. /* */
  239. /* Note that `padding' means the alignment of a */
  240. /* bitmap to a byte border, and FreeType functions */
  241. /* normally align to the smallest possible integer */
  242. /* value. */
  243. /* */
  244. /* For the B/W rasterizer, `pitch' is always an even */
  245. /* number. */
  246. /* */
  247. /* To change the pitch of a bitmap (say, to make it a */
  248. /* multiple of 4), use @FT_Bitmap_Convert. */
  249. /* Alternatively, you might use callback functions to */
  250. /* directly render to the application's surface; see */
  251. /* the file `example2.cpp' in the tutorial for a */
  252. /* demonstration. */
  253. /* */
  254. /* buffer :: A typeless pointer to the bitmap buffer. This */
  255. /* value should be aligned on 32-bit boundaries in */
  256. /* most cases. */
  257. /* */
  258. /* num_grays :: This field is only used with */
  259. /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */
  260. /* levels used in the bitmap. */
  261. /* */
  262. /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */
  263. /* See @FT_Pixel_Mode for possible values. */
  264. /* */
  265. /* palette_mode :: This field is intended for paletted pixel modes; */
  266. /* it indicates how the palette is stored. Not */
  267. /* used currently. */
  268. /* */
  269. /* palette :: A typeless pointer to the bitmap palette; this */
  270. /* field is intended for paletted pixel modes. Not */
  271. /* used currently. */
  272. /* */
  273. /* <Note> */
  274. /* For now, the only pixel modes supported by FreeType are mono and */
  275. /* grays. However, drivers might be added in the future to support */
  276. /* more `colorful' options. */
  277. /* */
  278. typedef struct FT_Bitmap_
  279. {
  280. int rows;
  281. int width;
  282. int pitch;
  283. unsigned char* buffer;
  284. short num_grays;
  285. char pixel_mode;
  286. char palette_mode;
  287. void* palette;
  288. } FT_Bitmap;
  289. /*************************************************************************/
  290. /* */
  291. /* <Section> */
  292. /* outline_processing */
  293. /* */
  294. /*************************************************************************/
  295. /*************************************************************************/
  296. /* */
  297. /* <Struct> */
  298. /* FT_Outline */
  299. /* */
  300. /* <Description> */
  301. /* This structure is used to describe an outline to the scan-line */
  302. /* converter. */
  303. /* */
  304. /* <Fields> */
  305. /* n_contours :: The number of contours in the outline. */
  306. /* */
  307. /* n_points :: The number of points in the outline. */
  308. /* */
  309. /* points :: A pointer to an array of `n_points' @FT_Vector */
  310. /* elements, giving the outline's point coordinates. */
  311. /* */
  312. /* tags :: A pointer to an array of `n_points' chars, giving */
  313. /* each outline point's type. */
  314. /* */
  315. /* If bit~0 is unset, the point is `off' the curve, */
  316. /* i.e., a Bézier control point, while it is `on' if */
  317. /* set. */
  318. /* */
  319. /* Bit~1 is meaningful for `off' points only. If set, */
  320. /* it indicates a third-order Bézier arc control point; */
  321. /* and a second-order control point if unset. */
  322. /* */
  323. /* If bit~2 is set, bits 5-7 contain the drop-out mode */
  324. /* (as defined in the OpenType specification; the value */
  325. /* is the same as the argument to the SCANMODE */
  326. /* instruction). */
  327. /* */
  328. /* Bits 3 and~4 are reserved for internal purposes. */
  329. /* */
  330. /* contours :: An array of `n_contours' shorts, giving the end */
  331. /* point of each contour within the outline. For */
  332. /* example, the first contour is defined by the points */
  333. /* `0' to `contours[0]', the second one is defined by */
  334. /* the points `contours[0]+1' to `contours[1]', etc. */
  335. /* */
  336. /* flags :: A set of bit flags used to characterize the outline */
  337. /* and give hints to the scan-converter and hinter on */
  338. /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */
  339. /* */
  340. /* <Note> */
  341. /* The B/W rasterizer only checks bit~2 in the `tags' array for the */
  342. /* first point of each contour. The drop-out mode as given with */
  343. /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */
  344. /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */
  345. /* */
  346. typedef struct FT_Outline_
  347. {
  348. short n_contours; /* number of contours in glyph */
  349. short n_points; /* number of points in the glyph */
  350. FT_Vector* points; /* the outline's points */
  351. char* tags; /* the points flags */
  352. short* contours; /* the contour end points */
  353. int flags; /* outline masks */
  354. } FT_Outline;
  355. /* Following limits must be consistent with */
  356. /* FT_Outline.{n_contours,n_points} */
  357. #define FT_OUTLINE_CONTOURS_MAX SHRT_MAX
  358. #define FT_OUTLINE_POINTS_MAX SHRT_MAX
  359. /*************************************************************************/
  360. /* */
  361. /* <Enum> */
  362. /* FT_OUTLINE_FLAGS */
  363. /* */
  364. /* <Description> */
  365. /* A list of bit-field constants use for the flags in an outline's */
  366. /* `flags' field. */
  367. /* */
  368. /* <Values> */
  369. /* FT_OUTLINE_NONE :: */
  370. /* Value~0 is reserved. */
  371. /* */
  372. /* FT_OUTLINE_OWNER :: */
  373. /* If set, this flag indicates that the outline's field arrays */
  374. /* (i.e., `points', `flags', and `contours') are `owned' by the */
  375. /* outline object, and should thus be freed when it is destroyed. */
  376. /* */
  377. /* FT_OUTLINE_EVEN_ODD_FILL :: */
  378. /* By default, outlines are filled using the non-zero winding rule. */
  379. /* If set to 1, the outline will be filled using the even-odd fill */
  380. /* rule (only works with the smooth rasterizer). */
  381. /* */
  382. /* FT_OUTLINE_REVERSE_FILL :: */
  383. /* By default, outside contours of an outline are oriented in */
  384. /* clock-wise direction, as defined in the TrueType specification. */
  385. /* This flag is set if the outline uses the opposite direction */
  386. /* (typically for Type~1 fonts). This flag is ignored by the scan */
  387. /* converter. */
  388. /* */
  389. /* FT_OUTLINE_IGNORE_DROPOUTS :: */
  390. /* By default, the scan converter will try to detect drop-outs in */
  391. /* an outline and correct the glyph bitmap to ensure consistent */
  392. /* shape continuity. If set, this flag hints the scan-line */
  393. /* converter to ignore such cases. See below for more information. */
  394. /* */
  395. /* FT_OUTLINE_SMART_DROPOUTS :: */
  396. /* Select smart dropout control. If unset, use simple dropout */
  397. /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */
  398. /* below for more information. */
  399. /* */
  400. /* FT_OUTLINE_INCLUDE_STUBS :: */
  401. /* If set, turn pixels on for `stubs', otherwise exclude them. */
  402. /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */
  403. /* more information. */
  404. /* */
  405. /* FT_OUTLINE_HIGH_PRECISION :: */
  406. /* This flag indicates that the scan-line converter should try to */
  407. /* convert this outline to bitmaps with the highest possible */
  408. /* quality. It is typically set for small character sizes. Note */
  409. /* that this is only a hint that might be completely ignored by a */
  410. /* given scan-converter. */
  411. /* */
  412. /* FT_OUTLINE_SINGLE_PASS :: */
  413. /* This flag is set to force a given scan-converter to only use a */
  414. /* single pass over the outline to render a bitmap glyph image. */
  415. /* Normally, it is set for very large character sizes. It is only */
  416. /* a hint that might be completely ignored by a given */
  417. /* scan-converter. */
  418. /* */
  419. /* <Note> */
  420. /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */
  421. /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */
  422. /* rasterizer. */
  423. /* */
  424. /* There exists a second mechanism to pass the drop-out mode to the */
  425. /* B/W rasterizer; see the `tags' field in @FT_Outline. */
  426. /* */
  427. /* Please refer to the description of the `SCANTYPE' instruction in */
  428. /* the OpenType specification (in file `ttinst1.doc') how simple */
  429. /* drop-outs, smart drop-outs, and stubs are defined. */
  430. /* */
  431. #define FT_OUTLINE_NONE 0x0
  432. #define FT_OUTLINE_OWNER 0x1
  433. #define FT_OUTLINE_EVEN_ODD_FILL 0x2
  434. #define FT_OUTLINE_REVERSE_FILL 0x4
  435. #define FT_OUTLINE_IGNORE_DROPOUTS 0x8
  436. #define FT_OUTLINE_SMART_DROPOUTS 0x10
  437. #define FT_OUTLINE_INCLUDE_STUBS 0x20
  438. #define FT_OUTLINE_HIGH_PRECISION 0x100
  439. #define FT_OUTLINE_SINGLE_PASS 0x200
  440. /*************************************************************************
  441. *
  442. * @enum:
  443. * ft_outline_flags
  444. *
  445. * @description:
  446. * These constants are deprecated. Please use the corresponding
  447. * @FT_OUTLINE_FLAGS values.
  448. *
  449. * @values:
  450. * ft_outline_none :: See @FT_OUTLINE_NONE.
  451. * ft_outline_owner :: See @FT_OUTLINE_OWNER.
  452. * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL.
  453. * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL.
  454. * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS.
  455. * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION.
  456. * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS.
  457. */
  458. #define ft_outline_none FT_OUTLINE_NONE
  459. #define ft_outline_owner FT_OUTLINE_OWNER
  460. #define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL
  461. #define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL
  462. #define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS
  463. #define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION
  464. #define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS
  465. /* */
  466. #define FT_CURVE_TAG( flag ) ( flag & 3 )
  467. #define FT_CURVE_TAG_ON 1
  468. #define FT_CURVE_TAG_CONIC 0
  469. #define FT_CURVE_TAG_CUBIC 2
  470. #define FT_CURVE_TAG_HAS_SCANMODE 4
  471. #define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */
  472. #define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */
  473. #define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \
  474. FT_CURVE_TAG_TOUCH_Y )
  475. #define FT_Curve_Tag_On FT_CURVE_TAG_ON
  476. #define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC
  477. #define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC
  478. #define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X
  479. #define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y
  480. /*************************************************************************/
  481. /* */
  482. /* <FuncType> */
  483. /* FT_Outline_MoveToFunc */
  484. /* */
  485. /* <Description> */
  486. /* A function pointer type used to describe the signature of a `move */
  487. /* to' function during outline walking/decomposition. */
  488. /* */
  489. /* A `move to' is emitted to start a new contour in an outline. */
  490. /* */
  491. /* <Input> */
  492. /* to :: A pointer to the target point of the `move to'. */
  493. /* */
  494. /* user :: A typeless pointer which is passed from the caller of the */
  495. /* decomposition function. */
  496. /* */
  497. /* <Return> */
  498. /* Error code. 0~means success. */
  499. /* */
  500. typedef int
  501. (*FT_Outline_MoveToFunc)( const FT_Vector* to,
  502. void* user );
  503. #define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc
  504. /*************************************************************************/
  505. /* */
  506. /* <FuncType> */
  507. /* FT_Outline_LineToFunc */
  508. /* */
  509. /* <Description> */
  510. /* A function pointer type used to describe the signature of a `line */
  511. /* to' function during outline walking/decomposition. */
  512. /* */
  513. /* A `line to' is emitted to indicate a segment in the outline. */
  514. /* */
  515. /* <Input> */
  516. /* to :: A pointer to the target point of the `line to'. */
  517. /* */
  518. /* user :: A typeless pointer which is passed from the caller of the */
  519. /* decomposition function. */
  520. /* */
  521. /* <Return> */
  522. /* Error code. 0~means success. */
  523. /* */
  524. typedef int
  525. (*FT_Outline_LineToFunc)( const FT_Vector* to,
  526. void* user );
  527. #define FT_Outline_LineTo_Func FT_Outline_LineToFunc
  528. /*************************************************************************/
  529. /* */
  530. /* <FuncType> */
  531. /* FT_Outline_ConicToFunc */
  532. /* */
  533. /* <Description> */
  534. /* A function pointer type used to describe the signature of a `conic */
  535. /* to' function during outline walking or decomposition. */
  536. /* */
  537. /* A `conic to' is emitted to indicate a second-order Bézier arc in */
  538. /* the outline. */
  539. /* */
  540. /* <Input> */
  541. /* control :: An intermediate control point between the last position */
  542. /* and the new target in `to'. */
  543. /* */
  544. /* to :: A pointer to the target end point of the conic arc. */
  545. /* */
  546. /* user :: A typeless pointer which is passed from the caller of */
  547. /* the decomposition function. */
  548. /* */
  549. /* <Return> */
  550. /* Error code. 0~means success. */
  551. /* */
  552. typedef int
  553. (*FT_Outline_ConicToFunc)( const FT_Vector* control,
  554. const FT_Vector* to,
  555. void* user );
  556. #define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc
  557. /*************************************************************************/
  558. /* */
  559. /* <FuncType> */
  560. /* FT_Outline_CubicToFunc */
  561. /* */
  562. /* <Description> */
  563. /* A function pointer type used to describe the signature of a `cubic */
  564. /* to' function during outline walking or decomposition. */
  565. /* */
  566. /* A `cubic to' is emitted to indicate a third-order Bézier arc. */
  567. /* */
  568. /* <Input> */
  569. /* control1 :: A pointer to the first Bézier control point. */
  570. /* */
  571. /* control2 :: A pointer to the second Bézier control point. */
  572. /* */
  573. /* to :: A pointer to the target end point. */
  574. /* */
  575. /* user :: A typeless pointer which is passed from the caller of */
  576. /* the decomposition function. */
  577. /* */
  578. /* <Return> */
  579. /* Error code. 0~means success. */
  580. /* */
  581. typedef int
  582. (*FT_Outline_CubicToFunc)( const FT_Vector* control1,
  583. const FT_Vector* control2,
  584. const FT_Vector* to,
  585. void* user );
  586. #define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc
  587. /*************************************************************************/
  588. /* */
  589. /* <Struct> */
  590. /* FT_Outline_Funcs */
  591. /* */
  592. /* <Description> */
  593. /* A structure to hold various function pointers used during outline */
  594. /* decomposition in order to emit segments, conic, and cubic Béziers. */
  595. /* */
  596. /* <Fields> */
  597. /* move_to :: The `move to' emitter. */
  598. /* */
  599. /* line_to :: The segment emitter. */
  600. /* */
  601. /* conic_to :: The second-order Bézier arc emitter. */
  602. /* */
  603. /* cubic_to :: The third-order Bézier arc emitter. */
  604. /* */
  605. /* shift :: The shift that is applied to coordinates before they */
  606. /* are sent to the emitter. */
  607. /* */
  608. /* delta :: The delta that is applied to coordinates before they */
  609. /* are sent to the emitter, but after the shift. */
  610. /* */
  611. /* <Note> */
  612. /* The point coordinates sent to the emitters are the transformed */
  613. /* version of the original coordinates (this is important for high */
  614. /* accuracy during scan-conversion). The transformation is simple: */
  615. /* */
  616. /* { */
  617. /* x' = (x << shift) - delta */
  618. /* y' = (x << shift) - delta */
  619. /* } */
  620. /* */
  621. /* Set the values of `shift' and `delta' to~0 to get the original */
  622. /* point coordinates. */
  623. /* */
  624. typedef struct FT_Outline_Funcs_
  625. {
  626. FT_Outline_MoveToFunc move_to;
  627. FT_Outline_LineToFunc line_to;
  628. FT_Outline_ConicToFunc conic_to;
  629. FT_Outline_CubicToFunc cubic_to;
  630. int shift;
  631. FT_Pos delta;
  632. } FT_Outline_Funcs;
  633. /*************************************************************************/
  634. /* */
  635. /* <Section> */
  636. /* basic_types */
  637. /* */
  638. /*************************************************************************/
  639. /*************************************************************************/
  640. /* */
  641. /* <Macro> */
  642. /* FT_IMAGE_TAG */
  643. /* */
  644. /* <Description> */
  645. /* This macro converts four-letter tags to an unsigned long type. */
  646. /* */
  647. /* <Note> */
  648. /* Since many 16-bit compilers don't like 32-bit enumerations, you */
  649. /* should redefine this macro in case of problems to something like */
  650. /* this: */
  651. /* */
  652. /* { */
  653. /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
  654. /* } */
  655. /* */
  656. /* to get a simple enumeration without assigning special numbers. */
  657. /* */
  658. #ifndef FT_IMAGE_TAG
  659. #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \
  660. value = ( ( (unsigned long)_x1 << 24 ) | \
  661. ( (unsigned long)_x2 << 16 ) | \
  662. ( (unsigned long)_x3 << 8 ) | \
  663. (unsigned long)_x4 )
  664. #endif /* FT_IMAGE_TAG */
  665. /*************************************************************************/
  666. /* */
  667. /* <Enum> */
  668. /* FT_Glyph_Format */
  669. /* */
  670. /* <Description> */
  671. /* An enumeration type used to describe the format of a given glyph */
  672. /* image. Note that this version of FreeType only supports two image */
  673. /* formats, even though future font drivers will be able to register */
  674. /* their own format. */
  675. /* */
  676. /* <Values> */
  677. /* FT_GLYPH_FORMAT_NONE :: */
  678. /* The value~0 is reserved. */
  679. /* */
  680. /* FT_GLYPH_FORMAT_COMPOSITE :: */
  681. /* The glyph image is a composite of several other images. This */
  682. /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */
  683. /* report compound glyphs (like accented characters). */
  684. /* */
  685. /* FT_GLYPH_FORMAT_BITMAP :: */
  686. /* The glyph image is a bitmap, and can be described as an */
  687. /* @FT_Bitmap. You generally need to access the `bitmap' field of */
  688. /* the @FT_GlyphSlotRec structure to read it. */
  689. /* */
  690. /* FT_GLYPH_FORMAT_OUTLINE :: */
  691. /* The glyph image is a vectorial outline made of line segments */
  692. /* and Bézier arcs; it can be described as an @FT_Outline; you */
  693. /* generally want to access the `outline' field of the */
  694. /* @FT_GlyphSlotRec structure to read it. */
  695. /* */
  696. /* FT_GLYPH_FORMAT_PLOTTER :: */
  697. /* The glyph image is a vectorial path with no inside and outside */
  698. /* contours. Some Type~1 fonts, like those in the Hershey family, */
  699. /* contain glyphs in this format. These are described as */
  700. /* @FT_Outline, but FreeType isn't currently capable of rendering */
  701. /* them correctly. */
  702. /* */
  703. typedef enum FT_Glyph_Format_
  704. {
  705. FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),
  706. FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
  707. FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
  708. FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
  709. FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
  710. } FT_Glyph_Format;
  711. /*************************************************************************/
  712. /* */
  713. /* <Enum> */
  714. /* ft_glyph_format_xxx */
  715. /* */
  716. /* <Description> */
  717. /* A list of deprecated constants. Use the corresponding */
  718. /* @FT_Glyph_Format values instead. */
  719. /* */
  720. /* <Values> */
  721. /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */
  722. /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */
  723. /* ft_glyph_fo…