ftsizes.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /***************************************************************************/
  2. /* */
  3. /* ftsizes.h */
  4. /* */
  5. /* FreeType size objects management (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2003, 2004, 2006, 2009, 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. /*************************************************************************/
  18. /* */
  19. /* Typical application would normally not need to use these functions. */
  20. /* However, they have been placed in a public API for the rare cases */
  21. /* where they are needed. */
  22. /* */
  23. /*************************************************************************/
  24. #ifndef __FTSIZES_H__
  25. #define __FTSIZES_H__
  26. #include <ft2build.h>
  27. #include FT_FREETYPE_H
  28. #ifdef FREETYPE_H
  29. #error "freetype.h of FreeType 1 has been loaded!"
  30. #error "Please fix the directory search order for header files"
  31. #error "so that freetype.h of FreeType 2 is found first."
  32. #endif
  33. FT_BEGIN_HEADER
  34. /*************************************************************************/
  35. /* */
  36. /* <Section> */
  37. /* sizes_management */
  38. /* */
  39. /* <Title> */
  40. /* Size Management */
  41. /* */
  42. /* <Abstract> */
  43. /* Managing multiple sizes per face. */
  44. /* */
  45. /* <Description> */
  46. /* When creating a new face object (e.g., with @FT_New_Face), an */
  47. /* @FT_Size object is automatically created and used to store all */
  48. /* pixel-size dependent information, available in the `face->size' */
  49. /* field. */
  50. /* */
  51. /* It is however possible to create more sizes for a given face, */
  52. /* mostly in order to manage several character pixel sizes of the */
  53. /* same font family and style. See @FT_New_Size and @FT_Done_Size. */
  54. /* */
  55. /* Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only */
  56. /* modify the contents of the current `active' size; you thus need */
  57. /* to use @FT_Activate_Size to change it. */
  58. /* */
  59. /* 99% of applications won't need the functions provided here, */
  60. /* especially if they use the caching sub-system, so be cautious */
  61. /* when using these. */
  62. /* */
  63. /*************************************************************************/
  64. /*************************************************************************/
  65. /* */
  66. /* <Function> */
  67. /* FT_New_Size */
  68. /* */
  69. /* <Description> */
  70. /* Create a new size object from a given face object. */
  71. /* */
  72. /* <Input> */
  73. /* face :: A handle to a parent face object. */
  74. /* */
  75. /* <Output> */
  76. /* asize :: A handle to a new size object. */
  77. /* */
  78. /* <Return> */
  79. /* FreeType error code. 0~means success. */
  80. /* */
  81. /* <Note> */
  82. /* You need to call @FT_Activate_Size in order to select the new size */
  83. /* for upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size, */
  84. /* @FT_Load_Glyph, @FT_Load_Char, etc. */
  85. /* */
  86. FT_EXPORT( FT_Error )
  87. FT_New_Size( FT_Face face,
  88. FT_Size* size );
  89. /*************************************************************************/
  90. /* */
  91. /* <Function> */
  92. /* FT_Done_Size */
  93. /* */
  94. /* <Description> */
  95. /* Discard a given size object. Note that @FT_Done_Face */
  96. /* automatically discards all size objects allocated with */
  97. /* @FT_New_Size. */
  98. /* */
  99. /* <Input> */
  100. /* size :: A handle to a target size object. */
  101. /* */
  102. /* <Return> */
  103. /* FreeType error code. 0~means success. */
  104. /* */
  105. FT_EXPORT( FT_Error )
  106. FT_Done_Size( FT_Size size );
  107. /*************************************************************************/
  108. /* */
  109. /* <Function> */
  110. /* FT_Activate_Size */
  111. /* */
  112. /* <Description> */
  113. /* Even though it is possible to create several size objects for a */
  114. /* given face (see @FT_New_Size for details), functions like */
  115. /* @FT_Load_Glyph or @FT_Load_Char only use the one that has been */
  116. /* activated last to determine the `current character pixel size'. */
  117. /* */
  118. /* This function can be used to `activate' a previously created size */
  119. /* object. */
  120. /* */
  121. /* <Input> */
  122. /* size :: A handle to a target size object. */
  123. /* */
  124. /* <Return> */
  125. /* FreeType error code. 0~means success. */
  126. /* */
  127. /* <Note> */
  128. /* If `face' is the size's parent face object, this function changes */
  129. /* the value of `face->size' to the input size handle. */
  130. /* */
  131. FT_EXPORT( FT_Error )
  132. FT_Activate_Size( FT_Size size );
  133. /* */
  134. FT_END_HEADER
  135. #endif /* __FTSIZES_H__ */
  136. /* END */