ReactOS 0.4.16-dev-1067-ge98bba2
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   pcfread
 
#define FT_COMPONENT   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   pcfread

Definition at line 63 of file pcfdrivr.c.

◆ FT_COMPONENT [2/2]

#define FT_COMPONENT   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 105 of file pcfdrivr.c.

107 {
108 PCF_CMap cmap = (PCF_CMap)pcfcmap;
109 PCF_Enc enc = cmap->enc;
110 FT_UShort charcodeRow;
111 FT_UShort charcodeCol;
112
113
114 if ( charcode > (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) ||
115 charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) )
116 return 0;
117
118 charcodeRow = (FT_UShort)( charcode >> 8 );
119 charcodeCol = (FT_UShort)( charcode & 0xFF );
120
121 if ( charcodeCol < enc->firstCol ||
122 charcodeCol > enc->lastCol )
123 return 0;
124
125 return (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
126 ( enc->lastCol - enc->firstCol + 1 ) +
127 charcodeCol - enc->firstCol ];
128 }
unsigned short FT_UShort
Definition: fttypes.h:209
unsigned int FT_UInt
Definition: fttypes.h:231
struct PCF_CMapRec_ * PCF_CMap
PCF_Enc enc
Definition: pcfdrivr.c:73
FT_UShort * offset
Definition: pcf.h:115
FT_UShort firstCol
Definition: pcf.h:109
FT_UShort firstRow
Definition: pcf.h:111
FT_UShort lastRow
Definition: pcf.h:112
FT_UShort lastCol
Definition: pcf.h:110

◆ pcf_cmap_char_next()

pcf_cmap_char_next ( FT_CMap  pcfcmap,
FT_UInt32 *  acharcode 
)

Definition at line 132 of file pcfdrivr.c.

134 {
135 PCF_CMap cmap = (PCF_CMap)pcfcmap;
136 PCF_Enc enc = cmap->enc;
137 FT_UInt32 charcode = *acharcode;
138 FT_UShort charcodeRow;
139 FT_UShort charcodeCol;
140 FT_Int result = 0;
141
142
143 while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) )
144 {
145 charcode++;
146
147 if ( charcode < (FT_UInt32)( enc->firstRow * 256 + enc->firstCol ) )
148 charcode = (FT_UInt32)( enc->firstRow * 256 + enc->firstCol );
149
150 charcodeRow = (FT_UShort)( charcode >> 8 );
151 charcodeCol = (FT_UShort)( charcode & 0xFF );
152
153 if ( charcodeCol < enc->firstCol )
154 charcodeCol = enc->firstCol;
155 else if ( charcodeCol > enc->lastCol )
156 {
157 charcodeRow++;
158 charcodeCol = enc->firstCol;
159 }
160
161 charcode = (FT_UInt32)( charcodeRow * 256 + charcodeCol );
162
163 result = (FT_UInt)enc->offset[ ( charcodeRow - enc->firstRow ) *
164 ( enc->lastCol - enc->firstCol + 1 ) +
165 charcodeCol - enc->firstCol ];
166 if ( result != 0xFFFFU )
167 break;
168 }
169
170 *acharcode = charcode;
171
172 return result;
173 }
signed int FT_Int
Definition: fttypes.h:220
GLuint64EXT * result
Definition: glext.h:11304
if(dx< 0)
Definition: linetemp.h:194

◆ pcf_cmap_done()

pcf_cmap_done ( FT_CMap  pcfcmap)

Definition at line 95 of file pcfdrivr.c.

96 {
97 PCF_CMap cmap = (PCF_CMap)pcfcmap;
98
99
100 cmap->enc = NULL;
101 }
#define NULL
Definition: types.h:112

◆ pcf_cmap_init()

pcf_cmap_init ( FT_CMap  pcfcmap,
FT_Pointer  init_data 
)

Definition at line 79 of file pcfdrivr.c.

81 {
82 PCF_CMap cmap = (PCF_CMap)pcfcmap;
83 PCF_Face face = (PCF_Face)FT_CMAP_FACE( pcfcmap );
84
85 FT_UNUSED( init_data );
86
87
88 cmap->enc = &face->enc;
89
90 return FT_Err_Ok;
91 }
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_UNUSED(arg)
Definition: ftconfig.h:100
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:163
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
struct PCF_FaceRec_ * PCF_Face

◆ pcf_driver_done()

pcf_driver_done ( FT_Module  module)

Definition at line 801 of file pcfdrivr.c.

