00001 /***************************************************************************/ 00002 /* */ 00003 /* ftsnames.h */ 00004 /* */ 00005 /* Simple interface to access SFNT name tables (which are used */ 00006 /* to hold font names, copyright info, notices, etc.) (specification). */ 00007 /* */ 00008 /* This is _not_ used to retrieve glyph names! */ 00009 /* */ 00010 /* Copyright 1996-2001, 2002, 2003, 2006, 2009, 2010 by */ 00011 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00012 /* */ 00013 /* This file is part of the FreeType project, and may only be used, */ 00014 /* modified, and distributed under the terms of the FreeType project */ 00015 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00016 /* this file you indicate that you have read the license and */ 00017 /* understand and accept it fully. */ 00018 /* */ 00019 /***************************************************************************/ 00020 00021 00022 #ifndef __FT_SFNT_NAMES_H__ 00023 #define __FT_SFNT_NAMES_H__ 00024 00025 00026 #include <ft2build.h> 00027 #include FT_FREETYPE_H 00028 00029 #ifdef FREETYPE_H 00030 #error "freetype.h of FreeType 1 has been loaded!" 00031 #error "Please fix the directory search order for header files" 00032 #error "so that freetype.h of FreeType 2 is found first." 00033 #endif 00034 00035 00036 FT_BEGIN_HEADER 00037 00038 00039 /*************************************************************************/ 00040 /* */ 00041 /* <Section> */ 00042 /* sfnt_names */ 00043 /* */ 00044 /* <Title> */ 00045 /* SFNT Names */ 00046 /* */ 00047 /* <Abstract> */ 00048 /* Access the names embedded in TrueType and OpenType files. */ 00049 /* */ 00050 /* <Description> */ 00051 /* The TrueType and OpenType specifications allow the inclusion of */ 00052 /* a special `names table' in font files. This table contains */ 00053 /* textual (and internationalized) information regarding the font, */ 00054 /* like family name, copyright, version, etc. */ 00055 /* */ 00056 /* The definitions below are used to access them if available. */ 00057 /* */ 00058 /* Note that this has nothing to do with glyph names! */ 00059 /* */ 00060 /*************************************************************************/ 00061 00062 00063 /*************************************************************************/ 00064 /* */ 00065 /* <Struct> */ 00066 /* FT_SfntName */ 00067 /* */ 00068 /* <Description> */ 00069 /* A structure used to model an SFNT `name' table entry. */ 00070 /* */ 00071 /* <Fields> */ 00072 /* platform_id :: The platform ID for `string'. */ 00073 /* */ 00074 /* encoding_id :: The encoding ID for `string'. */ 00075 /* */ 00076 /* language_id :: The language ID for `string'. */ 00077 /* */ 00078 /* name_id :: An identifier for `string'. */ 00079 /* */ 00080 /* string :: The `name' string. Note that its format differs */ 00081 /* depending on the (platform,encoding) pair. It can */ 00082 /* be a Pascal String, a UTF-16 one, etc. */ 00083 /* */ 00084 /* Generally speaking, the string is not */ 00085 /* zero-terminated. Please refer to the TrueType */ 00086 /* specification for details. */ 00087 /* */ 00088 /* string_len :: The length of `string' in bytes. */ 00089 /* */ 00090 /* <Note> */ 00091 /* Possible values for `platform_id', `encoding_id', `language_id', */ 00092 /* and `name_id' are given in the file `ttnameid.h'. For details */ 00093 /* please refer to the TrueType or OpenType specification. */ 00094 /* */ 00095 /* See also @TT_PLATFORM_XXX, @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */ 00096 /* @TT_ISO_ID_XXX, and @TT_MS_ID_XXX. */ 00097 /* */ 00098 typedef struct FT_SfntName_ 00099 { 00100 FT_UShort platform_id; 00101 FT_UShort encoding_id; 00102 FT_UShort language_id; 00103 FT_UShort name_id; 00104 00105 FT_Byte* string; /* this string is *not* null-terminated! */ 00106 FT_UInt string_len; /* in bytes */ 00107 00108 } FT_SfntName; 00109 00110 00111 /*************************************************************************/ 00112 /* */ 00113 /* <Function> */ 00114 /* FT_Get_Sfnt_Name_Count */ 00115 /* */ 00116 /* <Description> */ 00117 /* Retrieve the number of name strings in the SFNT `name' table. */ 00118 /* */ 00119 /* <Input> */ 00120 /* face :: A handle to the source face. */ 00121 /* */ 00122 /* <Return> */ 00123 /* The number of strings in the `name' table. */ 00124 /* */ 00125 FT_EXPORT( FT_UInt ) 00126 FT_Get_Sfnt_Name_Count( FT_Face face ); 00127 00128 00129 /*************************************************************************/ 00130 /* */ 00131 /* <Function> */ 00132 /* FT_Get_Sfnt_Name */ 00133 /* */ 00134 /* <Description> */ 00135 /* Retrieve a string of the SFNT `name' table for a given index. */ 00136 /* */ 00137 /* <Input> */ 00138 /* face :: A handle to the source face. */ 00139 /* */ 00140 /* idx :: The index of the `name' string. */ 00141 /* */ 00142 /* <Output> */ 00143 /* aname :: The indexed @FT_SfntName structure. */ 00144 /* */ 00145 /* <Return> */ 00146 /* FreeType error code. 0~means success. */ 00147 /* */ 00148 /* <Note> */ 00149 /* The `string' array returned in the `aname' structure is not */ 00150 /* null-terminated. The application should deallocate it if it is no */ 00151 /* longer in use. */ 00152 /* */ 00153 /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */ 00154 /* `name' table entries, then do a loop until you get the right */ 00155 /* platform, encoding, and name ID. */ 00156 /* */ 00157 FT_EXPORT( FT_Error ) 00158 FT_Get_Sfnt_Name( FT_Face face, 00159 FT_UInt idx, 00160 FT_SfntName *aname ); 00161 00162 00163 /*************************************************************************** 00164 * 00165 * @constant: 00166 * FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY 00167 * 00168 * @description: 00169 * A constant used as the tag of @FT_Parameter structures to make 00170 * FT_Open_Face() ignore preferred family subfamily names in `name' 00171 * table since OpenType version 1.4. For backwards compatibility with 00172 * legacy systems which has 4-face-per-family restriction. 00173 * 00174 */ 00175 #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) 00176 00177 00178 /*************************************************************************** 00179 * 00180 * @constant: 00181 * FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY 00182 * 00183 * @description: 00184 * A constant used as the tag of @FT_Parameter structures to make 00185 * FT_Open_Face() ignore preferred subfamily names in `name' table since 00186 * OpenType version 1.4. For backwards compatibility with legacy 00187 * systems which has 4-face-per-family restriction. 00188 * 00189 */ 00190 #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY FT_MAKE_TAG( 'i', 'g', 'p', 's' ) 00191 00192 /* */ 00193 00194 00195 FT_END_HEADER 00196 00197 #endif /* __FT_SFNT_NAMES_H__ */ 00198 00199 00200 /* END */