zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ftpfr.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ftpfr.c */
4 /* */
5 /* FreeType API for accessing PFR-specific data (body). */
6 /* */
7 /* Copyright 2002, 2003, 2004, 2008, 2010 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_OBJECTS_H
20 #include FT_SERVICE_PFR_H
21 
22 
23  /* check the format */
24  static FT_Service_PfrMetrics
26  {
27  FT_Service_PfrMetrics service = NULL;
28 
29 
30  if ( face )
31  FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
32 
33  return service;
34  }
35 
36 
37  /* documentation is in ftpfr.h */
38 
41  FT_UInt *aoutline_resolution,
42  FT_UInt *ametrics_resolution,
43  FT_Fixed *ametrics_x_scale,
44  FT_Fixed *ametrics_y_scale )
45  {
47  FT_Service_PfrMetrics service;
48 
49 
50  if ( !face )
52 
53  service = ft_pfr_check( face );
54  if ( service )
55  {
56  error = service->get_metrics( face,
57  aoutline_resolution,
58  ametrics_resolution,
59  ametrics_x_scale,
60  ametrics_y_scale );
61  }
62  else
63  {
64  FT_Fixed x_scale, y_scale;
65 
66 
67  /* this is not a PFR font */
68  if ( aoutline_resolution )
69  *aoutline_resolution = face->units_per_EM;
70 
71  if ( ametrics_resolution )
72  *ametrics_resolution = face->units_per_EM;
73 
74  x_scale = y_scale = 0x10000L;
75  if ( face->size )
76  {
77  x_scale = face->size->metrics.x_scale;
78  y_scale = face->size->metrics.y_scale;
79  }
80 
81  if ( ametrics_x_scale )
82  *ametrics_x_scale = x_scale;
83 
84  if ( ametrics_y_scale )
85  *ametrics_y_scale = y_scale;
86 
87  error = FT_Err_Unknown_File_Format;
88  }
89 
90  return error;
91  }
92 
93 
94  /* documentation is in ftpfr.h */
95 
98  FT_UInt left,
99  FT_UInt right,
100  FT_Vector *avector )
101  {
102  FT_Error error;
103  FT_Service_PfrMetrics service;
104 
105 
106  if ( !face )
108 
109  service = ft_pfr_check( face );
110  if ( service )
111  error = service->get_kerning( face, left, right, avector );
112  else
113  error = FT_Get_Kerning( face, left, right,
114  FT_KERNING_UNSCALED, avector );
115 
116  return error;
117  }
118 
119 
120  /* documentation is in ftpfr.h */
121 
124  FT_UInt gindex,
125  FT_Pos *aadvance )
126  {
127  FT_Error error;
128  FT_Service_PfrMetrics service;
129 
130 
131  service = ft_pfr_check( face );
132  if ( service )
133  {
134  error = service->get_advance( face, gindex, aadvance );
135  }
136  else
137  /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
138  error = FT_Err_Invalid_Argument;
139 
140  return error;
141  }
142 
143 
144 /* END */
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:2963
int FT_Error
Definition: fttypes.h:296
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:59
GLint left
Definition: glew.h:7291
#define NULL
Definition: ftobjs.h:61
return FT_Err_Invalid_Argument
Definition: ftbbox.c:584
static FT_Service_PfrMetrics ft_pfr_check(FT_Face face)
Definition: ftpfr.c:25
return FT_Err_Ok
Definition: ftbbox.c:658
#define FT_FACE_LOOKUP_SERVICE(face, ptr, id)
Definition: ftserv.h:625
FT_Error error
Definition: cffdrivr.c:407
GLenum face
Definition: gl2ext.h:1490
FT_BEGIN_HEADER FT_Get_PFR_Metrics(FT_Face face, FT_UInt *aoutline_resolution, FT_UInt *ametrics_resolution, FT_Fixed *ametrics_x_scale, FT_Fixed *ametrics_y_scale)
Definition: ftpfr.c:40
FT_Get_PFR_Kerning(FT_Face face, FT_UInt left, FT_UInt right, FT_Vector *avector)
Definition: ftpfr.c:97
signed long FT_Fixed
Definition: fttypes.h:284
#define FT_EXPORT_DEF(x)
Definition: ftconfig.h:511
unsigned int FT_UInt
Definition: fttypes.h:227
FT_Get_PFR_Advance(FT_Face face, FT_UInt gindex, FT_Pos *aadvance)
Definition: ftpfr.c:123
GLfloat right
Definition: glew.h:13816