1 /***************************************************************************/
5 /* Simple interface to access SFNT `name' tables (which are used */
6 /* to hold font names, copyright info, notices, etc.) (specification). */
8 /* This is _not_ used to retrieve glyph names! */
10 /* Copyright 1996-2018 by */
11 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
19 /***************************************************************************/
27 #include FT_FREETYPE_H
28 #include FT_PARAMETER_TAGS_H
31 #error "freetype.h of FreeType 1 has been loaded!"
32 #error "Please fix the directory search order for header files"
33 #error "so that freetype.h of FreeType 2 is found first."
40 /*************************************************************************/
49 /* Access the names embedded in TrueType and OpenType files. */
52 /* The TrueType and OpenType specifications allow the inclusion of */
53 /* a special names table (`name') in font files. This table contains */
54 /* textual (and internationalized) information regarding the font, */
55 /* like family name, copyright, version, etc. */
57 /* The definitions below are used to access them if available. */
59 /* Note that this has nothing to do with glyph names! */
61 /*************************************************************************/
64 /*************************************************************************/
70 /* A structure used to model an SFNT `name' table entry. */
73 /* platform_id :: The platform ID for `string'. */
74 /* See @TT_PLATFORM_XXX for possible values. */
76 /* encoding_id :: The encoding ID for `string'. */
77 /* See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX, */
78 /* @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX */
79 /* for possible values. */
81 /* language_id :: The language ID for `string'. */
82 /* See @TT_MAC_LANGID_XXX and @TT_MS_LANGID_XXX for */
83 /* possible values. */
85 /* Registered OpenType values for `language_id' are */
86 /* always smaller than 0x8000; values equal or larger */
87 /* than 0x8000 usually indicate a language tag string */
88 /* (introduced in OpenType version 1.6). Use function */
89 /* @FT_Get_Sfnt_LangTag with `language_id' as its */
90 /* argument to retrieve the associated language tag. */
92 /* name_id :: An identifier for `string'. */
93 /* See @TT_NAME_ID_XXX for possible values. */
95 /* string :: The `name' string. Note that its format differs */
96 /* depending on the (platform,encoding) pair, being */
97 /* either a string of bytes (without a terminating */
98 /* NULL byte) or containing UTF-16BE entities. */
100 /* string_len :: The length of `string' in bytes. */
103 /* Please refer to the TrueType or OpenType specification for more */
106 typedef struct FT_SfntName_
108 FT_UShort platform_id
;
109 FT_UShort encoding_id
;
110 FT_UShort language_id
;
113 FT_Byte
* string
; /* this string is *not* null-terminated! */
114 FT_UInt string_len
; /* in bytes */
119 /*************************************************************************/
122 /* FT_Get_Sfnt_Name_Count */
125 /* Retrieve the number of name strings in the SFNT `name' table. */
128 /* face :: A handle to the source face. */
131 /* The number of strings in the `name' table. */
134 FT_Get_Sfnt_Name_Count( FT_Face face
);
137 /*************************************************************************/
140 /* FT_Get_Sfnt_Name */
143 /* Retrieve a string of the SFNT `name' table for a given index. */
146 /* face :: A handle to the source face. */
148 /* idx :: The index of the `name' string. */
151 /* aname :: The indexed @FT_SfntName structure. */
154 /* FreeType error code. 0~means success. */
157 /* The `string' array returned in the `aname' structure is not */
158 /* null-terminated. Note that you don't have to deallocate `string' */
159 /* by yourself; FreeType takes care of it if you call @FT_Done_Face. */
161 /* Use @FT_Get_Sfnt_Name_Count to get the total number of available */
162 /* `name' table entries, then do a loop until you get the right */
163 /* platform, encoding, and name ID. */
165 /* `name' table format~1 entries can use language tags also, see */
166 /* @FT_Get_Sfnt_LangTag. */
168 FT_EXPORT( FT_Error
)
169 FT_Get_Sfnt_Name( FT_Face face
,
171 FT_SfntName
*aname
);
174 /*************************************************************************/
180 /* A structure to model a language tag entry from an SFNT `name' */
184 /* string :: The language tag string, encoded in UTF-16BE */
185 /* (without trailing NULL bytes). */
187 /* string_len :: The length of `string' in *bytes*. */
190 /* Please refer to the TrueType or OpenType specification for more */
196 typedef struct FT_SfntLangTag_
198 FT_Byte
* string
; /* this string is *not* null-terminated! */
199 FT_UInt string_len
; /* in bytes */
204 /*************************************************************************/
207 /* FT_Get_Sfnt_LangTag */
210 /* Retrieve the language tag associated with a language ID of an SFNT */
211 /* `name' table entry. */
214 /* face :: A handle to the source face. */
216 /* langID :: The language ID, as returned by @FT_Get_Sfnt_Name. */
217 /* This is always a value larger than 0x8000. */
220 /* alangTag :: The language tag associated with the `name' table */
221 /* entry's language ID. */
224 /* FreeType error code. 0~means success. */
227 /* The `string' array returned in the `alangTag' structure is not */
228 /* null-terminated. Note that you don't have to deallocate `string' */
229 /* by yourself; FreeType takes care of it if you call @FT_Done_Face. */
231 /* Only `name' table format~1 supports language tags. For format~0 */
232 /* tables, this function always returns FT_Err_Invalid_Table. For */
233 /* invalid format~1 language ID values, FT_Err_Invalid_Argument is */
239 FT_EXPORT( FT_Error
)
240 FT_Get_Sfnt_LangTag( FT_Face face
,
242 FT_SfntLangTag
*alangTag
);
250 #endif /* FTSNAMES_H_ */