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 <ft2build.h>
  20 #include FT_INTERNAL_DEBUG_H
  21 #include FT_INTERNAL_OBJECTS_H
  22 #include FT_INTERNAL_SERVICE_H
  23 #include FT_SERVICE_POSTSCRIPT_INFO_H
  24 
  25 
  26   /* documentation is in t1tables.h */
  27 
  28   FT_EXPORT_DEF( FT_Error )
  29   FT_Get_PS_Font_Info( FT_Face          face,
  30                        PS_FontInfoRec*  afont_info )
  31   {
  32     FT_Error           error;
  33     FT_Service_PsInfo  service;
  34 
  35 
  36     if ( !face )
  37       return FT_THROW( Invalid_Face_Handle );
  38 
  39     if ( !afont_info )
  40       return FT_THROW( Invalid_Argument );
  41 
  42     FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
  43 
  44     if ( service && service->ps_get_font_info )
  45       error = service->ps_get_font_info( face, afont_info );
  46     else
  47       error = FT_THROW( Invalid_Argument );
  48 
  49     return error;
  50   }
  51 
  52 
  53   /* documentation is in t1tables.h */
  54 
  55   FT_EXPORT_DEF( FT_Int )
  56   FT_Has_PS_Glyph_Names( FT_Face  face )
  57   {
  58     FT_Int             result = 0;
  59     FT_Service_PsInfo  service;
  60 
  61 
  62     if ( face )
  63     {
  64       FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
  65 
  66       if ( service && service->ps_has_glyph_names )
  67         result = service->ps_has_glyph_names( face );
  68     }
  69 
  70     return result;
  71   }
  72 
  73 
  74   /* documentation is in t1tables.h */
  75 
  76   FT_EXPORT_DEF( FT_Error )
  77   FT_Get_PS_Font_Private( FT_Face         face,
  78                           PS_PrivateRec*  afont_private )
  79   {
  80     FT_Error           error;
  81     FT_Service_PsInfo  service;
  82 
  83 
  84     if ( !face )
  85       return FT_THROW( Invalid_Face_Handle );
  86 
  87     if ( !afont_private )
  88       return FT_THROW( Invalid_Argument );
  89 
  90     FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
  91 
  92     if ( service && service->ps_get_font_private )
  93       error = service->ps_get_font_private( face, afont_private );
  94     else
  95       error = FT_THROW( Invalid_Argument );
  96 
  97     return error;
  98   }
  99 
 100 
 101   /* documentation is in t1tables.h */
 102 
 103   FT_EXPORT_DEF( FT_Long )
 104   FT_Get_PS_Font_Value( FT_Face       face,
 105                         PS_Dict_Keys  key,
 106                         FT_UInt       idx,
 107                         void         *value,
 108                         FT_Long       value_len )
 109   {
 110     FT_Int             result  = 0;
 111     FT_Service_PsInfo  service = NULL;
 112 
 113 
 114     if ( face )
 115     {
 116       FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
 117 
 118       if ( service && service->ps_get_font_value )
 119         result = service->ps_get_font_value( face, key, idx,
 120                                              value, value_len );
 121     }
 122 
 123     return result;
 124   }
 125 
 126 
 127 /* END */