ftgasp.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /****************************************************************************
  2. *
  3. * ftgasp.h
  4. *
  5. * Access of TrueType's 'gasp' table (specification).
  6. *
  7. * Copyright (C) 2007-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 FTGASP_H_
  18. #define FTGASP_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. * gasp_table
  30. *
  31. * @title:
  32. * Gasp Table
  33. *
  34. * @abstract:
  35. * Retrieving TrueType 'gasp' table entries.
  36. *
  37. * @description:
  38. * The function @FT_Get_Gasp can be used to query a TrueType or OpenType
  39. * font for specific entries in its 'gasp' table, if any. This is mainly
  40. * useful when implementing native TrueType hinting with the bytecode
  41. * interpreter to duplicate the Windows text rendering results.
  42. */
  43. /**************************************************************************
  44. *
  45. * @enum:
  46. * FT_GASP_XXX
  47. *
  48. * @description:
  49. * A list of values and/or bit-flags returned by the @FT_Get_Gasp
  50. * function.
  51. *
  52. * @values:
  53. * FT_GASP_NO_TABLE ::
  54. * This special value means that there is no GASP table in this face.
  55. * It is up to the client to decide what to do.
  56. *
  57. * FT_GASP_DO_GRIDFIT ::
  58. * Grid-fitting and hinting should be performed at the specified ppem.
  59. * This **really** means TrueType bytecode interpretation. If this bit
  60. * is not set, no hinting gets applied.
  61. *
  62. * FT_GASP_DO_GRAY ::
  63. * Anti-aliased rendering should be performed at the specified ppem.
  64. * If not set, do monochrome rendering.
  65. *
  66. * FT_GASP_SYMMETRIC_SMOOTHING ::
  67. * If set, smoothing along multiple axes must be used with ClearType.
  68. *
  69. * FT_GASP_SYMMETRIC_GRIDFIT ::
  70. * Grid-fitting must be used with ClearType's symmetric smoothing.
  71. *
  72. * @note:
  73. * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be
  74. * used for standard font rasterization only. Independently of that,
  75. * `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to
  76. * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and
  77. * `FT_GASP_DO_GRAY` are consequently ignored).
  78. *
  79. * 'ClearType' is Microsoft's implementation of LCD rendering, partly
  80. * protected by patents.
  81. *
  82. * @since:
  83. * 2.3.0
  84. */
  85. #define FT_GASP_NO_TABLE -1
  86. #define FT_GASP_DO_GRIDFIT 0x01
  87. #define FT_GASP_DO_GRAY 0x02
  88. #define FT_GASP_SYMMETRIC_GRIDFIT 0x04
  89. #define FT_GASP_SYMMETRIC_SMOOTHING 0x08
  90. /**************************************************************************
  91. *
  92. * @function:
  93. * FT_Get_Gasp
  94. *
  95. * @description:
  96. * For a TrueType or OpenType font file, return the rasterizer behaviour
  97. * flags from the font's 'gasp' table corresponding to a given character
  98. * pixel size.
  99. *
  100. * @input:
  101. * face ::
  102. * The source face handle.
  103. *
  104. * ppem ::
  105. * The vertical character pixel size.
  106. *
  107. * @return:
  108. * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
  109. * 'gasp' table in the face.
  110. *
  111. * @note:
  112. * If you want to use the MM functionality of OpenType variation fonts
  113. * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this
  114. * function **after** setting an instance since the return values can
  115. * change.
  116. *
  117. * @since:
  118. * 2.3.0
  119. */
  120. FT_EXPORT( FT_Int )
  121. FT_Get_Gasp( FT_Face face,
  122. FT_UInt ppem );
  123. /* */
  124. FT_END_HEADER
  125. #endif /* FTGASP_H_ */
  126. /* END */