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