Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
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-2004, 2008, 2010, 2013 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_DEBUG_H
20 
21 #include FT_INTERNAL_OBJECTS_H
22 #include FT_SERVICE_PFR_H
23 
24 
25  /* check the format */
26  static FT_Service_PfrMetrics
27  ft_pfr_check( FT_Face face )
28  {
29  FT_Service_PfrMetrics service = NULL;
30 
31 
32  if ( face )
33  FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
34 
35  return service;
36  }
37 
38 
39  /* documentation is in ftpfr.h */
40 
43  FT_UInt *aoutline_resolution,
44  FT_UInt *ametrics_resolution,
45  FT_Fixed *ametrics_x_scale,
46  FT_Fixed *ametrics_y_scale )
47  {
49  FT_Service_PfrMetrics service;
50 
51 
52  if ( !face )
53  return FT_THROW( Invalid_Argument );
54 
55  service = ft_pfr_check( face );
56  if ( service )
57  {
58  error = service->get_metrics( face,
59  aoutline_resolution,
60  ametrics_resolution,
61  ametrics_x_scale,
62  ametrics_y_scale );
63  }
64  else
65  {
66  FT_Fixed x_scale, y_scale;
67 
68 
69  /* this is not a PFR font */
70  if ( aoutline_resolution )
71  *aoutline_resolution = face->units_per_EM;
72 
73  if ( ametrics_resolution )
74  *ametrics_resolution = face->units_per_EM;
75 
76  x_scale = y_scale = 0x10000L;
77  if ( face->size )
78  {
79  x_scale = face->size->metrics.x_scale;
80  y_scale = face->size->metrics.y_scale;
81  }
82 
83  if ( ametrics_x_scale )
84  *ametrics_x_scale = x_scale;
85 
86  if ( ametrics_y_scale )
87  *ametrics_y_scale = y_scale;
88 
89  error = FT_THROW( Unknown_File_Format );
90  }
91 
92  return error;
93  }
94 
95 
96  /* documentation is in ftpfr.h */
97 
100  FT_UInt left,
101  FT_UInt right,
102  FT_Vector *avector )
103  {
104  FT_Error error;
105  FT_Service_PfrMetrics service;
106 
107 
108  if ( !face )
109  return FT_THROW( Invalid_Argument );
110 
111  service = ft_pfr_check( face );
112  if ( service )
113  error = service->get_kerning( face, left, right, avector );
114  else
115  error = FT_Get_Kerning( face, left, right,
116  FT_KERNING_UNSCALED, avector );
117 
118  return error;
119  }
120 
121 
122  /* documentation is in ftpfr.h */
123 
126  FT_UInt gindex,
127  FT_Pos *aadvance )
128  {
129  FT_Error error;
130  FT_Service_PfrMetrics service;
131 
132 
133  service = ft_pfr_check( face );
134  if ( service )
135  {
136  error = service->get_advance( face, gindex, aadvance );
137  }
138  else
139  /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
140  error = FT_THROW( Invalid_Argument );
141 
142  return error;
143  }
144 
145 
146 /* END */
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:42
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:2975
int FT_Error
Definition: fttypes.h:296
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:59
#define NULL
Definition: ftobjs.h:61
return FT_THROW(Missing_Property)
return FT_Err_Ok
Definition: ftbbox.c:645
FT_Get_PFR_Kerning(FT_Face face, FT_UInt left, FT_UInt right, FT_Vector *avector)
Definition: ftpfr.c:99
GLenum GLuint GLint GLenum face
#define FT_FACE_LOOKUP_SERVICE(face, ptr, id)
Definition: ftserv.h:705
GLdouble GLdouble right
#define FT_EXPORT_DEF(x)
Definition: ftconfig.h:32
GLint left
FT_Error error
Definition: cffdrivr.c:411
FT_Get_PFR_Advance(FT_Face face, FT_UInt gindex, FT_Pos *aadvance)
Definition: ftpfr.c:125
signed long FT_Fixed
Definition: fttypes.h:284
unsigned int FT_UInt
Definition: fttypes.h:227