1 /***************************************************************************/ 2 /* */ 3 /* ftsnames.h */ 4 /* */ 5 /* Simple interface to access SFNT name tables (which are used */ 6 /* to hold font names, copyright info, notices, etc.) (specification). */ 7 /* */ 8 /* This is _not_ used to retrieve glyph names! */ 9 /* */ 10 /* Copyright 1996-2015 by */ 11 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 12 /* */ 13 /* This file is part of the FreeType project, and may only be used, */ 14 /* modified, and distributed under the terms of the FreeType project */ 15 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 16 /* this file you indicate that you have read the license and */ 17 /* understand and accept it fully. */ 18 /* */ 19 /***************************************************************************/ 20 21 22 #ifndef __FT_SFNT_NAMES_H__ 23 #define __FT_SFNT_NAMES_H__ 24 25 26 #include <ft2build.h> 27 #include FT_FREETYPE_H 28 29 #ifdef FREETYPE_H 30 #error "freetype.h of FreeType 1 has been loaded!" 31 #error "Please fix the directory search order for header files" 32 #error "so that freetype.h of FreeType 2 is found first." 33 #endif 34 35 36 FT_BEGIN_HEADER 37 38 39 /*************************************************************************/ 40 /* */ 41 /* <Section> */ 42 /* sfnt_names */ 43 /* */ 44 /* <Title> */ 45 /* SFNT Names */ 46 /* */ 47 /* <Abstract> */ 48 /* Access the names embedded in TrueType and OpenType files. */ 49 /* */ 50 /* <Description> */ 51 /* The TrueType and OpenType specifications allow the inclusion of */ 52 /* a special `names table' in font files. This table contains */ 53 /* textual (and internationalized) information regarding the font, */ 54 /* like family name, copyright, version, etc. */ 55 /* */ 56 /* The definitions below are used to access them if available. */ 57 /* */ 58 /* Note that this has nothing to do with glyph names! */ 59 /* */ 60 /*************************************************************************/ 61 62 63 /*************************************************************************/ 64 /* */ 65 /* <Struct> */ 66 /* FT_SfntName */ 67 /* */ 68 /* <Description> */ 69 /* A structure used to model an SFNT `name' table entry. */ 70 /* */ 71 /* <Fields> */ 72 /* platform_id :: The platform ID for `string'. */ 73 /* */ 74 /* encoding_id :: The encoding ID for `string'. */ 75 /* */ 76 /* language_id :: The language ID for `string'. */ 77 /* */ 78 /* name_id :: An identifier for `string'. */ 79 /* */ 80 /* string :: The `name' string. Note that its format differs */ 81 /* depending on the (platform,encoding) pair. It can */ 82 /* be a Pascal String, a UTF-16 one, etc. */ 83 /* */ 84 /* Generally speaking, the string is not */ 85 /* zero-terminated. Please refer to the TrueType */ 86 /* specification for details. */ 87 /* */ 88 /* string_len :: The length of `string' in bytes. */ 89 /* */ 90 /* <Note> */ 91 /* Possible values for `platform_id', `encoding_id', `language_id', */ 92 /* and `name_id' are given in the file `ttnameid.h'. For details */ 93 /* please refer to the TrueType or OpenType specification. */ 94 /* */ 95 /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ 96 /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */ 97 /* */ 98 typedef struct FT_SfntName_ 99 { 100 FT_UShort platform_id; 101 FT_UShort encoding_id; 102 FT_UShort language_id; 103 FT_UShort name_id; 104 105 FT_Byte* string; /* this string is *not* null-terminated! */ 106 FT_UInt string_len; /* in bytes */ 107 108 } FT_SfntName; 109 110 111 /*************************************************************************/ 112 /* */ 113 /* <Function> */ 114 /* FT_Get_Sfnt_Name_Count */ 115 /* */ 116 /* <Description> */ 117 /* Retrieve the number of name strings in the SFNT `name' table. */ 118 /* */ 119 /* <Input> */ 120 /* face :: A handle to the source face. */ 121 /* */ 122 /* <Return> */ 123 /* The number of strings in the `name' table. */ 124 /* */ 125 FT_EXPORT( FT_UInt ) 126 FT_Get_Sfnt_Name_Count( FT_Face face ); 127 128 129 /*************************************************************************/ 130 /* */ 131 /* <Function> */ 132 /* FT_Get_Sfnt_Name */ 133 /* */ 134 /* <Description> */ 135 /* Retrieve a string of the SFNT `name' table for a given index. */ 136 /* */ 137 /* <Input> */ 138 /* face :: A handle to the source face. */ 139 /* */ 140 /* idx :: The index of the `name' string. */ 141 /* */ 142 /* <Output> */ 143 /* aname :: The indexed @FT_SfntName structure. */ 144 /* */ 145 /* <Return> */ 146 /* FreeType error code. 0~means success. */ 147 /* */ 148 /* <Note> */ 149 /* The `string' array returned in the `aname' structure is not */ 150 /* null-terminated. The application should deallocate it if it is no */ 151 /* longer in use. */ 152 /* */ 153 /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ 154 /* `name' table entries, then do a loop until you get the right */ 155 /* platform, encoding, and name ID. */ 156 /* */ 157 FT_EXPORT( FT_Error ) 158 FT_Get_Sfnt_Name( FT_Face face, 159 FT_UInt idx, 160 FT_SfntName *aname ); 161 162 163 /*************************************************************************** 164 * 165 * @constant: 166 * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY 167 * 168 * @description: 169 * A constant used as the tag of @FT_Parameter structures to make 170 * FT_Open_Face() ignore preferred family subfamily names in `name' 171 * table since OpenType version 1.4. For backwards compatibility with 172 * legacy systems that have a 4-face-per-family restriction. 173 * 174 */ 175 #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) 176 177 178 /*************************************************************************** 179 * 180 * @constant: 181 * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY 182 * 183 * @description: 184 * A constant used as the tag of @FT_Parameter structures to make 185 * FT_Open_Face() ignore preferred subfamily names in `name' table since 186 * OpenType version 1.4. For backwards compatibility with legacy 187 * systems that have a 4-face-per-family restriction. 188 * 189 */ 190 #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) 191 192 /* */ 193 194 195 FT_END_HEADER 196 197 #endif /* __FT_SFNT_NAMES_H__ */ 198 199 200 /* END */ 201