1
/***************************************************************************/
5
/* FreeType API for accessing PFR-specific data (body). */
7
/* Copyright 2002, 2003, 2004, 2008, 2010 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_OBJECTS_H
20
#include FT_SERVICE_PFR_H
23
/* check the format */
24
static FT_Service_PfrMetrics
25
ft_pfr_check( FT_Face face )
27
FT_Service_PfrMetrics service = NULL;
31
FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
37
/* documentation is in ftpfr.h */
39
FT_EXPORT_DEF( FT_Error )
40
FT_Get_PFR_Metrics( FT_Face face,
41
FT_UInt *aoutline_resolution,
42
FT_UInt *ametrics_resolution,
43
FT_Fixed *ametrics_x_scale,
44
FT_Fixed *ametrics_y_scale )
46
FT_Error error = FT_Err_Ok;
47
FT_Service_PfrMetrics service;
51
return FT_Err_Invalid_Argument;
53
service = ft_pfr_check( face );
56
error = service->get_metrics( face,
64
FT_Fixed x_scale, y_scale;
67
/* this is not a PFR font */
68
if ( aoutline_resolution )
69
*aoutline_resolution = face->units_per_EM;
71
if ( ametrics_resolution )
72
*ametrics_resolution = face->units_per_EM;
74
x_scale = y_scale = 0x10000L;
77
x_scale = face->size->metrics.x_scale;
78
y_scale = face->size->metrics.y_scale;
81
if ( ametrics_x_scale )
82
*ametrics_x_scale = x_scale;
84
if ( ametrics_y_scale )
85
*ametrics_y_scale = y_scale;
87
error = FT_Err_Unknown_File_Format;
94
/* documentation is in ftpfr.h */
96
FT_EXPORT_DEF( FT_Error )
97
FT_Get_PFR_Kerning( FT_Face face,
103
FT_Service_PfrMetrics service;
107
return FT_Err_Invalid_Argument;
109
service = ft_pfr_check( face );
111
error = service->get_kerning( face, left, right, avector );
113
error = FT_Get_Kerning( face, left, right,
114
FT_KERNING_UNSCALED, avector );
120
/* documentation is in ftpfr.h */
122
FT_EXPORT_DEF( FT_Error )
123
FT_Get_PFR_Advance( FT_Face face,
128
FT_Service_PfrMetrics service;
131
service = ft_pfr_check( face );
134
error = service->get_advance( face, gindex, aadvance );
137
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
138
error = FT_Err_Invalid_Argument;