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-2001, 2002, 2003 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 specification 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 typedef struct FT_SfntName_ 96 { 97 FT_UShort platform_id; 98 FT_UShort encoding_id; 99 FT_UShort language_id; 100 FT_UShort name_id; 101 102 FT_Byte* string; /* this string is *not* null-terminated! */ 103 FT_UInt string_len; /* in bytes */ 104 105 } FT_SfntName; 106 107 108 /*************************************************************************/ 109 /* */ 110 /* <Function> */ 111 /* FT_Get_Sfnt_Name_Count */ 112 /* */ 113 /* <Description> */ 114 /* Retrieves the number of name strings in the SFNT `name' table. */ 115 /* */ 116 /* <Input> */ 117 /* face :: A handle to the source face. */ 118 /* */ 119 /* <Return> */ 120 /* The number of strings in the `name' table. */ 121 /* */ 122 FT_EXPORT( FT_UInt ) 123 FT_Get_Sfnt_Name_Count( FT_Face face ); 124 125 126 /*************************************************************************/ 127 /* */ 128 /* <Function> */ 129 /* FT_Get_Sfnt_Name */ 130 /* */ 131 /* <Description> */ 132 /* Retrieves a string of the SFNT `name' table for a given index. */ 133 /* */ 134 /* <Input> */ 135 /* face :: A handle to the source face. */ 136 /* */ 137 /* idx :: The index of the `name' string. */ 138 /* */ 139 /* <Output> */ 140 /* aname :: The indexed FT_SfntName structure. */ 141 /* */ 142 /* <Return> */ 143 /* FreeType error code. 0 means success. */ 144 /* */ 145 /* <Note> */ 146 /* The `string' array returned in the `aname' structure is not */ 147 /* null-terminated. */ 148 /* */ 149 /* Use FT_Get_Sfnt_Name_Count() to get the total number of available */ 150 /* `name' table entries, then do a loop until you get the right */ 151 /* platform, encoding, and name ID. */ 152 /* */ 153 FT_EXPORT( FT_Error ) 154 FT_Get_Sfnt_Name( FT_Face face, 155 FT_UInt idx, 156 FT_SfntName *aname ); 157 158 159 /* */ 160 161 162 FT_END_HEADER 163 164 #endif /* __FT_SFNT_NAMES_H__ */ 165 166 167 /* END */ 168