ftadvanc.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /***************************************************************************/
  2. /* */
  3. /* ftadvanc.h */
  4. /* */
  5. /* Quick computation of advance widths (specification only). */
  6. /* */
  7. /* Copyright 2008, 2013 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 __FTADVANC_H__
  18. #define __FTADVANC_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. #ifdef FREETYPE_H
  22. #error "freetype.h of FreeType 1 has been loaded!"
  23. #error "Please fix the directory search order for header files"
  24. #error "so that freetype.h of FreeType 2 is found first."
  25. #endif
  26. FT_BEGIN_HEADER
  27. /**************************************************************************
  28. *
  29. * @section:
  30. * quick_advance
  31. *
  32. * @title:
  33. * Quick retrieval of advance values
  34. *
  35. * @abstract:
  36. * Retrieve horizontal and vertical advance values without processing
  37. * glyph outlines, if possible.
  38. *
  39. * @description:
  40. * This section contains functions to quickly extract advance values
  41. * without handling glyph outlines, if possible.
  42. */
  43. /*************************************************************************/
  44. /* */
  45. /* <Const> */
  46. /* FT_ADVANCE_FLAG_FAST_ONLY */
  47. /* */
  48. /* <Description> */
  49. /* A bit-flag to be OR-ed with the `flags' parameter of the */
  50. /* @FT_Get_Advance and @FT_Get_Advances functions. */
  51. /* */
  52. /* If set, it indicates that you want these functions to fail if the */
  53. /* corresponding hinting mode or font driver doesn't allow for very */
  54. /* quick advance computation. */
  55. /* */
  56. /* Typically, glyphs that are either unscaled, unhinted, bitmapped, */
  57. /* or light-hinted can have their advance width computed very */
  58. /* quickly. */
  59. /* */
  60. /* Normal and bytecode hinted modes that require loading, scaling, */
  61. /* and hinting of the glyph outline, are extremely slow by */
  62. /* comparison. */
  63. /* */
  64. #define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000UL
  65. /*************************************************************************/
  66. /* */
  67. /* <Function> */
  68. /* FT_Get_Advance */
  69. /* */
  70. /* <Description> */
  71. /* Retrieve the advance value of a given glyph outline in an */
  72. /* @FT_Face. */
  73. /* */
  74. /* <Input> */
  75. /* face :: The source @FT_Face handle. */
  76. /* */
  77. /* gindex :: The glyph index. */
  78. /* */
  79. /* load_flags :: A set of bit flags similar to those used when */
  80. /* calling @FT_Load_Glyph, used to determine what kind */
  81. /* of advances you need. */
  82. /* <Output> */
  83. /* padvance :: The advance value. If scaling is performed (based on */
  84. /* the value of `load_flags'), the advance value is in */
  85. /* 16.16 format. Otherwise, it is in font units. */
  86. /* */
  87. /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */
  88. /* vertical advance corresponding to a vertical layout. */
  89. /* Otherwise, it is the horizontal advance in a */
  90. /* horizontal layout. */
  91. /* */
  92. /* <Return> */
  93. /* FreeType error code. 0 means success. */
  94. /* */
  95. /* <Note> */
  96. /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
  97. /* if the corresponding font backend doesn't have a quick way to */
  98. /* retrieve the advances. */
  99. /* */
  100. /* A scaled advance is returned in 16.16 format but isn't transformed */
  101. /* by the affine transformation specified by @FT_Set_Transform. */
  102. /* */
  103. FT_EXPORT( FT_Error )
  104. FT_Get_Advance( FT_Face face,
  105. FT_UInt gindex,
  106. FT_Int32 load_flags,
  107. FT_Fixed *padvance );
  108. /*************************************************************************/
  109. /* */
  110. /* <Function> */
  111. /* FT_Get_Advances */
  112. /* */
  113. /* <Description> */
  114. /* Retrieve the advance values of several glyph outlines in an */
  115. /* @FT_Face. */
  116. /* */
  117. /* <Input> */
  118. /* face :: The source @FT_Face handle. */
  119. /* */
  120. /* start :: The first glyph index. */
  121. /* */
  122. /* count :: The number of advance values you want to retrieve. */
  123. /* */
  124. /* load_flags :: A set of bit flags similar to those used when */
  125. /* calling @FT_Load_Glyph. */
  126. /* */
  127. /* <Output> */
  128. /* padvance :: The advance values. This array, to be provided by the */
  129. /* caller, must contain at least `count' elements. */
  130. /* */
  131. /* If scaling is performed (based on the value of */
  132. /* `load_flags'), the advance values are in 16.16 format. */
  133. /* Otherwise, they are in font units. */
  134. /* */
  135. /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */
  136. /* vertical advances corresponding to a vertical layout. */
  137. /* Otherwise, they are the horizontal advances in a */
  138. /* horizontal layout. */
  139. /* */
  140. /* <Return> */
  141. /* FreeType error code. 0 means success. */
  142. /* */
  143. /* <Note> */
  144. /* This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and */
  145. /* if the corresponding font backend doesn't have a quick way to */
  146. /* retrieve the advances. */
  147. /* */
  148. /* Scaled advances are returned in 16.16 format but aren't */
  149. /* transformed by the affine transformation specified by */
  150. /* @FT_Set_Transform. */
  151. /* */
  152. FT_EXPORT( FT_Error )
  153. FT_Get_Advances( FT_Face face,
  154. FT_UInt start,
  155. FT_UInt count,
  156. FT_Int32 load_flags,
  157. FT_Fixed *padvances );
  158. /* */
  159. FT_END_HEADER
  160. #endif /* __FTADVANC_H__ */
  161. /* END */