ReactOS 0.4.15-dev-5664-g3bf4ef6
t42objs.h File Reference
#include <ft2build.h>
#include "t42types.h"
Include dependency graph for t42objs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  T42_SizeRec_
 
struct  T42_GlyphSlotRec_
 
struct  T42_DriverRec_
 

Typedefs

typedef FT_BEGIN_HEADER struct T42_SizeRec_ T42_SizeRec
 
typedef FT_BEGIN_HEADER struct T42_SizeRec_T42_Size
 
typedef struct T42_GlyphSlotRec_ T42_GlyphSlotRec
 
typedef struct T42_GlyphSlotRec_T42_GlyphSlot
 
typedef struct T42_DriverRec_ T42_DriverRec
 
typedef struct T42_DriverRec_T42_Driver
 

Functions

 T42_Face_Init (FT_Stream stream, FT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 T42_Face_Done (FT_Face face)
 
 T42_Size_Init (FT_Size size)
 
 T42_Size_Request (FT_Size size, FT_Size_Request req)
 
 T42_Size_Select (FT_Size size, FT_ULong strike_index)
 
 T42_Size_Done (FT_Size size)
 
 T42_GlyphSlot_Init (FT_GlyphSlot slot)
 
 T42_GlyphSlot_Load (FT_GlyphSlot glyph, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
 
 T42_GlyphSlot_Done (FT_GlyphSlot slot)
 
 T42_Driver_Init (FT_Module module)
 
 T42_Driver_Done (FT_Module module)
 

Typedef Documentation

◆ T42_Driver

◆ T42_DriverRec

◆ T42_GlyphSlot

◆ T42_GlyphSlotRec

◆ T42_Size

◆ T42_SizeRec

Function Documentation

◆ T42_Driver_Done()

T42_Driver_Done ( FT_Module  module)

Definition at line 495 of file t42objs.c.

496 {
497 FT_UNUSED( module );
498 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ T42_Driver_Init()

T42_Driver_Init ( FT_Module  module)

Definition at line 475 of file t42objs.c.

476 {
478 FT_Module ttmodule;
479
480
481 ttmodule = FT_Get_Module( module->library, "truetype" );
482 if ( !ttmodule )
483 {
484 FT_ERROR(( "T42_Driver_Init: cannot access `truetype' module\n" ));
485 return FT_THROW( Missing_Module );
486 }
487
488 driver->ttclazz = (FT_Driver_Class)ttmodule->clazz;
489
490 return FT_Err_Ok;
491 }
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
struct FT_Driver_ClassRec_ * FT_Driver_Class
FT_Get_Module(FT_Library library, const char *module_name)
Definition: ftobjs.c:4837
struct @1653::@1654 driver
FT_Module_Class * clazz
Definition: ftobjs.h:535
struct T42_DriverRec_ * T42_Driver

◆ T42_Face_Done()

T42_Face_Done ( FT_Face  face)

Definition at line 405 of file t42objs.c.

406 {
407 T42_Face face = (T42_Face)t42face;
408 T1_Font type1;
411
412
413 if ( !face )
414 return;
415
416 type1 = &face->type1;
417 info = &type1->font_info;
418 memory = face->root.memory;
419
420 /* delete internal ttf face prior to freeing face->ttf_data */
421 if ( face->ttf_face )
422 FT_Done_Face( face->ttf_face );
423
424 /* release font info strings */
425 FT_FREE( info->version );
426 FT_FREE( info->notice );
427 FT_FREE( info->full_name );
428 FT_FREE( info->family_name );
429 FT_FREE( info->weight );
430
431 /* release top dictionary */
432 FT_FREE( type1->charstrings_len );
433 FT_FREE( type1->charstrings );
434 FT_FREE( type1->glyph_names );
435
436 FT_FREE( type1->charstrings_block );
437 FT_FREE( type1->glyph_names_block );
438
439 FT_FREE( type1->encoding.char_index );
440 FT_FREE( type1->encoding.char_name );
441 FT_FREE( type1->font_name );
442
443 FT_FREE( face->ttf_data );
444
445#if 0
446 /* release afm data if present */
447 if ( face->afm_data )
448 T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
449#endif
450
451 /* release unicode map, if any */
452 FT_FREE( face->unicode_map.maps );
453 face->unicode_map.num_maps = 0;
454
455 face->root.family_name = NULL;
456 face->root.style_name = NULL;
457 }
#define NULL
Definition: types.h:112
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2721
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static char memory[1024 *256]
Definition: process.c:116
PS_FontInfoRec font_info
Definition: t1types.h:96
FT_UInt * charstrings_len
Definition: t1types.h:116
FT_String ** glyph_names
Definition: t1types.h:114
T1_EncodingRec encoding
Definition: t1types.h:102
FT_String * font_name
Definition: t1types.h:99
FT_Byte * charstrings_block
Definition: t1types.h:105
FT_Byte ** charstrings
Definition: t1types.h:115
FT_Byte * glyph_names_block
Definition: t1types.h:106
FT_BEGIN_HEADER struct T42_FaceRec_ * T42_Face

◆ T42_Face_Init()

T42_Face_Init ( FT_Stream  stream,
FT_Face  face,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 164 of file t42objs.c.

169 {
170 T42_Face face = (T42_Face)t42face;
172 FT_Service_PsCMaps psnames;
173 PSAux_Service psaux;
174 FT_Face root = (FT_Face)&face->root;
175 T1_Font type1 = &face->type1;
176 PS_FontInfo info = &type1->font_info;
177
178 FT_UNUSED( num_params );
179 FT_UNUSED( params );
180 FT_UNUSED( stream );
181
182
183 face->ttf_face = NULL;
184 face->root.num_faces = 1;
185
186 FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
187 face->psnames = psnames;
188
190 "psaux" );
191 psaux = (PSAux_Service)face->psaux;
192 if ( !psaux )
193 {
194 FT_ERROR(( "T42_Face_Init: cannot access `psaux' module\n" ));
195 error = FT_THROW( Missing_Module );
196 goto Exit;
197 }
198
199 FT_TRACE2(( "Type 42 driver\n" ));
200
201 /* open the tokenizer, this will also check the font format */
203 if ( error )
204 goto Exit;
205
206 /* if we just wanted to check the format, leave successfully now */
207 if ( face_index < 0 )
208 goto Exit;
209
210 /* check the face index */
211 if ( ( face_index & 0xFFFF ) > 0 )
212 {
213 FT_ERROR(( "T42_Face_Init: invalid face index\n" ));
214 error = FT_THROW( Invalid_Argument );
215 goto Exit;
216 }
217
218 /* Now load the font program into the face object */
219
220 /* Init the face object fields */
221 /* Now set up root face fields */
222
223 root->num_glyphs = type1->num_glyphs;
224 root->num_charmaps = 0;
225 root->face_index = 0;
226
227 root->face_flags |= FT_FACE_FLAG_SCALABLE |
230
231 if ( info->is_fixed_pitch )
232 root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
233
234#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
235 root->face_flags |= FT_FACE_FLAG_HINTER;
236#endif
237
238 /* XXX: TODO -- add kerning with .afm support */
239
240 /* get style name -- be careful, some broken fonts only */
241 /* have a `/FontName' dictionary entry! */
242 root->family_name = info->family_name;
243 /* assume "Regular" style if we don't know better */
244 root->style_name = (char *)"Regular";
245 if ( root->family_name )
246 {
247 char* full = info->full_name;
248 char* family = root->family_name;
249
250
251 if ( full )
252 {
253 while ( *full )
254 {
255 if ( *full == *family )
256 {
257 family++;
258 full++;
259 }
260 else
261 {
262 if ( *full == ' ' || *full == '-' )
263 full++;
264 else if ( *family == ' ' || *family == '-' )
265 family++;
266 else
267 {
268 if ( !*family )
269 root->style_name = full;
270 break;
271 }
272 }
273 }
274 }
275 }
276 else
277 {
278 /* do we have a `/FontName'? */
279 if ( type1->font_name )
280 root->family_name = type1->font_name;
281 }
282
283 /* no embedded bitmap support */
284 root->num_fixed_sizes = 0;
285 root->available_sizes = NULL;
286
287 /* Load the TTF font embedded in the T42 font */
288 {
290
291
294 "truetype" );
295 args.memory_base = face->ttf_data;
296 args.memory_size = face->ttf_size;
297
298 if ( num_params )
299 {
300 args.flags |= FT_OPEN_PARAMS;
301 args.num_params = num_params;
302 args.params = params;
303 }
304
306 &args, 0, &face->ttf_face );
307 }
308
309 if ( error )
310 goto Exit;
311
312 FT_Done_Size( face->ttf_face->size );
313
314 /* Ignore info in FontInfo dictionary and use the info from the */
315 /* loaded TTF font. The PostScript interpreter also ignores it. */
316 root->bbox = face->ttf_face->bbox;
317 root->units_per_EM = face->ttf_face->units_per_EM;
318
319 root->ascender = face->ttf_face->ascender;
320 root->descender = face->ttf_face->descender;
321 root->height = face->ttf_face->height;
322
323 root->max_advance_width = face->ttf_face->max_advance_width;
324 root->max_advance_height = face->ttf_face->max_advance_height;
325
326 root->underline_position = (FT_Short)info->underline_position;
327 root->underline_thickness = (FT_Short)info->underline_thickness;
328
329 /* compute style flags */
330 root->style_flags = 0;
331 if ( info->italic_angle )
332 root->style_flags |= FT_STYLE_FLAG_ITALIC;
333
334 if ( face->ttf_face->style_flags & FT_STYLE_FLAG_BOLD )
335 root->style_flags |= FT_STYLE_FLAG_BOLD;
336
337 if ( face->ttf_face->face_flags & FT_FACE_FLAG_VERTICAL )
338 root->face_flags |= FT_FACE_FLAG_VERTICAL;
339
340 {
341 if ( psnames )
342 {
343 FT_CharMapRec charmap;
344 T1_CMap_Classes cmap_classes = psaux->t1_cmap_classes;
345 FT_CMap_Class clazz;
346
347
348 charmap.face = root;
349
350 /* first of all, try to synthesize a Unicode charmap */
353 charmap.encoding = FT_ENCODING_UNICODE;
354
355 error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );
356 if ( error &&
357 FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) )
358 goto Exit;
360
361 /* now, generate an Adobe Standard encoding when appropriate */
363 clazz = NULL;
364
365 switch ( type1->encoding_type )
366 {
368 charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
370 clazz = cmap_classes->standard;
371 break;
372
374 charmap.encoding = FT_ENCODING_ADOBE_EXPERT;
376 clazz = cmap_classes->expert;
377 break;
378
380 charmap.encoding = FT_ENCODING_ADOBE_CUSTOM;
382 clazz = cmap_classes->custom;
383 break;
384
386 charmap.encoding = FT_ENCODING_ADOBE_LATIN_1;
388 clazz = cmap_classes->unicode;
389 break;
390
391 default:
392 ;
393 }
394
395 if ( clazz )
396 error = FT_CMap_New( clazz, NULL, &charmap, NULL );
397 }
398 }
399 Exit:
400 return error;
401 }
struct _root root
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1181
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
#define FT_STYLE_FLAG_ITALIC
Definition: freetype.h:1517
#define FT_FACE_FLAG_SCALABLE
Definition: freetype.h:1238
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1249
#define FT_OPEN_PARAMS
Definition: freetype.h:2038
FT_Open_Face(FT_Library library, const FT_Open_Args *args, FT_Long face_index, FT_Face *aface)
Definition: ftobjs.c:2317
#define FT_FACE_FLAG_FIXED_WIDTH
Definition: freetype.h:1240
#define FT_OPEN_DRIVER
Definition: freetype.h:2037
#define FT_FACE_FLAG_VERTICAL
Definition: freetype.h:1243
struct FT_FaceRec_ * FT_Face
Definition: freetype.h:503
#define FT_OPEN_MEMORY
Definition: freetype.h:2034
#define FT_FACE_FLAG_GLYPH_NAMES
Definition: freetype.h:1247
#define FT_STYLE_FLAG_BOLD
Definition: freetype.h:1518
#define FT_FACE_FLAG_HORIZONTAL
Definition: freetype.h:1242
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
#define FT_FACE_LIBRARY(x)
Definition: ftobjs.h:635
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3614
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4865
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
Definition: ftserv.h:125
FT_Done_Size(FT_Size size)
Definition: ftobjs.c:2827
int FT_Error
Definition: fttypes.h:300
#define FT_ERR_NEQ(x, e)
Definition: fttypes.h:593
signed short FT_Short
Definition: fttypes.h:198
GLenum const GLfloat * params
Definition: glext.h:5645
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
struct PSAux_ServiceRec_ * PSAux_Service
#define args
Definition: format.c:66
static void Exit(void)
Definition: sock.c:1330
FT_Face face
Definition: freetype.h:842
FT_Encoding encoding
Definition: freetype.h:843
FT_UShort platform_id
Definition: freetype.h:844
FT_UShort encoding_id
Definition: freetype.h:845
T1_CMap_Classes t1_cmap_classes
Definition: psaux.h:1304
FT_CMap_Class standard
Definition: psaux.h:1262
FT_CMap_Class custom
Definition: psaux.h:1264
FT_CMap_Class expert
Definition: psaux.h:1263
FT_CMap_Class unicode
Definition: psaux.h:1265
Definition: match.c:390
Definition: parse.h:23
@ T1_ENCODING_TYPE_ISOLATIN1
Definition: t1tables.h:565
@ T1_ENCODING_TYPE_STANDARD
Definition: t1tables.h:564
@ T1_ENCODING_TYPE_ARRAY
Definition: t1tables.h:563
@ T1_ENCODING_TYPE_EXPERT
Definition: t1tables.h:566
static FT_Error T42_Open_Face(T42_Face face)
Definition: t42objs.c:32
#define TT_ADOBE_ID_EXPERT
Definition: ttnameid.h:282
#define TT_ADOBE_ID_STANDARD
Definition: ttnameid.h:281
#define TT_PLATFORM_ADOBE
Definition: ttnameid.h:91
#define TT_ADOBE_ID_LATIN_1
Definition: ttnameid.h:284
#define TT_ADOBE_ID_CUSTOM
Definition: ttnameid.h:283