802 {
803 FT_UNUSED( module );
804 }

◆ pcf_driver_init()

pcf_driver_init ( FT_Module  module)

Definition at line 785 of file pcfdrivr.c.

786 {
787#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
789
790
791 driver->no_long_family_names = 0;
792#else
793 FT_UNUSED( module );
794#endif
795
796 return FT_Err_Ok;
797 }
struct @1717::@1718 driver
struct PCF_DriverRec_ * PCF_Driver

◆ pcf_driver_requester()

pcf_driver_requester ( FT_Module  module,
const char name 
)

Definition at line 775 of file pcfdrivr.c.

777 {
778 FT_UNUSED( module );
779
780 return ft_service_list_lookup( pcf_services, name );
781 }
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:110
Definition: name.c:39

◆ PCF_Face_Done()

PCF_Face_Done ( FT_Face  pcfface)

Definition at line 190 of file pcfdrivr.c.

191 {
192 PCF_Face face = (PCF_Face)pcfface;
194
195
196 if ( !face )
197 return;
198
200
201 FT_FREE( face->metrics );
202 FT_FREE( face->enc.offset );
203
204 /* free properties */
205 if ( face->properties )
206 {
207 FT_Int i;
208
209
210 for ( i = 0; i < face->nprops; i++ )
211 {
212 PCF_Property prop = &face->properties[i];
213
214
215 if ( prop )
216 {
217 FT_FREE( prop->name );
218 if ( prop->isString )
219 FT_FREE( prop->value.atom );
220 }
221 }
222
223 FT_FREE( face->properties );
224 }
225
226 FT_FREE( face->toc.tables );
227 FT_FREE( pcfface->family_name );
228 FT_FREE( pcfface->style_name );
229 FT_FREE( pcfface->available_sizes );
230 FT_FREE( face->charset_encoding );
231 FT_FREE( face->charset_registry );
232
233 /* close compressed stream if any */
234 if ( pcfface->stream == &face->comp_stream )
235 {
236 FT_Stream_Close( &face->comp_stream );
237 pcfface->stream = face->comp_source;
238 }
239 }
#define FT_FREE(ptr)
Definition: ftmemory.h:328
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:605
FT_Stream_Close(FT_Stream stream)
Definition: ftstream.c:49
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
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
static char memory[1024 *256]
Definition: process.c:116
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1055
FT_Stream stream
Definition: freetype.h:1086
FT_String * style_name
Definition: freetype.h:1052
FT_String * family_name
Definition: freetype.h:1051
FT_String * atom
Definition: pcf.h:74
union PCF_PropertyRec_::@4379 value
FT_String * name
Definition: pcf.h:69
FT_Byte isString
Definition: pcf.h:70

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 243 of file pcfdrivr.c.

