update for HEAD-2003050101
[reactos.git] / lib / freetype / src / base / ftpfr.c
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftpfr.c                                                                */
4 /*                                                                         */
5 /*    FreeType API for accessing PFR-specific data                         */
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 #include <ft2build.h>
19 #include FT_INTERNAL_PFR_H
20 #include FT_INTERNAL_OBJECTS_H
21
22
23  /* check the format */
24   static FT_Error
25   ft_pfr_check( FT_Face           face,
26                 FT_PFR_Service   *aservice )
27   {
28     FT_Error  error = FT_Err_Bad_Argument;
29
30     if ( face && face->driver )
31     {
32       FT_Module    module = (FT_Module) face->driver;
33       const char*  name   = module->clazz->module_name;
34
35       if ( name[0] == 'p' &&
36            name[1] == 'f' &&
37            name[2] == 'r' &&
38            name[4] == 0   )
39       {
40         *aservice = (FT_PFR_Service) module->clazz->module_interface;
41         error = 0;
42       }
43     }
44     return error;
45   }
46
47
48
49   FT_EXPORT_DEF( FT_Error )
50   FT_Get_PFR_Metrics( FT_Face     face,
51                       FT_UInt    *aoutline_resolution,
52                       FT_UInt    *ametrics_resolution,
53                       FT_Fixed   *ametrics_x_scale,
54                       FT_Fixed   *ametrics_y_scale )
55   {
56     FT_Error        error;
57     FT_PFR_Service  service;
58
59     error = ft_pfr_check( face, &service );
60     if ( !error )
61     {
62       error = service->get_metrics( face,
63                                     aoutline_resolution,
64                                     ametrics_resolution,
65                                     ametrics_x_scale,
66                                     ametrics_y_scale );
67     }
68     return error;
69   }
70
71   FT_EXPORT_DEF( FT_Error )
72   FT_Get_PFR_Kerning( FT_Face     face,
73                       FT_UInt     left,
74                       FT_UInt     right,
75                       FT_Vector  *avector )
76   {
77     FT_Error        error;
78     FT_PFR_Service  service;
79
80     error = ft_pfr_check( face, &service );
81     if ( !error )
82     {
83       error = service->get_kerning( face, left, right, avector );
84     }
85     return error;
86   }
87
88
89   FT_EXPORT_DEF( FT_Error )
90   FT_Get_PFR_Advance( FT_Face    face,
91                       FT_UInt    gindex,
92                       FT_Pos    *aadvance )
93   {
94     FT_Error        error;
95     FT_PFR_Service  service;
96
97     error = ft_pfr_check( face, &service );
98     if ( !error )
99     {
100       error = service->get_advance( face, gindex, aadvance );
101     }
102     return error;
103   }
104
105 /* END */