ftttdrv.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /***************************************************************************/
  2. /* */
  3. /* ftttdrv.h */
  4. /* */
  5. /* FreeType API for controlling the TrueType driver */
  6. /* (specification only). */
  7. /* */
  8. /* Copyright 2013 by */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. /* modified, and distributed under the terms of the FreeType project */
  13. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  14. /* this file you indicate that you have read the license and */
  15. /* understand and accept it fully. */
  16. /* */
  17. /***************************************************************************/
  18. #ifndef __FTTTDRV_H__
  19. #define __FTTTDRV_H__
  20. #include <ft2build.h>
  21. #include FT_FREETYPE_H
  22. #ifdef FREETYPE_H
  23. #error "freetype.h of FreeType 1 has been loaded!"
  24. #error "Please fix the directory search order for header files"
  25. #error "so that freetype.h of FreeType 2 is found first."
  26. #endif
  27. FT_BEGIN_HEADER
  28. /**************************************************************************
  29. *
  30. * @section:
  31. * tt_driver
  32. *
  33. * @title:
  34. * The TrueType driver
  35. *
  36. * @abstract:
  37. * Controlling the TrueType driver module.
  38. *
  39. * @description:
  40. * While FreeType's TrueType driver doesn't expose API functions by
  41. * itself, it is possible to control its behaviour with @FT_Property_Set
  42. * and @FT_Property_Get. The following lists the available properties
  43. * together with the necessary macros and structures.
  44. *
  45. * The TrueType driver's module name is `truetype'.
  46. *
  47. */
  48. /**************************************************************************
  49. *
  50. * @property:
  51. * interpreter-version
  52. *
  53. * @description:
  54. * Currently, two versions are available, representing the bytecode
  55. * interpreter with and without subpixel hinting support,
  56. * respectively. The default is subpixel support if
  57. * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel
  58. * support otherwise (since it isn't available then).
  59. *
  60. * If subpixel hinting is on, many TrueType bytecode instructions
  61. * behave differently compared to B/W or grayscale rendering. The
  62. * main idea is to render at a much increased horizontal resolution,
  63. * then sampling down the created output to subpixel precision.
  64. * However, many older fonts are not suited to this and must be
  65. * specially taken care of by applying (hardcoded) font-specific
  66. * tweaks.
  67. *
  68. * Details on subpixel hinting and some of the necessary tweaks can be
  69. * found in Greg Hitchcock's whitepaper at
  70. * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
  71. *
  72. * The following example code demonstrates how to activate subpixel
  73. * hinting (omitting the error handling).
  74. *
  75. * {
  76. * FT_Library library;
  77. * FT_Face face;
  78. * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38;
  79. *
  80. *
  81. * FT_Init_FreeType( &library );
  82. *
  83. * FT_Property_Set( library, "truetype",
  84. * "interpreter-version",
  85. * &interpreter_version );
  86. * }
  87. *
  88. * @note:
  89. * This property can be used with @FT_Property_Get also.
  90. *
  91. */
  92. /**************************************************************************
  93. *
  94. * @enum:
  95. * TT_INTERPRETER_VERSION_XXX
  96. *
  97. * @description:
  98. * A list of constants used for the @interpreter-version property to
  99. * select the hinting engine for Truetype fonts.
  100. *
  101. * The numeric value in the constant names represents the version
  102. * number as returned by the `GETINFO' bytecode instruction.
  103. *
  104. * @values:
  105. * TT_INTERPRETER_VERSION_35 ::
  106. * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
  107. * Windows~98; only grayscale and B/W rasterizing is supported.
  108. *
  109. * TT_INTERPRETER_VERSION_38 ::
  110. * Version~38 corresponds to MS rasterizer v.1.9; it is roughly
  111. * equivalent to the hinting provided by DirectWrite ClearType (as
  112. * can be found, for example, in the Internet Explorer~9 running on
  113. * Windows~7).
  114. *
  115. * @note:
  116. * This property controls the behaviour of the bytecode interpreter
  117. * and thus how outlines get hinted. It does *not* control how glyph
  118. * get rasterized! In particular, it does not control subpixel color
  119. * filtering.
  120. *
  121. * If FreeType has not been compiled with configuration option
  122. * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an
  123. * `FT_Err_Unimplemented_Feature' error.
  124. *
  125. * Depending on the graphics framework, Microsoft uses different
  126. * bytecode engines. As a consequence, the version numbers returned by
  127. * a call to the `GETINFO[1]' bytecode instruction are more convoluted
  128. * than desired.
  129. *
  130. * {
  131. * framework Windows version result of GETINFO[1]
  132. * ----------------------------------------------------
  133. * GDI before XP 35
  134. * GDI XP and later 37
  135. * GDI+ old before Vista 37
  136. * GDI+ old Vista, 7 38
  137. * GDI+ after 7 40
  138. * DWrite before 8 39
  139. * DWrite 8 and later 40
  140. * }
  141. *
  142. * Since FreeType doesn't provide all capabilities of DWrite ClearType,
  143. * using version~38 seems justified.
  144. *
  145. */
  146. #define TT_INTERPRETER_VERSION_35 35
  147. #define TT_INTERPRETER_VERSION_38 38
  148. /* */
  149. FT_END_HEADER
  150. #endif /* __FTTTDRV_H__ */
  151. /* END */