248 {
249 PCF_Face face = (PCF_Face)pcfface;
251
252 FT_UNUSED( num_params );
253 FT_UNUSED( params );
254
255
256 FT_TRACE2(( "PCF driver\n" ));
257
258 error = pcf_load_font( stream, face, face_index );
259 if ( error )
260 {
261 PCF_Face_Done( pcfface );
262
263#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \
264 defined( FT_CONFIG_OPTION_USE_LZW ) || \
265 defined( FT_CONFIG_OPTION_USE_BZIP2 )
266
267#ifdef FT_CONFIG_OPTION_USE_ZLIB
268 {
270
271
272 /* this didn't work, try gzip support! */
273 FT_TRACE2(( " ... try gzip stream\n" ));
274 error2 = FT_Stream_OpenGzip( &face->comp_stream, stream );
275 if ( FT_ERR_EQ( error2, Unimplemented_Feature ) )
276 goto Fail;
277
278 error = error2;
279 }
280#endif /* FT_CONFIG_OPTION_USE_ZLIB */
281
282#ifdef FT_CONFIG_OPTION_USE_LZW
283 if ( error )
284 {
286
287
288 /* this didn't work, try LZW support! */
289 FT_TRACE2(( " ... try LZW stream\n" ));
290 error3 = FT_Stream_OpenLZW( &face->comp_stream, stream );
291 if ( FT_ERR_EQ( error3, Unimplemented_Feature ) )
292 goto Fail;
293
294 error = error3;
295 }
296#endif /* FT_CONFIG_OPTION_USE_LZW */
297
298#ifdef FT_CONFIG_OPTION_USE_BZIP2
299 if ( error )
300 {
302
303
304 /* this didn't work, try Bzip2 support! */
305 FT_TRACE2(( " ... try Bzip2 stream\n" ));
306 error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream );
307 if ( FT_ERR_EQ( error4, Unimplemented_Feature ) )
308 goto Fail;
309
310 error = error4;
311 }
312#endif /* FT_CONFIG_OPTION_USE_BZIP2 */
313
314 if ( error )
315 goto Fail;
316
317 face->comp_source = stream;
318 pcfface->stream = &face->comp_stream;
319
320 stream = pcfface->stream;
321
322 error = pcf_load_font( stream, face, face_index );
323 if ( error )
324 goto Fail;
325
326#else /* !(FT_CONFIG_OPTION_USE_ZLIB ||
327 FT_CONFIG_OPTION_USE_LZW ||
328 FT_CONFIG_OPTION_USE_BZIP2) */
329
330 goto Fail;
331
332#endif
333 }
334
335 /* PCF cannot have multiple faces in a single font file.
336 * XXX: A non-zero face_index is already an invalid argument, but
337 * Type1, Type42 drivers have a convention to return
338 * an invalid argument error when the font could be
339 * opened by the specified driver.
340 */
341 if ( face_index < 0 )
342 goto Exit;
343 else if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
344 {
345 FT_ERROR(( "PCF_Face_Init: invalid face index\n" ));
346 PCF_Face_Done( pcfface );
347 return FT_THROW( Invalid_Argument );
348 }
349
350 /* set up charmap */
351 {
352 FT_String *charset_registry = face->charset_registry;
353 FT_String *charset_encoding = face->charset_encoding;
354 FT_Bool unicode_charmap = 0;
355
356
357 if ( charset_registry && charset_encoding )
358 {
359 char* s = charset_registry;
360
361
362 /* Uh, oh, compare first letters manually to avoid dependency
363 on locales. */
364 if ( ( s[0] == 'i' || s[0] == 'I' ) &&
365 ( s[1] == 's' || s[1] == 'S' ) &&
366 ( s[2] == 'o' || s[2] == 'O' ) )
367 {
368 s += 3;
369 if ( !ft_strcmp( s, "10646" ) ||
370 ( !ft_strcmp( s, "8859" ) &&
371 !ft_strcmp( face->charset_encoding, "1" ) ) )
372 unicode_charmap = 1;
373 /* another name for ASCII */
374 else if ( !ft_strcmp( s, "646.1991" ) &&
375 !ft_strcmp( face->charset_encoding, "IRV" ) )
376 unicode_charmap = 1;
377 }
378 }
379
380 {
381 FT_CharMapRec charmap;
382
383
384 charmap.face = FT_FACE( face );
385 charmap.encoding = FT_ENCODING_NONE;
386 /* initial platform/encoding should indicate unset status? */
389
390 if ( unicode_charmap )
391 {
392 charmap.encoding = FT_ENCODING_UNICODE;
395 }
396
397 error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
398 }
399 }
400
401 Exit:
402 return error;
403
404 Fail:
405 FT_TRACE2(( " not a PCF file\n" ));
406 PCF_Face_Done( pcfface );
407 error = FT_THROW( Unknown_File_Format ); /* error */
408 goto Exit;
409 }
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1181
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
#define TT_APPLE_ID_DEFAULT
Definition: font.c:1176
#define TT_PLATFORM_APPLE_UNICODE
Definition: font.c:1172
int Fail
Definition: ehthrow.cxx:24
FT_BEGIN_HEADER FT_Stream_OpenBzip2(FT_Stream stream, FT_Stream source)
Definition: ftbzip2.c:509
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_THROW(e)
Definition: ftdebug.h:241
#define FT_TRACE2(varformat)
Definition: ftdebug.h:187
FT_BEGIN_HEADER FT_Stream_OpenGzip(FT_Stream stream, FT_Stream source)
Definition: ftgzip.c:783
FT_BEGIN_HEADER FT_Stream_OpenLZW(FT_Stream stream, FT_Stream source)
Definition: ftlzw.c:403
#define FT_FACE(x)
Definition: ftobjs.h:599
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3657
#define ft_strcmp
Definition: ftstdlib.h:86
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:604
int FT_Error
Definition: fttypes.h:299
char FT_String
Definition: fttypes.h:187
GLdouble s
Definition: gl.h:2039
GLenum const GLfloat * params
Definition: glext.h:5645
#define error(str)
Definition: mkdosfs.c:1605
pcf_load_font(FT_Stream stream, PCF_Face face, FT_Long face_index)
Definition: pcfread.c:1408
PCF_Face_Done(FT_Face pcfface)
Definition: pcfdrivr.c:190
static const FT_CMap_ClassRec pcf_cmap_class
Definition: pcfdrivr.c:177
#define error2(s, a, b)
Definition: debug.h:126
#define error3(s, a, b, c)
Definition: debug.h:127
#define error4(s, a, b, c, d)
Definition: debug.h:128
static void Exit(void)
Definition: sock.c:1330
FT_Face face
Definition: freetype.h:835
FT_Encoding encoding
Definition: freetype.h:836
FT_UShort platform_id
Definition: freetype.h:837
FT_UShort encoding_id
Definition: freetype.h:838
Definition: parse.h:23

