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