1 /****************************************************************************
2  *
3  * fttype1.c
4  *
5  *   FreeType utility file for PS names support (body).
6  *
7  * Copyright (C) 2002-2020 by
8  * David Turner, Robert Wilhelm, and Werner Lemberg.
9  *
10  * This file is part of the FreeType project, and may only be used,
11  * modified, and distributed under the terms of the FreeType project
12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
13  * this file you indicate that you have read the license and
14  * understand and accept it fully.
15  *
16  */
17 
18 
19 #include <freetype/internal/ftdebug.h>
20 #include <freetype/internal/ftobjs.h>
21 #include <freetype/internal/ftserv.h>
22 #include <freetype/internal/services/svpsinfo.h>
23 
24 
25   /* documentation is in t1tables.h */
26 
27   FT_EXPORT_DEF( FT_Error )
FT_Get_PS_Font_Info(FT_Face face,PS_FontInfoRec * afont_info)28   FT_Get_PS_Font_Info( FT_Face          face,
29                        PS_FontInfoRec*  afont_info )
30   {
31     FT_Error           error;
32     FT_Service_PsInfo  service;
33 
34 
35     if ( !face )
36       return FT_THROW( Invalid_Face_Handle );
37 
38     if ( !afont_info )
39       return FT_THROW( Invalid_Argument );
40 
41     FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
42 
43     if ( service && service->ps_get_font_info )
44       error = service->ps_get_font_info( face, afont_info );
45     else
46       error = FT_THROW( Invalid_Argument );
47 
48     return error;
49   }
50 
51 
52   /* documentation is in t1tables.h */
53 
54   FT_EXPORT_DEF( FT_Int )
FT_Has_PS_Glyph_Names(FT_Face face)55   FT_Has_PS_Glyph_Names( FT_Face  face )
56   {
57     FT_Int             result = 0;
58     FT_Service_PsInfo  service;
59 
60 
61     if ( face )
62     {
63       FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
64 
65       if ( service && service->ps_has_glyph_names )
66         result = service->ps_has_glyph_names( face );
67     }
68 
69     return result;
70   }
71 
72 
73   /* documentation is in t1tables.h */
74 
75   FT_EXPORT_DEF( FT_Error )
FT_Get_PS_Font_Private(FT_Face face,PS_PrivateRec * afont_private)76   FT_Get_PS_Font_Private( FT_Face         face,
77                           PS_PrivateRec*  afont_private )
78   {
79     FT_Error           error;
80     FT_Service_PsInfo  service;
81 
82 
83     if ( !face )
84       return FT_THROW( Invalid_Face_Handle );
85 
86     if ( !afont_private )
87       return FT_THROW( Invalid_Argument );
88 
89     FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
90 
91     if ( service && service->ps_get_font_private )
92       error = service->ps_get_font_private( face, afont_private );
93     else
94       error = FT_THROW( Invalid_Argument );
95 
96     return error;
97   }
98 
99 
100   /* documentation is in t1tables.h */
101 
102   FT_EXPORT_DEF( FT_Long )
FT_Get_PS_Font_Value(FT_Face face,PS_Dict_Keys key,FT_UInt idx,void * value,FT_Long value_len)103   FT_Get_PS_Font_Value( FT_Face       face,
104                         PS_Dict_Keys  key,
105                         FT_UInt       idx,
106                         void         *value,
107                         FT_Long       value_len )
108   {
109     FT_Int             result  = 0;
110     FT_Service_PsInfo  service = NULL;
111 
112 
113     if ( face )
114     {
115       FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
116 
117       if ( service && service->ps_get_font_value )
118         result = service->ps_get_font_value( face, key, idx,
119                                              value, value_len );
120     }
121 
122     return result;
123   }
124 
125 
126 /* END */
127