forked from id-Software/Enemy-Territory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftnames.c
68 lines (48 loc) · 2.36 KB
/
ftnames.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************/
/* */
/* ftnames.c */
/* */
/* Simple interface to access SFNT name tables (which are used */
/* to hold font names, copyright info, notices, etc.). */
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include "ftnames.h"
#include "tttypes.h"
#ifdef FT_CONFIG_OPTION_SFNT_NAMES
FT_EXPORT_FUNC( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face )
{
return face && ( FT_IS_SFNT( face ) ? ( (TT_Face)face )->num_names : 0 );
}
FT_EXPORT_FUNC( FT_Error ) FT_Get_Sfnt_Name( FT_Face face,
FT_UInt index,
FT_SfntName * aname )
{
FT_Error error = FT_Err_Invalid_Argument;
if ( aname && face && FT_IS_SFNT( face ) ) {
TT_Face ttface = (TT_Face)face;
if ( index < ttface->num_names ) {
TT_NameRec* name = ttface->name_table.names + index;
aname->platform_id = name->platformID;
aname->encoding_id = name->encodingID;
aname->language_id = name->languageID;
aname->name_id = name->nameID;
aname->string = (FT_Byte*)name->string;
aname->string_len = name->stringLength;
error = FT_Err_Ok;
}
}
return error;
}
#endif /* FT_CONFIG_OPTION_SFNT_NAMES */
/* END */