ReactOS  0.4.15-dev-494-g1d8c567
pcfdrivr.c File Reference
#include <ft2build.h>
#include "pcf.h"
#include "pcfdrivr.h"
#include "pcfread.h"
#include "pcferror.h"
#include "pcfutil.h"
Include dependency graph for pcfdrivr.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PCF_CMapRec_
 

Macros

#define FT_COMPONENT   trace_pcfread
 
#define FT_COMPONENT   trace_pcfdriver
 

Typedefs

typedef struct PCF_CMapRec_ PCF_CMapRec
 
typedef struct PCF_CMapRec_PCF_CMap
 

Functions

 pcf_cmap_init (FT_CMap pcfcmap, FT_Pointer init_data)
 
 pcf_cmap_done (FT_CMap pcfcmap)
 
 pcf_cmap_char_index (FT_CMap pcfcmap, FT_UInt32 charcode)
 
 pcf_cmap_char_next (FT_CMap pcfcmap, FT_UInt32 *acharcode)
 
 PCF_Face_Done (FT_Face pcfface)
 
 PCF_Face_Init (FT_Stream stream, FT_Face pcfface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 PCF_Size_Select (FT_Size size, FT_ULong strike_index)
 
 PCF_Size_Request (FT_Size size, FT_Size_Request req)
 
 PCF_Glyph_Load (FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
 
static FT_Error pcf_get_bdf_property (PCF_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
 
static FT_Error pcf_get_charset_id (PCF_Face face, const char **acharset_encoding, const char **acharset_registry)
 
static FT_Error pcf_property_set (FT_Module module, const char *property_name, const void *value, FT_Bool value_is_string)
 
static FT_Error pcf_property_get (FT_Module module, const char *property_name, const void *value)
 
 FT_DEFINE_SERVICE_PROPERTIESREC (pcf_service_properties,(FT_Properties_SetFunc) pcf_property_set,(FT_Properties_GetFunc) pcf_property_get) static const FT_ServiceDescRec pcf_services[]
 
 pcf_driver_requester (FT_Module module, const char *name)
 
 pcf_driver_init (FT_Module module)
 
 pcf_driver_done (FT_Module module)
 

Variables

static const FT_CMap_ClassRec pcf_cmap_class
 
static const FT_Service_BDFRec pcf_service_bdf
 
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec pcf_driver_class
 

Macro Definition Documentation

◆ FT_COMPONENT [1/2]

#define FT_COMPONENT   trace_pcfread

Definition at line 63 of file pcfdrivr.c.

◆ FT_COMPONENT [2/2]

#define FT_COMPONENT   trace_pcfdriver

Definition at line 63 of file pcfdrivr.c.

Typedef Documentation

◆ PCF_CMap

◆ PCF_CMapRec

Function Documentation

◆ FT_DEFINE_SERVICE_PROPERTIESREC()

FT_DEFINE_SERVICE_PROPERTIESREC ( pcf_service_properties  ,
(FT_Properties_SetFunc pcf_property_set,
(FT_Properties_GetFunc pcf_property_get 
) const

◆ pcf_cmap_char_index()

pcf_cmap_char_index ( FT_CMap  pcfcmap,
FT_UInt32  charcode 
)

Definition at line 104 of file pcfdrivr.c.

106  {
107  PCF_CMap cmap = (PCF_CMap)pcfcmap;
108  PCF_Encoding encodings = cmap->encodings;
109  FT_ULong min, max, mid;
110  FT_UInt result = 0;
111 
112 
113  min = 0;
114  max = cmap->num_encodings;
115 
116  while ( min < max )
117  {
118  FT_ULong code;
119 
120 
121  mid = ( min + max ) >> 1;
122  code = (FT_ULong)encodings[mid].enc;
123 
124  if ( charcode == code )
125  {
126  result = encodings[mid].glyph + 1;
127  break;
128  }
129 
130  if ( charcode < code )
131  max = mid;
132  else
133  min = mid + 1;
134  }
135 
136  return result;
137  }
#define max(a, b)
Definition: svc.c:63
unsigned long FT_ULong
Definition: fttypes.h:253
PCF_Encoding encodings
Definition: pcfdrivr.c:70
FT_ULong num_encodings
Definition: pcfdrivr.c:69
struct PCF_CMapRec_ * PCF_CMap
int code
Definition: i386-dis.c:3591
unsigned int FT_UInt
Definition: fttypes.h:231
#define min(a, b)
Definition: monoChain.cc:55
FT_UShort glyph
Definition: pcf.h:130
GLuint64EXT * result
Definition: glext.h:11304

◆ pcf_cmap_char_next()

pcf_cmap_char_next ( FT_CMap  pcfcmap,
FT_UInt32 *  acharcode 
)

Definition at line 141 of file pcfdrivr.c.

143  {
144  PCF_CMap cmap = (PCF_CMap)pcfcmap;
145  PCF_Encoding encodings = cmap->encodings;
146  FT_ULong min, max, mid;
147  FT_ULong charcode = *acharcode + 1;
148  FT_UInt result = 0;
149 
150 
151  min = 0;
152  max = cmap->num_encodings;
153 
154  while ( min < max )
155  {
156  FT_ULong code;
157 
158 
159  mid = ( min + max ) >> 1;
160  code = (FT_ULong)encodings[mid].enc;
161 
162  if ( charcode == code )
163  {
164  result = encodings[mid].glyph + 1;
165  goto Exit;
166  }
167 
168  if ( charcode < code )
169  max = mid;
170  else
171  min = mid + 1;
172  }
173 
174  charcode = 0;
175  if ( min < cmap->num_encodings )
176  {
177  charcode = (FT_ULong)encodings[min].enc;
178  result = encodings[min].glyph + 1;
179  }
180 
181  Exit:
182  if ( charcode > 0xFFFFFFFFUL )
183  {
184  FT_TRACE1(( "pcf_cmap_char_next: charcode 0x%x > 32bit API" ));
185  *acharcode = 0;
186  /* XXX: result should be changed to indicate an overflow error */
187  }
188  else
189  *acharcode = (FT_UInt32)charcode;
190  return result;
191  }
#define max(a, b)
Definition: svc.c:63
unsigned long FT_ULong
Definition: fttypes.h:253
PCF_Encoding encodings
Definition: pcfdrivr.c:70
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
static void Exit(void)
Definition: sock.c:1331
FT_ULong num_encodings
Definition: pcfdrivr.c:69
struct PCF_CMapRec_ * PCF_CMap
int code
Definition: i386-dis.c:3591
unsigned int FT_UInt
Definition: fttypes.h:231
#define min(a, b)
Definition: monoChain.cc:55
FT_UShort glyph
Definition: pcf.h:130
GLuint64EXT * result
Definition: glext.h:11304

◆ pcf_cmap_done()

pcf_cmap_done ( FT_CMap  pcfcmap)

Definition at line 93 of file pcfdrivr.c.

94  {
95  PCF_CMap cmap = (PCF_CMap)pcfcmap;
96 
97 
98  cmap->encodings = NULL;
99  cmap->num_encodings = 0;
100  }
PCF_Encoding encodings
Definition: pcfdrivr.c:70
smooth NULL
Definition: ftsmooth.c:416
FT_ULong num_encodings
Definition: pcfdrivr.c:69
struct PCF_CMapRec_ * PCF_CMap

◆ pcf_cmap_init()

pcf_cmap_init ( FT_CMap  pcfcmap,
FT_Pointer  init_data 
)

Definition at line 76 of file pcfdrivr.c.

78  {
79  PCF_CMap cmap = (PCF_CMap)pcfcmap;
80  PCF_Face face = (PCF_Face)FT_CMAP_FACE( pcfcmap );
81 
82  FT_UNUSED( init_data );
83 
84 
85  cmap->num_encodings = face->nencodings;
86  cmap->encodings = face->encodings;
87 
88  return FT_Err_Ok;
89  }
struct PCF_FaceRec_ * PCF_Face
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
PCF_Encoding encodings
Definition: pcfdrivr.c:70
return FT_Err_Ok
Definition: ftbbox.c:511
FT_ULong num_encodings
Definition: pcfdrivr.c:69
struct PCF_CMapRec_ * PCF_CMap
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ pcf_driver_done()

pcf_driver_done ( FT_Module  module)

Definition at line 822 of file pcfdrivr.c.

823  {
824  FT_UNUSED( module );
825  }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ pcf_driver_init()

pcf_driver_init ( FT_Module  module)

Definition at line 806 of file pcfdrivr.c.

807  {
808 #ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
810 
811 
812  driver->no_long_family_names = 0;
813 #else
814  FT_UNUSED( module );
815 #endif
816 
817  return FT_Err_Ok;
818  }
return FT_Err_Ok
Definition: ftbbox.c:511
struct @1641::@1642 driver
struct PCF_DriverRec_ * PCF_Driver
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ pcf_driver_requester()

pcf_driver_requester ( FT_Module  module,
const char name 
)

Definition at line 796 of file pcfdrivr.c.

798  {
799  FT_UNUSED( module );
800 
801  return ft_service_list_lookup( pcf_services, name );
802  }
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:98
Definition: name.c:38
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ PCF_Face_Done()

PCF_Face_Done ( FT_Face  pcfface)

Definition at line 208 of file pcfdrivr.c.

209  {
210  PCF_Face face = (PCF_Face)pcfface;
212 
213 
214  if ( !face )
215  return;
216 
218 
219  FT_FREE( face->encodings );
220  FT_FREE( face->metrics );
221 
222  /* free properties */
223  if ( face->properties )
224  {
225  FT_Int i;
226 
227 
228  for ( i = 0; i < face->nprops; i++ )
229  {
230  PCF_Property prop = &face->properties[i];
231 
232 
233  if ( prop )
234  {
235  FT_FREE( prop->name );
236  if ( prop->isString )
237  FT_FREE( prop->value.atom );
238  }
239  }
240 
241  FT_FREE( face->properties );
242  }
243 
244  FT_FREE( face->toc.tables );
245  FT_FREE( pcfface->family_name );
246  FT_FREE( pcfface->style_name );
247  FT_FREE( pcfface->available_sizes );
248  FT_FREE( face->charset_encoding );
249  FT_FREE( face->charset_registry );
250 
251  /* close compressed stream if any */
252  if ( pcfface->stream == &face->comp_stream )
253  {
254  FT_Stream_Close( &face->comp_stream );
255  pcfface->stream = face->comp_source;
256  }
257  }
struct PCF_FaceRec_ * PCF_Face
signed int FT_Int
Definition: fttypes.h:220
static char memory[1024 *256]
Definition: process.c:116
FT_Stream_Close(FT_Stream stream)
Definition: ftstream.c:49
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1082
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
FT_String * family_name
Definition: freetype.h:1078
#define FT_FREE(ptr)
Definition: ftmemory.h:329
FT_String * atom
Definition: pcf.h:74
FT_Stream stream
Definition: freetype.h:1113
FT_Byte isString
Definition: pcf.h:70
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:636
union PCF_PropertyRec_::@3931 value
FT_String * style_name
Definition: freetype.h:1079
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FT_String * name
Definition: pcf.h:69

Referenced by PCF_Face_Init().

◆ PCF_Face_Init()

PCF_Face_Init ( FT_Stream  stream,
FT_Face  pcfface,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 261 of file pcfdrivr.c.

266  {
267  PCF_Face face = (PCF_Face)pcfface;
268  FT_Error error;
269 
270  FT_UNUSED( num_params );
271  FT_UNUSED( params );
272 
273 
274  FT_TRACE2(( "PCF driver\n" ));
275 
276  error = pcf_load_font( stream, face, face_index );
277  if ( error )
278  {
279  PCF_Face_Done( pcfface );
280 
281 #if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \
282  defined( FT_CONFIG_OPTION_USE_LZW ) || \
283  defined( FT_CONFIG_OPTION_USE_BZIP2 )
284 
285 #ifdef FT_CONFIG_OPTION_USE_ZLIB
286  {
288 
289 
290  /* this didn't work, try gzip support! */
291  FT_TRACE2(( " ... try gzip stream\n" ));
292  error2 = FT_Stream_OpenGzip( &face->comp_stream, stream );
293  if ( FT_ERR_EQ( error2, Unimplemented_Feature ) )
294  goto Fail;
295 
296  error = error2;
297  }
298 #endif /* FT_CONFIG_OPTION_USE_ZLIB */
299 
300 #ifdef FT_CONFIG_OPTION_USE_LZW
301  if ( error )
302  {
304 
305 
306  /* this didn't work, try LZW support! */
307  FT_TRACE2(( " ... try LZW stream\n" ));
308  error3 = FT_Stream_OpenLZW( &face->comp_stream, stream );
309  if ( FT_ERR_EQ( error3, Unimplemented_Feature ) )
310  goto Fail;
311 
312  error = error3;
313  }
314 #endif /* FT_CONFIG_OPTION_USE_LZW */
315 
316 #ifdef FT_CONFIG_OPTION_USE_BZIP2
317  if ( error )
318  {
320 
321 
322  /* this didn't work, try Bzip2 support! */
323  FT_TRACE2(( " ... try Bzip2 stream\n" ));
324  error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream );
325  if ( FT_ERR_EQ( error4, Unimplemented_Feature ) )
326  goto Fail;
327 
328  error = error4;
329  }
330 #endif /* FT_CONFIG_OPTION_USE_BZIP2 */
331 
332  if ( error )
333  goto Fail;
334 
335  face->comp_source = stream;
336  pcfface->stream = &face->comp_stream;
337 
338  stream = pcfface->stream;
339 
340  error = pcf_load_font( stream, face, face_index );
341  if ( error )
342  goto Fail;
343 
344 #else /* !(FT_CONFIG_OPTION_USE_ZLIB ||
345  FT_CONFIG_OPTION_USE_LZW ||
346  FT_CONFIG_OPTION_USE_BZIP2) */
347 
348  goto Fail;
349 
350 #endif
351  }
352 
353  /* PCF cannot have multiple faces in a single font file.
354  * XXX: A non-zero face_index is already an invalid argument, but
355  * Type1, Type42 drivers have a convention to return
356  * an invalid argument error when the font could be
357  * opened by the specified driver.
358  */
359  if ( face_index < 0 )
360  goto Exit;
361  else if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
362  {
363  FT_ERROR(( "PCF_Face_Init: invalid face index\n" ));
364  PCF_Face_Done( pcfface );
365  return FT_THROW( Invalid_Argument );
366  }
367 
368  /* set up charmap */
369  {
370  FT_String *charset_registry = face->charset_registry;
371  FT_String *charset_encoding = face->charset_encoding;
372  FT_Bool unicode_charmap = 0;
373 
374 
375  if ( charset_registry && charset_encoding )
376  {
377  char* s = charset_registry;
378 
379 
380  /* Uh, oh, compare first letters manually to avoid dependency
381  on locales. */
382  if ( ( s[0] == 'i' || s[0] == 'I' ) &&
383  ( s[1] == 's' || s[1] == 'S' ) &&
384  ( s[2] == 'o' || s[2] == 'O' ) )
385  {
386  s += 3;
387  if ( !ft_strcmp( s, "10646" ) ||
388  ( !ft_strcmp( s, "8859" ) &&
389  !ft_strcmp( face->charset_encoding, "1" ) ) )
390  unicode_charmap = 1;
391  /* another name for ASCII */
392  else if ( !ft_strcmp( s, "646.1991" ) &&
393  !ft_strcmp( face->charset_encoding, "IRV" ) )
394  unicode_charmap = 1;
395  }
396  }
397 
398  {
399  FT_CharMapRec charmap;
400 
401 
402  charmap.face = FT_FACE( face );
403  charmap.encoding = FT_ENCODING_NONE;
404  /* initial platform/encoding should indicate unset status? */
407 
408  if ( unicode_charmap )
409  {
410  charmap.encoding = FT_ENCODING_UNICODE;
413  }
414 
415  error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
416  }
417  }
418 
419  Exit:
420  return error;
421 
422  Fail:
423  FT_TRACE2(( " not a PCF file\n" ));
424  PCF_Face_Done( pcfface );
425  error = FT_THROW( Unknown_File_Format ); /* error */
426  goto Exit;
427  }
#define TT_APPLE_ID_DEFAULT
Definition: font.c:1176
int FT_Error
Definition: fttypes.h:300
FT_BEGIN_HEADER FT_Stream_OpenLZW(FT_Stream stream, FT_Stream source)
Definition: ftlzw.c:407
FT_Face face
Definition: freetype.h:842
FT_UShort encoding_id
Definition: freetype.h:845
struct PCF_FaceRec_ * PCF_Face
#define error(str)
Definition: mkdosfs.c:1605
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1181
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
GLenum const GLfloat * params
Definition: glext.h:5645
#define FT_THROW(e)
Definition: ftdebug.h:213
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
FT_BEGIN_HEADER FT_Stream_OpenGzip(FT_Stream stream, FT_Stream source)
Definition: ftgzip.c:787
smooth NULL
Definition: ftsmooth.c:416
#define error4(s, a, b, c, d)
Definition: debug.h:128
#define error2(s, a, b)
Definition: debug.h:126
char FT_String
Definition: fttypes.h:187
static void Exit(void)
Definition: sock.c:1331
static const FT_CMap_ClassRec pcf_cmap_class
Definition: pcfdrivr.c:195
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:591
FT_Stream stream
Definition: freetype.h:1113
PCF_Face_Done(FT_Face pcfface)
Definition: pcfdrivr.c:208
FT_Encoding encoding
Definition: freetype.h:843
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
GLdouble s
Definition: gl.h:2039
Definition: hiveinit.c:368
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3614
FT_UShort platform_id
Definition: freetype.h:844
#define FT_FACE(x)
Definition: ftobjs.h:630
#define error3(s, a, b, c)
Definition: debug.h:127
FT_BEGIN_HEADER FT_Stream_OpenBzip2(FT_Stream stream, FT_Stream source)
Definition: ftbzip2.c:513
pcf_load_font(FT_Stream stream, PCF_Face face, FT_Long face_index)
Definition: pcfread.c:1333
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define ft_strcmp
Definition: ftstdlib.h:86

◆ pcf_get_bdf_property()

static FT_Error pcf_get_bdf_property ( PCF_Face  face,
const char prop_name,
BDF_PropertyRec aproperty 
)
static

Definition at line 611 of file pcfdrivr.c.

614  {
615  PCF_Property prop;
616 
617 
618  prop = pcf_find_property( face, prop_name );
619  if ( prop )
620  {
621  if ( prop->isString )
622  {
623  aproperty->type = BDF_PROPERTY_TYPE_ATOM;
624  aproperty->u.atom = prop->value.atom;
625  }
626  else
627  {
628  if ( prop->value.l > 0x7FFFFFFFL ||
629  prop->value.l < ( -1 - 0x7FFFFFFFL ) )
630  {
631  FT_TRACE1(( "pcf_get_bdf_property:" ));
632  FT_TRACE1(( " too large integer 0x%x is truncated\n" ));
633  }
634 
635  /*
636  * The PCF driver loads all properties as signed integers.
637  * This really doesn't seem to be a problem, because this is
638  * sufficient for any meaningful values.
639  */
640  aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
641  aproperty->u.integer = (FT_Int32)prop->value.l;
642  }
643 
644  return FT_Err_Ok;
645  }
646 
647  return FT_THROW( Invalid_Argument );
648  }
BDF_PropertyType type
Definition: ftbdf.h:120
pcf_find_property(PCF_Face face, const FT_String *prop)
Definition: pcfread.c:458
FT_Long l
Definition: pcf.h:75
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
#define FT_THROW(e)
Definition: ftdebug.h:213
const char * atom
Definition: ftbdf.h:122
FT_Int32 integer
Definition: ftbdf.h:123
FT_String * atom
Definition: pcf.h:74
FT_Byte isString
Definition: pcf.h:70
union BDF_PropertyRec_::@3915 u
union PCF_PropertyRec_::@3931 value
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ pcf_get_charset_id()

static FT_Error pcf_get_charset_id ( PCF_Face  face,
const char **  acharset_encoding,
const char **  acharset_registry 
)
static

Definition at line 652 of file pcfdrivr.c.

655  {
656  *acharset_encoding = face->charset_encoding;
657  *acharset_registry = face->charset_registry;
658 
659  return FT_Err_Ok;
660  }
return FT_Err_Ok
Definition: ftbbox.c:511
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ PCF_Glyph_Load()

PCF_Glyph_Load ( FT_GlyphSlot  slot,
FT_Size  size,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 486 of file pcfdrivr.c.

490  {
494  FT_Bitmap* bitmap = &slot->bitmap;
495  PCF_Metric metric;
496  FT_ULong bytes;
497 
498 
499  FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index ));
500 
501  if ( !face )
502  {
503  error = FT_THROW( Invalid_Face_Handle );
504  goto Exit;
505  }
506 
507  if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
508  {
509  error = FT_THROW( Invalid_Argument );
510  goto Exit;
511  }
512 
513  stream = face->root.stream;
514 
515  if ( glyph_index > 0 )
516  glyph_index--;
517 
518  metric = face->metrics + glyph_index;
519 
520  bitmap->rows = (unsigned int)( metric->ascent +
521  metric->descent );
522  bitmap->width = (unsigned int)( metric->rightSideBearing -
523  metric->leftSideBearing );
524  bitmap->num_grays = 1;
525  bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
526 
527  switch ( PCF_GLYPH_PAD( face->bitmapsFormat ) )
528  {
529  case 1:
530  bitmap->pitch = (int)( ( bitmap->width + 7 ) >> 3 );
531  break;
532 
533  case 2:
534  bitmap->pitch = (int)( ( ( bitmap->width + 15 ) >> 4 ) << 1 );
535  break;
536 
537  case 4:
538  bitmap->pitch = (int)( ( ( bitmap->width + 31 ) >> 5 ) << 2 );
539  break;
540 
541  case 8:
542  bitmap->pitch = (int)( ( ( bitmap->width + 63 ) >> 6 ) << 3 );
543  break;
544 
545  default:
546  return FT_THROW( Invalid_File_Format );
547  }
548 
549  slot->format = FT_GLYPH_FORMAT_BITMAP;
550  slot->bitmap_left = metric->leftSideBearing;
551  slot->bitmap_top = metric->ascent;
552 
553  slot->metrics.horiAdvance = (FT_Pos)( metric->characterWidth * 64 );
554  slot->metrics.horiBearingX = (FT_Pos)( metric->leftSideBearing * 64 );
555  slot->metrics.horiBearingY = (FT_Pos)( metric->ascent * 64 );
556  slot->metrics.width = (FT_Pos)( ( metric->rightSideBearing -
557  metric->leftSideBearing ) * 64 );
558  slot->metrics.height = (FT_Pos)( bitmap->rows * 64 );
559 
561  ( face->accel.fontAscent +
562  face->accel.fontDescent ) * 64 );
563 
564  if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
565  goto Exit;
566 
567  /* XXX: to do: are there cases that need repadding the bitmap? */
568  bytes = (FT_ULong)bitmap->pitch * bitmap->rows;
569 
571  if ( error )
572  goto Exit;
573 
574  if ( FT_STREAM_SEEK( metric->bits ) ||
575  FT_STREAM_READ( bitmap->buffer, bytes ) )
576  goto Exit;
577 
578  if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
579  BitOrderInvert( bitmap->buffer, bytes );
580 
581  if ( ( PCF_BYTE_ORDER( face->bitmapsFormat ) !=
582  PCF_BIT_ORDER( face->bitmapsFormat ) ) )
583  {
584  switch ( PCF_SCAN_UNIT( face->bitmapsFormat ) )
585  {
586  case 1:
587  break;
588 
589  case 2:
590  TwoByteSwap( bitmap->buffer, bytes );
591  break;
592 
593  case 4:
594  FourByteSwap( bitmap->buffer, bytes );
595  break;
596  }
597  }
598 
599  Exit:
600  return error;
601  }
int FT_Error
Definition: fttypes.h:300
FourByteSwap(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:85
unsigned long FT_ULong
Definition: fttypes.h:253
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
struct PCF_FaceRec_ * PCF_Face
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2933
uint32 width
Definition: uimain.c:91
#define error(str)
Definition: mkdosfs.c:1605
#define MSBFirst
Definition: pcf.h:178
TwoByteSwap(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:66
return FT_Err_Ok
Definition: ftbbox.c:511
FT_Short descent
Definition: pcf.h:100
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Short rightSideBearing
Definition: pcf.h:97
#define PCF_BYTE_ORDER(f)
Definition: pcf.h:198
Definition: uimain.c:88
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
Definition: ftobjs.c:478
GLsizeiptr size
Definition: glext.h:5919
static void Exit(void)
Definition: sock.c:1331
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
FT_ULong bits
Definition: pcf.h:102
FT_Short leftSideBearing
Definition: pcf.h:96
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
Definition: vfat.h:184
unsigned int FT_UInt
Definition: fttypes.h:231
BitOrderInvert(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:44
#define FT_SIZE_FACE(x)
Definition: ftobjs.h:639
#define PCF_BIT_ORDER(f)
Definition: pcf.h:200
FT_Short ascent
Definition: pcf.h:99
#define FT_STREAM_READ(buffer, count)
Definition: ftstream.h:497
#define PCF_GLYPH_PAD(f)
Definition: pcf.h:204
#define FT_LOAD_BITMAP_METRICS_ONLY
Definition: freetype.h:3026
FT_Short characterWidth
Definition: pcf.h:98
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define PCF_SCAN_UNIT(f)
Definition: pcf.h:208
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ pcf_property_get()

static FT_Error pcf_property_get ( FT_Module  module,
const char property_name,
const void value 
)
static

Definition at line 736 of file pcfdrivr.c.

739  {
740 #ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
741 
744 
745 
746  if ( !ft_strcmp( property_name, "no-long-family-names" ) )
747  {
748  FT_Bool no_long_family_names = driver->no_long_family_names;
749  FT_Bool* val = (FT_Bool*)value;
750 
751 
752  *val = no_long_family_names;
753 
754  return error;
755  }
756 
757 #else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
758 
759  FT_UNUSED( module );
760  FT_UNUSED( value );
761 #ifndef FT_DEBUG_LEVEL_TRACE
762  FT_UNUSED( property_name );
763 #endif
764 
765 #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
766 
767  FT_TRACE0(( "pcf_property_get: missing property `%s'\n",
768  property_name ));
769  return FT_THROW( Missing_Property );
770  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_THROW(e)
Definition: ftdebug.h:213
GLuint GLfloat * val
Definition: glext.h:7180
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
struct @1641::@1642 driver
struct PCF_DriverRec_ * PCF_Driver
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define ft_strcmp
Definition: ftstdlib.h:86

◆ pcf_property_set()

static FT_Error pcf_property_set ( FT_Module  module,
const char property_name,
const void value,
FT_Bool  value_is_string 
)
static

Definition at line 675 of file pcfdrivr.c.

679  {
680 #ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
681 
684 
685 #ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
686  FT_UNUSED( value_is_string );
687 #endif
688 
689 
690  if ( !ft_strcmp( property_name, "no-long-family-names" ) )
691  {
692 #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
693  if ( value_is_string )
694  {
695  const char* s = (const char*)value;
696  long lfn = ft_strtol( s, NULL, 10 );
697 
698 
699  if ( lfn == 0 )
700  driver->no_long_family_names = 0;
701  else if ( lfn == 1 )
702  driver->no_long_family_names = 1;
703  else
704  return FT_THROW( Invalid_Argument );
705  }
706  else
707 #endif
708  {
709  FT_Bool* no_long_family_names = (FT_Bool*)value;
710 
711 
712  driver->no_long_family_names = *no_long_family_names;
713  }
714 
715  return error;
716  }
717 
718 #else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
719 
720  FT_UNUSED( module );
721  FT_UNUSED( value );
722  FT_UNUSED( value_is_string );
723 #ifndef FT_DEBUG_LEVEL_TRACE
724  FT_UNUSED( property_name );
725 #endif
726 
727 #endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
728 
729  FT_TRACE0(( "pcf_property_set: missing property `%s'\n",
730  property_name ));
731  return FT_THROW( Missing_Property );
732  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_THROW(e)
Definition: ftdebug.h:213
smooth NULL
Definition: ftsmooth.c:416
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
struct @1641::@1642 driver
GLdouble s
Definition: gl.h:2039
struct PCF_DriverRec_ * PCF_Driver
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define ft_strcmp
Definition: ftstdlib.h:86
#define ft_strtol
Definition: ftstdlib.h:145

◆ PCF_Size_Request()

PCF_Size_Request ( FT_Size  size,
FT_Size_Request  req 
)

Definition at line 448 of file pcfdrivr.c.

450  {
451  PCF_Face face = (PCF_Face)size->face;
452  FT_Bitmap_Size* bsize = size->face->available_sizes;
453  FT_Error error = FT_ERR( Invalid_Pixel_Size );
454  FT_Long height;
455 
456 
457  height = FT_REQUEST_HEIGHT( req );
458  height = ( height + 32 ) >> 6;
459 
460  switch ( req->type )
461  {
463  if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
464  error = FT_Err_Ok;
465  break;
466 
468  if ( height == ( face->accel.fontAscent +
469  face->accel.fontDescent ) )
470  error = FT_Err_Ok;
471  break;
472 
473  default:
474  error = FT_THROW( Unimplemented_Feature );
475  break;
476  }
477 
478  if ( error )
479  return error;
480  else
481  return PCF_Size_Select( size, 0 );
482  }
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
struct PCF_FaceRec_ * PCF_Face
#define error(str)
Definition: mkdosfs.c:1605
#define FT_REQUEST_HEIGHT(req)
Definition: ftobjs.h:694
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_ERR(e)
Definition: fttypes.h:586
FT_Size_Request_Type type
Definition: freetype.h:2619
GLsizeiptr size
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
PCF_Size_Select(FT_Size size, FT_ULong strike_index)
Definition: pcfdrivr.c:431
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ PCF_Size_Select()

PCF_Size_Select ( FT_Size  size,
FT_ULong  strike_index 
)

Definition at line 431 of file pcfdrivr.c.

433  {
434  PCF_Accel accel = &( (PCF_Face)size->face )->accel;
435 
436 
437  FT_Select_Metrics( size->face, strike_index );
438 
439  size->metrics.ascender = accel->fontAscent * 64;
440  size->metrics.descender = -accel->fontDescent * 64;
441  size->metrics.max_advance = accel->maxbounds.characterWidth * 64;
442 
443  return FT_Err_Ok;
444  }
struct PCF_FaceRec_ * PCF_Face
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:2993
FT_Long fontDescent
Definition: pcf.h:117
return FT_Err_Ok
Definition: ftbbox.c:511
PCF_MetricRec maxbounds
Definition: pcf.h:120
GLsizeiptr size
Definition: glext.h:5919
FT_Short characterWidth
Definition: pcf.h:98
FT_Long fontAscent
Definition: pcf.h:116

Referenced by PCF_Size_Request().

Variable Documentation

◆ pcf_cmap_class

const FT_CMap_ClassRec pcf_cmap_class
static
Initial value:
=
{
sizeof ( PCF_CMapRec ),
}
struct PCF_CMapRec_ PCF_CMapRec
pcf_cmap_char_next(FT_CMap pcfcmap, FT_UInt32 *acharcode)
Definition: pcfdrivr.c:141
smooth NULL
Definition: ftsmooth.c:416
pcf_cmap_init(FT_CMap pcfcmap, FT_Pointer init_data)
Definition: pcfdrivr.c:76
pcf_cmap_done(FT_CMap pcfcmap)
Definition: pcfdrivr.c:93
pcf_cmap_char_index(FT_CMap pcfcmap, FT_UInt32 charcode)
Definition: pcfdrivr.c:104

Definition at line 195 of file pcfdrivr.c.

Referenced by PCF_Face_Init().

◆ pcf_driver_class

Definition at line 829 of file pcfdrivr.c.

◆ pcf_service_bdf

const FT_Service_BDFRec pcf_service_bdf
static
Initial value:
=
{
}
FT_Error(* FT_BDF_GetCharsetIdFunc)(FT_Face face, const char **acharset_encoding, const char **acharset_registry)
Definition: svbdf.h:32
static FT_Error pcf_get_bdf_property(PCF_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
Definition: pcfdrivr.c:611
FT_Error(* FT_BDF_GetPropertyFunc)(FT_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
Definition: svbdf.h:37
static FT_Error pcf_get_charset_id(PCF_Face face, const char **acharset_encoding, const char **acharset_registry)
Definition: pcfdrivr.c:652

Definition at line 663 of file pcfdrivr.c.