ftwinfnt.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /****************************************************************************
  2. *
  3. * ftwinfnt.h
  4. *
  5. * FreeType API for accessing Windows fnt-specific data.
  6. *
  7. * Copyright (C) 2003-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 FTWINFNT_H_
  18. #define FTWINFNT_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. * winfnt_fonts
  30. *
  31. * @title:
  32. * Window FNT Files
  33. *
  34. * @abstract:
  35. * Windows FNT-specific API.
  36. *
  37. * @description:
  38. * This section contains the declaration of Windows FNT-specific
  39. * functions.
  40. *
  41. */
  42. /**************************************************************************
  43. *
  44. * @enum:
  45. * FT_WinFNT_ID_XXX
  46. *
  47. * @description:
  48. * A list of valid values for the `charset` byte in @FT_WinFNT_HeaderRec.
  49. * Exact mapping tables for the various 'cpXXXX' encodings (except for
  50. * 'cp1361') can be found at 'ftp://ftp.unicode.org/Public/' in the
  51. * `MAPPINGS/VENDORS/MICSFT/WINDOWS` subdirectory. 'cp1361' is roughly a
  52. * superset of `MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT`.
  53. *
  54. * @values:
  55. * FT_WinFNT_ID_DEFAULT ::
  56. * This is used for font enumeration and font creation as a 'don't
  57. * care' value. Valid font files don't contain this value. When
  58. * querying for information about the character set of the font that is
  59. * currently selected into a specified device context, this return
  60. * value (of the related Windows API) simply denotes failure.
  61. *
  62. * FT_WinFNT_ID_SYMBOL ::
  63. * There is no known mapping table available.
  64. *
  65. * FT_WinFNT_ID_MAC ::
  66. * Mac Roman encoding.
  67. *
  68. * FT_WinFNT_ID_OEM ::
  69. * From Michael Poettgen <[email protected]>:
  70. *
  71. * The 'Windows Font Mapping' article says that `FT_WinFNT_ID_OEM` is
  72. * used for the charset of vector fonts, like `modern.fon`,
  73. * `roman.fon`, and `script.fon` on Windows.
  74. *
  75. * The 'CreateFont' documentation says: The `FT_WinFNT_ID_OEM` value
  76. * specifies a character set that is operating-system dependent.
  77. *
  78. * The 'IFIMETRICS' documentation from the 'Windows Driver Development
  79. * Kit' says: This font supports an OEM-specific character set. The
  80. * OEM character set is system dependent.
  81. *
  82. * In general OEM, as opposed to ANSI (i.e., 'cp1252'), denotes the
  83. * second default codepage that most international versions of Windows
  84. * have. It is one of the OEM codepages from
  85. *
  86. * https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers
  87. * ,
  88. *
  89. * and is used for the 'DOS boxes', to support legacy applications. A
  90. * German Windows version for example usually uses ANSI codepage 1252
  91. * and OEM codepage 850.
  92. *
  93. * FT_WinFNT_ID_CP874 ::
  94. * A superset of Thai TIS 620 and ISO 8859-11.
  95. *
  96. * FT_WinFNT_ID_CP932 ::
  97. * A superset of Japanese Shift-JIS (with minor deviations).
  98. *
  99. * FT_WinFNT_ID_CP936 ::
  100. * A superset of simplified Chinese GB 2312-1980 (with different
  101. * ordering and minor deviations).
  102. *
  103. * FT_WinFNT_ID_CP949 ::
  104. * A superset of Korean Hangul KS~C 5601-1987 (with different ordering
  105. * and minor deviations).
  106. *
  107. * FT_WinFNT_ID_CP950 ::
  108. * A superset of traditional Chinese Big~5 ETen (with different
  109. * ordering and minor deviations).
  110. *
  111. * FT_WinFNT_ID_CP1250 ::
  112. * A superset of East European ISO 8859-2 (with slightly different
  113. * ordering).
  114. *
  115. * FT_WinFNT_ID_CP1251 ::
  116. * A superset of Russian ISO 8859-5 (with different ordering).
  117. *
  118. * FT_WinFNT_ID_CP1252 ::
  119. * ANSI encoding. A superset of ISO 8859-1.
  120. *
  121. * FT_WinFNT_ID_CP1253 ::
  122. * A superset of Greek ISO 8859-7 (with minor modifications).
  123. *
  124. * FT_WinFNT_ID_CP1254 ::
  125. * A superset of Turkish ISO 8859-9.
  126. *
  127. * FT_WinFNT_ID_CP1255 ::
  128. * A superset of Hebrew ISO 8859-8 (with some modifications).
  129. *
  130. * FT_WinFNT_ID_CP1256 ::
  131. * A superset of Arabic ISO 8859-6 (with different ordering).
  132. *
  133. * FT_WinFNT_ID_CP1257 ::
  134. * A superset of Baltic ISO 8859-13 (with some deviations).
  135. *
  136. * FT_WinFNT_ID_CP1258 ::
  137. * For Vietnamese. This encoding doesn't cover all necessary
  138. * characters.
  139. *
  140. * FT_WinFNT_ID_CP1361 ::
  141. * Korean (Johab).
  142. */
  143. #define FT_WinFNT_ID_CP1252 0
  144. #define FT_WinFNT_ID_DEFAULT 1
  145. #define FT_WinFNT_ID_SYMBOL 2
  146. #define FT_WinFNT_ID_MAC 77
  147. #define FT_WinFNT_ID_CP932 128
  148. #define FT_WinFNT_ID_CP949 129
  149. #define FT_WinFNT_ID_CP1361 130
  150. #define FT_WinFNT_ID_CP936 134
  151. #define FT_WinFNT_ID_CP950 136
  152. #define FT_WinFNT_ID_CP1253 161
  153. #define FT_WinFNT_ID_CP1254 162
  154. #define FT_WinFNT_ID_CP1258 163
  155. #define FT_WinFNT_ID_CP1255 177
  156. #define FT_WinFNT_ID_CP1256 178
  157. #define FT_WinFNT_ID_CP1257 186
  158. #define FT_WinFNT_ID_CP1251 204
  159. #define FT_WinFNT_ID_CP874 222
  160. #define FT_WinFNT_ID_CP1250 238
  161. #define FT_WinFNT_ID_OEM 255
  162. /**************************************************************************
  163. *
  164. * @struct:
  165. * FT_WinFNT_HeaderRec
  166. *
  167. * @description:
  168. * Windows FNT Header info.
  169. */
  170. typedef struct FT_WinFNT_HeaderRec_
  171. {
  172. FT_UShort version;
  173. FT_ULong file_size;
  174. FT_Byte copyright[60];
  175. FT_UShort file_type;
  176. FT_UShort nominal_point_size;
  177. FT_UShort vertical_resolution;
  178. FT_UShort horizontal_resolution;
  179. FT_UShort ascent;
  180. FT_UShort internal_leading;
  181. FT_UShort external_leading;
  182. FT_Byte italic;
  183. FT_Byte underline;
  184. FT_Byte strike_out;
  185. FT_UShort weight;
  186. FT_Byte charset;
  187. FT_UShort pixel_width;
  188. FT_UShort pixel_height;
  189. FT_Byte pitch_and_family;
  190. FT_UShort avg_width;
  191. FT_UShort max_width;
  192. FT_Byte first_char;
  193. FT_Byte last_char;
  194. FT_Byte default_char;
  195. FT_Byte break_char;
  196. FT_UShort bytes_per_row;
  197. FT_ULong device_offset;
  198. FT_ULong face_name_offset;
  199. FT_ULong bits_pointer;
  200. FT_ULong bits_offset;
  201. FT_Byte reserved;
  202. FT_ULong flags;
  203. FT_UShort A_space;
  204. FT_UShort B_space;
  205. FT_UShort C_space;
  206. FT_UShort color_table_offset;
  207. FT_ULong reserved1[4];
  208. } FT_WinFNT_HeaderRec;
  209. /**************************************************************************
  210. *
  211. * @struct:
  212. * FT_WinFNT_Header
  213. *
  214. * @description:
  215. * A handle to an @FT_WinFNT_HeaderRec structure.
  216. */
  217. typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header;
  218. /**************************************************************************
  219. *
  220. * @function:
  221. * FT_Get_WinFNT_Header
  222. *
  223. * @description:
  224. * Retrieve a Windows FNT font info header.
  225. *
  226. * @input:
  227. * face ::
  228. * A handle to the input face.
  229. *
  230. * @output:
  231. * aheader ::
  232. * The WinFNT header.
  233. *
  234. * @return:
  235. * FreeType error code. 0~means success.
  236. *
  237. * @note:
  238. * This function only works with Windows FNT faces, returning an error
  239. * otherwise.
  240. */
  241. FT_EXPORT( FT_Error )
  242. FT_Get_WinFNT_Header( FT_Face face,
  243. FT_WinFNT_HeaderRec *aheader );
  244. /* */
  245. FT_END_HEADER
  246. #endif /* FTWINFNT_H_ */
  247. /* END */
  248. /* Local Variables: */
  249. /* coding: utf-8 */
  250. /* End: */