◆ T42_GlyphSlot_Done()

T42_GlyphSlot_Done ( FT_GlyphSlot  slot)

Definition at line 603 of file t42objs.c.

604 {
606
607
608 FT_Done_GlyphSlot( slot->ttslot );
609 }
FT_Done_GlyphSlot(FT_GlyphSlot slot)
Definition: ftobjs.c:612
Definition: vfat.h:185
struct T42_GlyphSlotRec_ * T42_GlyphSlot

◆ T42_GlyphSlot_Init()

T42_GlyphSlot_Init ( FT_GlyphSlot  slot)

Definition at line 578 of file t42objs.c.

579 {
581 FT_Face face = t42slot->face;
582 T42_Face t42face = (T42_Face)face;
583 FT_GlyphSlot ttslot;
585
586
587 if ( !face->glyph )
588 {
589 /* First glyph slot for this face */
590 slot->ttslot = t42face->ttf_face->glyph;
591 }
592 else
593 {
594 error = FT_New_GlyphSlot( t42face->ttf_face, &ttslot );
595 slot->ttslot = ttslot;
596 }
597
598 return error;
599 }
FT_New_GlyphSlot(FT_Face face, FT_GlyphSlot *aslot)
Definition: ftobjs.c:559

◆ T42_GlyphSlot_Load()

