1 /***************************************************************************/
5 /* FreeType API for accessing PFR-specific data (body). */
7 /* Copyright 2002-2004, 2008, 2010, 2013 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
19 #include FT_INTERNAL_DEBUG_H
21 #include FT_INTERNAL_OBJECTS_H
22 #include FT_SERVICE_PFR_H
25 /* check the format */
26 static FT_Service_PfrMetrics
27 ft_pfr_check( FT_Face face
)
29 FT_Service_PfrMetrics service
= NULL
;
33 FT_FACE_LOOKUP_SERVICE( face
, service
, PFR_METRICS
);
39 /* documentation is in ftpfr.h */
41 FT_EXPORT_DEF( FT_Error
)
42 FT_Get_PFR_Metrics( FT_Face face
,
43 FT_UInt
*aoutline_resolution
,
44 FT_UInt
*ametrics_resolution
,
45 FT_Fixed
*ametrics_x_scale
,
46 FT_Fixed
*ametrics_y_scale
)
48 FT_Error error
= FT_Err_Ok
;
49 FT_Service_PfrMetrics service
;
53 return FT_THROW( Invalid_Argument
);
55 service
= ft_pfr_check( face
);
58 error
= service
->get_metrics( face
,
66 FT_Fixed x_scale
, y_scale
;
69 /* this is not a PFR font */
70 if ( aoutline_resolution
)
71 *aoutline_resolution
= face
->units_per_EM
;
73 if ( ametrics_resolution
)
74 *ametrics_resolution
= face
->units_per_EM
;
76 x_scale
= y_scale
= 0x10000L
;
79 x_scale
= face
->size
->metrics
.x_scale
;
80 y_scale
= face
->size
->metrics
.y_scale
;
83 if ( ametrics_x_scale
)
84 *ametrics_x_scale
= x_scale
;
86 if ( ametrics_y_scale
)
87 *ametrics_y_scale
= y_scale
;
89 error
= FT_THROW( Unknown_File_Format
);
96 /* documentation is in ftpfr.h */
98 FT_EXPORT_DEF( FT_Error
)
99 FT_Get_PFR_Kerning( FT_Face face
,
105 FT_Service_PfrMetrics service
;
109 return FT_THROW( Invalid_Argument
);
111 service
= ft_pfr_check( face
);
113 error
= service
->get_kerning( face
, left
, right
, avector
);
115 error
= FT_Get_Kerning( face
, left
, right
,
116 FT_KERNING_UNSCALED
, avector
);
122 /* documentation is in ftpfr.h */
124 FT_EXPORT_DEF( FT_Error
)
125 FT_Get_PFR_Advance( FT_Face face
,
130 FT_Service_PfrMetrics service
;
133 service
= ft_pfr_check( face
);
136 error
= service
->get_advance( face
, gindex
, aadvance
);
139 /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
140 error
= FT_THROW( Invalid_Argument
);