| 1 | /**************************************************************************** | 
| 2 |  * | 
| 3 |  * ftbdf.c | 
| 4 |  * | 
| 5 |  *   FreeType API for accessing BDF-specific strings (body). | 
| 6 |  * | 
| 7 |  * Copyright (C) 2002-2023 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 |  | 
| 21 | #include <freetype/internal/ftobjs.h> | 
| 22 | #include <freetype/internal/services/svbdf.h> | 
| 23 |  | 
| 24 |  | 
| 25 |   /* documentation is in ftbdf.h */ | 
| 26 |  | 
| 27 |   FT_EXPORT_DEF( FT_Error ) | 
| 28 |   FT_Get_BDF_Charset_ID( FT_Face       face, | 
| 29 |                          const char*  *acharset_encoding, | 
| 30 |                          const char*  *acharset_registry ) | 
| 31 |   { | 
| 32 |     FT_Error     error; | 
| 33 |     const char*  encoding = NULL; | 
| 34 |     const char*  registry = NULL; | 
| 35 |  | 
| 36 |     FT_Service_BDF  service; | 
| 37 |  | 
| 38 |  | 
| 39 |     if ( !face ) | 
| 40 |       return FT_THROW( Invalid_Face_Handle ); | 
| 41 |  | 
| 42 |     FT_FACE_FIND_SERVICE( face, service, BDF ); | 
| 43 |  | 
| 44 |     if ( service && service->get_charset_id ) | 
| 45 |       error = service->get_charset_id( face, &encoding, ®istry ); | 
| 46 |     else | 
| 47 |       error = FT_THROW( Invalid_Argument ); | 
| 48 |  | 
| 49 |     if ( acharset_encoding ) | 
| 50 |       *acharset_encoding = encoding; | 
| 51 |  | 
| 52 |     if ( acharset_registry ) | 
| 53 |       *acharset_registry = registry; | 
| 54 |  | 
| 55 |     return error; | 
| 56 |   } | 
| 57 |  | 
| 58 |  | 
| 59 |   /* documentation is in ftbdf.h */ | 
| 60 |  | 
| 61 |   FT_EXPORT_DEF( FT_Error ) | 
| 62 |   FT_Get_BDF_Property( FT_Face           face, | 
| 63 |                        const char*       prop_name, | 
| 64 |                        BDF_PropertyRec  *aproperty ) | 
| 65 |   { | 
| 66 |     FT_Error  error; | 
| 67 |  | 
| 68 |     FT_Service_BDF  service; | 
| 69 |  | 
| 70 |  | 
| 71 |     if ( !face ) | 
| 72 |       return FT_THROW( Invalid_Face_Handle ); | 
| 73 |  | 
| 74 |     if ( !aproperty ) | 
| 75 |       return FT_THROW( Invalid_Argument ); | 
| 76 |  | 
| 77 |     aproperty->type = BDF_PROPERTY_TYPE_NONE; | 
| 78 |  | 
| 79 |     FT_FACE_FIND_SERVICE( face, service, BDF ); | 
| 80 |  | 
| 81 |     if ( service && service->get_property ) | 
| 82 |       error = service->get_property( face, prop_name, aproperty ); | 
| 83 |     else | 
| 84 |       error = FT_THROW( Invalid_Argument ); | 
| 85 |  | 
| 86 |     return error; | 
| 87 |   } | 
| 88 |  | 
| 89 |  | 
| 90 | /* END */ | 
| 91 |  |