T42_GlyphSlot_Load ( FT_GlyphSlot  glyph,
FT_Size  size,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 638 of file t42objs.c.

642 {
644 T42_GlyphSlot t42slot = (T42_GlyphSlot)glyph;
645 T42_Size t42size = (T42_Size)size;
646 T42_Face t42face = (T42_Face)size->face;
647 FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;
648
649
650 FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index ));
651
652 /* map T42 glyph index to embedded TTF's glyph index */
653 glyph_index = (FT_UInt)ft_strtol(
654 (const char *)t42face->type1.charstrings[glyph_index],
655 NULL, 10 );
656
657 t42_glyphslot_clear( t42slot->ttslot );
658 error = ttclazz->load_glyph( t42slot->ttslot,
659 t42size->ttsize,
660 glyph_index,
661 load_flags | FT_LOAD_NO_BITMAP );
662
663 if ( !error )
664 {
665 glyph->metrics = t42slot->ttslot->metrics;
666
667 glyph->linearHoriAdvance = t42slot->ttslot->linearHoriAdvance;
668 glyph->linearVertAdvance = t42slot->ttslot->linearVertAdvance;
669
670 glyph->format = t42slot->ttslot->format;
671 glyph->outline = t42slot->ttslot->outline;
672
673 glyph->bitmap = t42slot->ttslot->bitmap;
674 glyph->bitmap_left = t42slot->ttslot->bitmap_left;
675 glyph->bitmap_top = t42slot->ttslot->bitmap_top;
676
677 glyph->num_subglyphs = t42slot->ttslot->num_subglyphs;
678 glyph->subglyphs = t42slot->ttslot->subglyphs;
679
680 glyph->control_data = t42slot->ttslot->control_data;
681 glyph->control_len = t42slot->ttslot->control_len;
682 }
683
684 return error;
685 }
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
#define ft_strtol
Definition: ftstdlib.h:145
unsigned int FT_UInt
Definition: fttypes.h:231
GLsizeiptr size
Definition: glext.h:5919
FT_Driver driver
Definition: freetype.h:1111
FT_Int bitmap_top
Definition: freetype.h:1925
FT_SubGlyph subglyphs
Definition: freetype.h:1930
void * control_data
Definition: freetype.h:1932
FT_UInt num_subglyphs
Definition: freetype.h:1929
FT_Int bitmap_left
Definition: freetype.h:1924
FT_Bitmap bitmap
Definition: freetype.h:1923
FT_Outline outline
Definition: freetype.h:1927
FT_Fixed linearHoriAdvance
Definition: freetype.h:1917
FT_Fixed linearVertAdvance
Definition: freetype.h:1918
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_GlyphSlot ttslot
Definition: t42objs.h:49
static void t42_glyphslot_clear(FT_GlyphSlot slot)
Definition: t42objs.c:613
FT_BEGIN_HEADER struct T42_SizeRec_ * T42_Size

