]> git.saurik.com Git - wxWidgets.git/blame - src/freetype/base/ftnames.c
Merged some STC fixes over to the main branch
[wxWidgets.git] / src / freetype / base / ftnames.c
CommitLineData
cabec872
RR
1/***************************************************************************/
2/* */
3/* ftnames.c */
4/* */
5/* Simple interface to access SFNT name tables (which are used */
6/* to hold font names, copyright info, notices, etc.). */
7/* */
8/* This is _not_ used to retrieve glyph names! */
9/* */
10/* Copyright 1996-2000 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#include <freetype/ftnames.h>
23#include <freetype/internal/tttypes.h>
24
25
26#ifdef FT_CONFIG_OPTION_SFNT_NAMES
27
28
29 FT_EXPORT_FUNC( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face )
30 {
31 return face && ( FT_IS_SFNT( face ) ? ((TT_Face)face)->num_names : 0 );
32 }
33
34
35 FT_EXPORT_FUNC( FT_Error ) FT_Get_Sfnt_Name( FT_Face face,
36 FT_UInt index,
37 FT_SfntName* aname )
38 {
39 FT_Error error = FT_Err_Invalid_Argument;
40
41
42 if ( aname && face && FT_IS_SFNT( face ) )
43 {
44 TT_Face ttface = (TT_Face)face;
45
46
47 if ( index < ttface->num_names )
48 {
49 TT_NameRec* name = ttface->name_table.names + index;
50
51
52 aname->platform_id = name->platformID;
53 aname->encoding_id = name->encodingID;
54 aname->language_id = name->languageID;
55 aname->name_id = name->nameID;
56 aname->string = (FT_Byte*)name->string;
57 aname->string_len = name->stringLength;
58
59 error = FT_Err_Ok;
60 }
61 }
62
63 return error;
64 }
65
66
67#endif /* FT_CONFIG_OPTION_SFNT_NAMES */
68
69
70/* END */