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