◆ T42_Size_Done()

T42_Size_Done ( FT_Size  size)

Definition at line 560 of file t42objs.c.

561 {
562 T42_Size size = (T42_Size)t42size;
563 FT_Face face = t42size->face;
564 T42_Face t42face = (T42_Face)face;
566
567
568 node = FT_List_Find( &t42face->ttf_face->sizes_list, size->ttsize );
569 if ( node )
570 {
571 FT_Done_Size( size->ttsize );
572 size->ttsize = NULL;
573 }
574 }
FT_BEGIN_HEADER FT_List_Find(FT_List list, void *data)
Definition: ftutil.c:244
Definition: dlist.c:348

◆ T42_Size_Init()

T42_Size_Init ( FT_Size  size)

Definition at line 502 of file t42objs.c.

503 {
504 T42_Size t42size = (T42_Size)size;
505 FT_Face face = size->face;
506 T42_Face t42face = (T42_Face)face;
507 FT_Size ttsize;
509
510
511 error = FT_New_Size( t42face->ttf_face, &ttsize );
512 t42size->ttsize = ttsize;
513
514 FT_Activate_Size( ttsize );
515
516 return error;
517 }
FT_Activate_Size(FT_Size size)
Definition: ftobjs.c:4230
FT_BEGIN_HEADER FT_New_Size(FT_Face face, FT_Size *size)
Definition: ftobjs.c:2762

◆ T42_Size_Request()

T42_Size_Request ( FT_Size  size,
FT_Size_Request  req 
)

Definition at line 521 of file t42objs.c.

523 {
524 T42_Size size = (T42_Size)t42size;
525 T42_Face face = (T42_Face)t42size->face;
527
528
529 FT_Activate_Size( size->ttsize );
530
531 error = FT_Request_Size( face->ttf_face, req );
532 if ( !error )
533 t42size->metrics = face->ttf_face->size->metrics;
534
535 return error;
536 }
FT_Request_Size(FT_Face face, FT_Size_Request req)
Definition: ftobjs.c:3192

◆ T42_Size_Select()

T42_Size_Select ( FT_Size  size,
FT_ULong  strike_index 
)

Definition at line 540 of file t42objs.c.

542 {
543 T42_Size size = (T42_Size)t42size;
544 T42_Face face = (T42_Face)t42size->face;
546
547
548 FT_Activate_Size( size->ttsize );
549
550 error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index );
551 if ( !error )
552 t42size->metrics = face->ttf_face->size->metrics;
553
554 return error;
555
556 }
FT_Select_Size(FT_Face face, FT_Int strike_index)
Definition: ftobjs.c:3138
signed int FT_Int
Definition: fttypes.h:220