ftgasp.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /***************************************************************************/
  2. /* */
  3. /* ftgasp.h */
  4. /* */
  5. /* Access of TrueType's `gasp' table (specification). */
  6. /* */
  7. /* Copyright 2007, 2008, 2011 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_GASP_H_
  18. #define _FT_GASP_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. /***************************************************************************
  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
  40. * mainly useful when implementing native TrueType hinting with the
  41. * bytecode 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_SMOOTHING 0x08
  89. #define FT_GASP_SYMMETRIC_GRIDFIT 0x10
  90. /*************************************************************************
  91. *
  92. * @func:
  93. * FT_Get_Gasp
  94. *
  95. * @description:
  96. * Read the `gasp' table from a TrueType or OpenType font file and
  97. * return the entry corresponding to a given character pixel size.
  98. *
  99. * @input:
  100. * face :: The source face handle.
  101. * ppem :: The vertical character pixel size.
  102. *
  103. * @return:
  104. * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no
  105. * `gasp' table in the face.
  106. *
  107. * @since:
  108. * 2.3.0
  109. */
  110. FT_EXPORT( FT_Int )
  111. FT_Get_Gasp( FT_Face face,
  112. FT_UInt ppem );
  113. /* */
  114. #endif /* _FT_GASP_H_ */
  115. /* END */