◆ 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 590 of file pcfdrivr.c.

593 {
594 PCF_Property prop;
595
596
597 prop = pcf_find_property( face, prop_name );
598 if ( prop )
599 {
600 if ( prop->isString )
601 {
602 aproperty->type = BDF_PROPERTY_TYPE_ATOM;
603 aproperty->u.atom = prop->value.atom;
604 }
605 else
606 {
607 if ( prop->value.l > 0x7FFFFFFFL ||
608 prop->value.l < ( -1 - 0x7FFFFFFFL ) )
609 {
610 FT_TRACE1(( "pcf_get_bdf_property:" ));
611 FT_TRACE1(( " too large integer 0x%x is truncated\n" ));
612 }
613
614 /*
615 * The PCF driver loads all properties as signed integers.
616 * This really doesn't seem to be a problem, because this is
617 * sufficient for any meaningful values.
618 */
619 aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
620 aproperty->u.integer = (FT_Int32)prop->value.l;
621 }
622
623 return FT_Err_Ok;
624 }
625
626 return FT_THROW( Invalid_Argument );
627 }
@ BDF_PROPERTY_TYPE_ATOM
Definition: ftbdf.h:77
@ BDF_PROPERTY_TYPE_INTEGER
Definition: ftbdf.h:78
#define FT_TRACE1(varformat)
Definition: ftdebug.h:186
pcf_find_property(PCF_Face face, const FT_String *prop)
Definition: pcfread.c:458
union BDF_PropertyRec_::@4363 u
FT_Int32 integer
Definition: ftbdf.h:123
BDF_PropertyType type
Definition: ftbdf.h:120
const char * atom
Definition: ftbdf.h:122
FT_Long l
Definition: pcf.h:75

◆ 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 631 of file pcfdrivr.c.

634 {
635 *acharset_encoding = face->charset_encoding;
636 *acharset_registry = face->charset_registry;
637
638 return FT_Err_Ok;
639 }

◆ PCF_Glyph_Load()

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

Definition at line 468 of file pcfdrivr.c.

