ftpfr.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /****************************************************************************
  2. *
  3. * ftpfr.h
  4. *
  5. * FreeType API for accessing PFR-specific data (specification only).
  6. *
  7. * Copyright (C) 2002-2023 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 FTPFR_H_
  18. #define FTPFR_H_
  19. #include <freetype/freetype.h>
  20. #ifdef FREETYPE_H
  21. #error "freetype.h of FreeType 1 has been loaded!"
  22. #error "Please fix the directory search order for header files"
  23. #error "so that freetype.h of FreeType 2 is found first."
  24. #endif
  25. FT_BEGIN_HEADER
  26. /**************************************************************************
  27. *
  28. * @section:
  29. * pfr_fonts
  30. *
  31. * @title:
  32. * PFR Fonts
  33. *
  34. * @abstract:
  35. * PFR/TrueDoc-specific API.
  36. *
  37. * @description:
  38. * This section contains the declaration of PFR-specific functions.
  39. *
  40. */
  41. /**************************************************************************
  42. *
  43. * @function:
  44. * FT_Get_PFR_Metrics
  45. *
  46. * @description:
  47. * Return the outline and metrics resolutions of a given PFR face.
  48. *
  49. * @input:
  50. * face ::
  51. * Handle to the input face. It can be a non-PFR face.
  52. *
  53. * @output:
  54. * aoutline_resolution ::
  55. * Outline resolution. This is equivalent to `face->units_per_EM` for
  56. * non-PFR fonts. Optional (parameter can be `NULL`).
  57. *
  58. * ametrics_resolution ::
  59. * Metrics resolution. This is equivalent to `outline_resolution` for
  60. * non-PFR fonts. Optional (parameter can be `NULL`).
  61. *
  62. * ametrics_x_scale ::
  63. * A 16.16 fixed-point number used to scale distance expressed in
  64. * metrics units to device subpixels. This is equivalent to
  65. * `face->size->x_scale`, but for metrics only. Optional (parameter
  66. * can be `NULL`).
  67. *
  68. * ametrics_y_scale ::
  69. * Same as `ametrics_x_scale` but for the vertical direction.
  70. * optional (parameter can be `NULL`).
  71. *
  72. * @return:
  73. * FreeType error code. 0~means success.
  74. *
  75. * @note:
  76. * If the input face is not a PFR, this function will return an error.
  77. * However, in all cases, it will return valid values.
  78. */
  79. FT_EXPORT( FT_Error )
  80. FT_Get_PFR_Metrics( FT_Face face,
  81. FT_UInt *aoutline_resolution,
  82. FT_UInt *ametrics_resolution,
  83. FT_Fixed *ametrics_x_scale,
  84. FT_Fixed *ametrics_y_scale );
  85. /**************************************************************************
  86. *
  87. * @function:
  88. * FT_Get_PFR_Kerning
  89. *
  90. * @description:
  91. * Return the kerning pair corresponding to two glyphs in a PFR face.
  92. * The distance is expressed in metrics units, unlike the result of
  93. * @FT_Get_Kerning.
  94. *
  95. * @input:
  96. * face ::
  97. * A handle to the input face.
  98. *
  99. * left ::
  100. * Index of the left glyph.
  101. *
  102. * right ::
  103. * Index of the right glyph.
  104. *
  105. * @output:
  106. * avector ::
  107. * A kerning vector.
  108. *
  109. * @return:
  110. * FreeType error code. 0~means success.
  111. *
  112. * @note:
  113. * This function always return distances in original PFR metrics units.
  114. * This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED mode,
  115. * which always returns distances converted to outline units.
  116. *
  117. * You can use the value of the `x_scale` and `y_scale` parameters
  118. * returned by @FT_Get_PFR_Metrics to scale these to device subpixels.
  119. */
  120. FT_EXPORT( FT_Error )
  121. FT_Get_PFR_Kerning( FT_Face face,
  122. FT_UInt left,
  123. FT_UInt right,
  124. FT_Vector *avector );
  125. /**************************************************************************
  126. *
  127. * @function:
  128. * FT_Get_PFR_Advance
  129. *
  130. * @description:
  131. * Return a given glyph advance, expressed in original metrics units,
  132. * from a PFR font.
  133. *
  134. * @input:
  135. * face ::
  136. * A handle to the input face.
  137. *
  138. * gindex ::
  139. * The glyph index.
  140. *
  141. * @output:
  142. * aadvance ::
  143. * The glyph advance in metrics units.
  144. *
  145. * @return:
  146. * FreeType error code. 0~means success.
  147. *
  148. * @note:
  149. * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics
  150. * to convert the advance to device subpixels (i.e., 1/64 of pixels).
  151. */
  152. FT_EXPORT( FT_Error )
  153. FT_Get_PFR_Advance( FT_Face face,
  154. FT_UInt gindex,
  155. FT_Pos *aadvance );
  156. /* */
  157. FT_END_HEADER
  158. #endif /* FTPFR_H_ */
  159. /* END */