| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftbdf.c */ | 3 /* ftbdf.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* FreeType API for accessing BDF-specific strings (body). */ | 5 /* FreeType API for accessing BDF-specific strings (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 2002-2004, 2013 by */ | 7 /* Copyright 2002-2004, 2013, 2014 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| 18 | 18 |
| 19 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
| 20 #include "../../include/freetype/internal/ftobjs.h" | 20 #include FT_INTERNAL_DEBUG_H |
| 21 #include "../../include/freetype/internal/services/svbdf.h" | 21 |
| 22 #include FT_INTERNAL_OBJECTS_H |
| 23 #include FT_SERVICE_BDF_H |
| 22 | 24 |
| 23 | 25 |
| 24 /* documentation is in ftbdf.h */ | 26 /* documentation is in ftbdf.h */ |
| 25 | 27 |
| 26 FT_EXPORT_DEF( FT_Error ) | 28 FT_EXPORT_DEF( FT_Error ) |
| 27 FT_Get_BDF_Charset_ID( FT_Face face, | 29 FT_Get_BDF_Charset_ID( FT_Face face, |
| 28 const char* *acharset_encoding, | 30 const char* *acharset_encoding, |
| 29 const char* *acharset_registry ) | 31 const char* *acharset_registry ) |
| 30 { | 32 { |
| 31 FT_Error error; | 33 FT_Error error; |
| 32 const char* encoding = NULL; | 34 const char* encoding = NULL; |
| 33 const char* registry = NULL; | 35 const char* registry = NULL; |
| 34 | 36 |
| 35 | 37 FT_Service_BDF service; |
| 36 error = FT_ERR( Invalid_Argument ); | |
| 37 | |
| 38 if ( face ) | |
| 39 { | |
| 40 FT_Service_BDF service; | |
| 41 | 38 |
| 42 | 39 |
| 43 FT_FACE_FIND_SERVICE( face, service, BDF ); | 40 if ( !face ) |
| 41 return FT_THROW( Invalid_Face_Handle ); |
| 44 | 42 |
| 45 if ( service && service->get_charset_id ) | 43 FT_FACE_FIND_SERVICE( face, service, BDF ); |
| 46 error = service->get_charset_id( face, &encoding, ®istry ); | 44 |
| 47 } | 45 if ( service && service->get_charset_id ) |
| 46 error = service->get_charset_id( face, &encoding, ®istry ); |
| 47 else |
| 48 error = FT_THROW( Invalid_Argument ); |
| 48 | 49 |
| 49 if ( acharset_encoding ) | 50 if ( acharset_encoding ) |
| 50 *acharset_encoding = encoding; | 51 *acharset_encoding = encoding; |
| 51 | 52 |
| 52 if ( acharset_registry ) | 53 if ( acharset_registry ) |
| 53 *acharset_registry = registry; | 54 *acharset_registry = registry; |
| 54 | 55 |
| 55 return error; | 56 return error; |
| 56 } | 57 } |
| 57 | 58 |
| 58 | 59 |
| 59 /* documentation is in ftbdf.h */ | 60 /* documentation is in ftbdf.h */ |
| 60 | 61 |
| 61 FT_EXPORT_DEF( FT_Error ) | 62 FT_EXPORT_DEF( FT_Error ) |
| 62 FT_Get_BDF_Property( FT_Face face, | 63 FT_Get_BDF_Property( FT_Face face, |
| 63 const char* prop_name, | 64 const char* prop_name, |
| 64 BDF_PropertyRec *aproperty ) | 65 BDF_PropertyRec *aproperty ) |
| 65 { | 66 { |
| 66 FT_Error error; | 67 FT_Error error; |
| 67 | 68 |
| 69 FT_Service_BDF service; |
| 68 | 70 |
| 69 error = FT_ERR( Invalid_Argument ); | 71 |
| 72 if ( !face ) |
| 73 return FT_THROW( Invalid_Face_Handle ); |
| 74 |
| 75 if ( !aproperty ) |
| 76 return FT_THROW( Invalid_Argument ); |
| 70 | 77 |
| 71 aproperty->type = BDF_PROPERTY_TYPE_NONE; | 78 aproperty->type = BDF_PROPERTY_TYPE_NONE; |
| 72 | 79 |
| 73 if ( face ) | 80 FT_FACE_FIND_SERVICE( face, service, BDF ); |
| 74 { | |
| 75 FT_Service_BDF service; | |
| 76 | 81 |
| 82 if ( service && service->get_property ) |
| 83 error = service->get_property( face, prop_name, aproperty ); |
| 84 else |
| 85 error = FT_THROW( Invalid_Argument ); |
| 77 | 86 |
| 78 FT_FACE_FIND_SERVICE( face, service, BDF ); | 87 return error; |
| 79 | |
| 80 if ( service && service->get_property ) | |
| 81 error = service->get_property( face, prop_name, aproperty ); | |
| 82 } | |
| 83 | |
| 84 return error; | |
| 85 } | 88 } |
| 86 | 89 |
| 87 | 90 |
| 88 /* END */ | 91 /* END */ |
| OLD | NEW |