472 {
476 FT_Bitmap* bitmap = &slot->bitmap;
477 PCF_Metric metric;
479
480
481 FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index ));
482
483 if ( !face )
484 {
485 error = FT_THROW( Invalid_Face_Handle );
486 goto Exit;
487 }
488
489 if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
490 {
491 error = FT_THROW( Invalid_Argument );
492 goto Exit;
493 }
494
495 stream = face->root.stream;
496
497 metric = face->metrics + glyph_index;
498
499 bitmap->rows = (unsigned int)( metric->ascent +
500 metric->descent );
501 bitmap->width = (unsigned int)( metric->rightSideBearing -
502 metric->leftSideBearing );
503 bitmap->num_grays = 1;
504 bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
505
506 switch ( PCF_GLYPH_PAD( face->bitmapsFormat ) )
507 {
508 case 1:
509 bitmap->pitch = (int)( ( bitmap->width + 7 ) >> 3 );
510 break;
511
512 case 2:
513 bitmap->pitch = (int)( ( ( bitmap->width + 15 ) >> 4 ) << 1 );
514 break;
515
516 case 4:
517 bitmap->pitch = (int)( ( ( bitmap->width + 31 ) >> 5 ) << 2 );
518 break;
519
520 case 8:
521 bitmap->pitch = (int)( ( ( bitmap->width + 63 ) >> 6 ) << 3 );
522 break;
523
524 default:
525 return FT_THROW( Invalid_File_Format );
526 }
527
528 slot->format = FT_GLYPH_FORMAT_BITMAP;
529 slot->bitmap_left = metric->leftSideBearing;
530 slot->bitmap_top = metric->ascent;
531
532 slot->metrics.horiAdvance = (FT_Pos)( metric->characterWidth * 64 );
533 slot->metrics.horiBearingX = (FT_Pos)( metric->leftSideBearing * 64 );
534 slot->metrics.horiBearingY = (FT_Pos)( metric->ascent * 64 );
535 slot->metrics.width = (FT_Pos)( ( metric->rightSideBearing -
536 metric->leftSideBearing ) * 64 );
537 slot->metrics.height = (FT_Pos)( bitmap->rows * 64 );
538
540 ( face->accel.fontAscent +
541 face->accel.fontDescent ) * 64 );
542
543 if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
544 goto Exit;
545
546 /* XXX: to do: are there cases that need repadding the bitmap? */
547 bytes = (FT_ULong)bitmap->pitch * bitmap->rows;
548
550 if ( error )
551 goto Exit;
552
553 if ( FT_STREAM_SEEK( metric->bits ) ||
554 FT_STREAM_READ( bitmap->buffer, bytes ) )
555 goto Exit;
556
557 if ( PCF_BIT_ORDER( face->bitmapsFormat ) != MSBFirst )
558 BitOrderInvert( bitmap->buffer, bytes );
559
560 if ( ( PCF_BYTE_ORDER( face->bitmapsFormat ) !=
561 PCF_BIT_ORDER( face->bitmapsFormat ) ) )
562 {
563 switch ( PCF_SCAN_UNIT( face->bitmapsFormat ) )
564 {
565 case 1:
566 break;
567
568 case 2:
569 TwoByteSwap( bitmap->buffer, bytes );
570 break;
571
572 case 4:
573 FourByteSwap( bitmap->buffer, bytes );
574 break;
575 }
576 }
577
578 Exit:
579 return error;
580 }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define FT_LOAD_BITMAP_METRICS_ONLY
Definition: freetype.h:3044
@ FT_PIXEL_MODE_MONO
Definition: ftimage.h:184
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2977
#define FT_SIZE_FACE(x)
Definition: ftobjs.h:608
ft_glyphslot_alloc_bitmap(FT_GlyphSlot slot, FT_ULong size)
Definition: ftobjs.c:515
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:514
#define FT_STREAM_READ(buffer, count)
Definition: ftstream.h:522
unsigned long FT_ULong
Definition: fttypes.h:253
GLsizeiptr size
Definition: glext.h:5919
#define PCF_BYTE_ORDER(f)
Definition: pcf.h:202
#define PCF_SCAN_UNIT(f)
Definition: pcf.h:212
#define MSBFirst
Definition: pcf.h:182
#define PCF_BIT_ORDER(f)
Definition: pcf.h:204
#define PCF_GLYPH_PAD(f)
Definition: pcf.h:208
BitOrderInvert(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:44
TwoByteSwap(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:66
FourByteSwap(unsigned char *buf, size_t nbytes)
Definition: pcfutil.c:85
FT_Short characterWidth
Definition: pcf.h:98
FT_Short leftSideBearing
Definition: pcf.h:96
FT_Short ascent
Definition: pcf.h:99
FT_Short rightSideBearing
Definition: pcf.h:97
FT_Short descent
Definition: pcf.h:100
FT_ULong bits
Definition: pcf.h:102
Definition: vfat.h:185
Definition: uimain.c:89
uint32 width
Definition: uimain.c:91

◆ pcf_property_get()

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

Definition at line 715 of file pcfdrivr.c.

718 {
719#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
720
723
724
725 if ( !ft_strcmp( property_name, "no-long-family-names" ) )
726 {
727 FT_Bool no_long_family_names = driver->no_long_family_names;
729
730
731 *val = no_long_family_names;
732
733 return error;
734 }
735
736#else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
737
738 FT_UNUSED( module );
739 FT_UNUSED( value );
740#ifndef FT_DEBUG_LEVEL_TRACE
741 FT_UNUSED( property_name );
742#endif
743
744#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
745
746 FT_TRACE0(( "pcf_property_get: missing property `%s'\n",
747 property_name ));
748 return FT_THROW( Missing_Property );
749 }
#define FT_TRACE0(varformat)
Definition: ftdebug.h:185
GLuint GLfloat * val
Definition: glext.h:7180
Definition: pdh_main.c:96

◆ 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 654 of file pcfdrivr.c.

658 {
659#ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
660
663
664#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
665 FT_UNUSED( value_is_string );
666#endif
667
668
669 if ( !ft_strcmp( property_name, "no-long-family-names" ) )
670 {
671#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
672 if ( value_is_string )
673 {
674 const char* s = (const char*)value;
675 long lfn = ft_strtol( s, NULL, 10 );
676
677
678 if ( lfn == 0 )
679 driver->no_long_family_names = 0;
680 else if ( lfn == 1 )
681 driver->no_long_family_names = 1;
682 else
683 return FT_THROW( Invalid_Argument );
684 }
685 else
686#endif
687 {
688 FT_Bool* no_long_family_names = (FT_Bool*)value;
689
690
691 driver->no_long_family_names = *no_long_family_names;
692 }
693
694 return error;
695 }
696
697#else /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
698
699 FT_UNUSED( module );
700 FT_UNUSED( value );
701 FT_UNUSED( value_is_string );
702#ifndef FT_DEBUG_LEVEL_TRACE
703 FT_UNUSED( property_name );
704#endif
705
706#endif /* !PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
707
708 FT_TRACE0(( "pcf_property_set: missing property `%s'\n",
709 property_name ));
710 return FT_THROW( Missing_Property );
711 }
#define ft_strtol
Definition: ftstdlib.h:145

◆ PCF_Size_Request()

PCF_Size_Request ( FT_Size  size,
FT_Size_Request  req 
)

Definition at line 430 of file pcfdrivr.c.

432 {
433 PCF_Face face = (PCF_Face)size->face;
434 FT_Bitmap_Size* bsize = size->face->available_sizes;
435 FT_Error error = FT_ERR( Invalid_Pixel_Size );
437
438
439 height = FT_REQUEST_HEIGHT( req );
440 height = ( height + 32 ) >> 6;
441
442 switch ( req->type )
443 {
445 if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
447 break;
448
450 if ( height == ( face->accel.fontAscent +
451 face->accel.fontDescent ) )
453 break;
454
455 default:
456 error = FT_THROW( Unimplemented_Feature );
457 break;
458 }
459
460 if ( error )
461 return error;
462 else
463 return PCF_Size_Select( size, 0 );
464 }
@ FT_SIZE_REQUEST_TYPE_NOMINAL
Definition: freetype.h:2557
@ FT_SIZE_REQUEST_TYPE_REAL_DIM
Definition: freetype.h:2558
#define FT_REQUEST_HEIGHT(req)
Definition: ftobjs.h:665
signed long FT_Long
Definition: fttypes.h:242
#define FT_ERR(e)
Definition: fttypes.h:599
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
PCF_Size_Select(FT_Size size, FT_ULong strike_index)
Definition: pcfdrivr.c:413
FT_Size_Request_Type type
Definition: freetype.h:2609

◆ PCF_Size_Select()

PCF_Size_Select ( FT_Size  size,
FT_ULong  strike_index 
)

Definition at line 413 of file pcfdrivr.c.

415 {
416 PCF_Accel accel = &( (PCF_Face)size->face )->accel;
417
418
419 FT_Select_Metrics( size->face, strike_index );
420
421 size->metrics.ascender = accel->fontAscent * 64;
422 size->metrics.descender = -accel->fontDescent * 64;
423 size->metrics.max_advance = accel->maxbounds.characterWidth * 64;
424
425 return FT_Err_Ok;
426 }
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
Definition: ftobjs.c:3037
FT_Long fontDescent
Definition: pcf.h:130
FT_Long fontAscent
Definition: pcf.h:129
PCF_MetricRec maxbounds
Definition: pcf.h:133

Referenced by PCF_Size_Request().

Variable Documentation

◆ pcf_cmap_class

const FT_CMap_ClassRec pcf_cmap_class
static
Initial value:
=
{
sizeof ( PCF_CMapRec ),
}
pcf_cmap_char_next(FT_CMap pcfcmap, FT_UInt32 *acharcode)
Definition: pcfdrivr.c:132
pcf_cmap_char_index(FT_CMap pcfcmap, FT_UInt32 charcode)
Definition: pcfdrivr.c:105
pcf_cmap_done(FT_CMap pcfcmap)
Definition: pcfdrivr.c:95
pcf_cmap_init(FT_CMap pcfcmap, FT_Pointer init_data)
Definition: pcfdrivr.c:79
struct PCF_CMapRec_ PCF_CMapRec

Definition at line 177 of file pcfdrivr.c.

Referenced by PCF_Face_Init().

◆ pcf_driver_class

Definition at line 808 of file pcfdrivr.c.

◆ pcf_service_bdf

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

Definition at line 642 of file pcfdrivr.c.

Referenced by FT_DEFINE_SERVICE_PROPERTIESREC().