update for HEAD-2003050101
[reactos.git] / lib / freetype / src / base / ftbdf.c
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftbdf.c                                                                */
4 /*                                                                         */
5 /*    FreeType API for accessing BDF-specific strings (body).              */
6 /*                                                                         */
7 /*  Copyright 2002 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_BDF_TYPES_H
21 #include FT_INTERNAL_OBJECTS_H
22
23   static FT_Bool
24   test_font_type( FT_Face face, const char*  name )
25   {
26     if ( face && face->driver )
27     {
28       FT_Module  driver = (FT_Module)face->driver;
29
30       if ( driver->clazz && driver->clazz->module_name )
31       {
32         if ( ft_strcmp( driver->clazz->module_name, name ) == 0 )
33           return 1;
34       }
35     }
36     return 0;
37   }
38
39
40   FT_EXPORT_DEF( FT_Error )
41   FT_Get_BDF_Charset_ID( FT_Face       face,
42                          const char*  *acharset_encoding,
43                          const char*  *acharset_registry )
44   {
45     FT_Error     error;
46     const char*  encoding = NULL;
47     const char*  registry = NULL;
48
49
50     error = FT_Err_Invalid_Argument;
51
52     if ( test_font_type( face, "bdf" ) )
53     {
54       BDF_Public_Face  bdf_face = (BDF_Public_Face)face;
55
56
57       encoding = (const char*) bdf_face->charset_encoding;
58       registry = (const char*) bdf_face->charset_registry;
59       error    = 0;
60     }
61
62     if ( acharset_encoding )
63       *acharset_encoding = encoding;
64
65     if ( acharset_registry )
66       *acharset_registry = registry;
67
68     return error;
69   }
70
71
72   FT_EXPORT( FT_Error )
73   FT_Get_BDF_Property( FT_Face           face,
74                        const char*       prop_name,
75                        BDF_PropertyRec  *aproperty )
76   {
77     FT_Error   error;
78
79     error = FT_Err_Invalid_Argument;
80
81     aproperty->type = BDF_PROPERTY_TYPE_NONE;
82
83     if ( face != NULL && face->driver != NULL )
84     {
85       FT_Driver              driver = face->driver;
86       BDF_GetPropertyFunc    func;
87
88       func = (BDF_GetPropertyFunc) driver->root.clazz->get_interface(
89                              FT_MODULE( driver ), "get_bdf_property" );
90       if ( func )
91         error = func( face, prop_name, aproperty );
92     }
93     return error;
94   }
95
96 /* END */