ReactOS 0.4.16-dev-1019-g2c2cdfd
ftglyph.h File Reference
#include <ft2build.h>
Include dependency graph for ftglyph.h:

Go to the source code of this file.

Classes

struct  FT_GlyphRec_
 
struct  FT_BitmapGlyphRec_
 
struct  FT_OutlineGlyphRec_
 

Macros

#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED
 
#define ft_glyph_bbox_subpixels   FT_GLYPH_BBOX_SUBPIXELS
 
#define ft_glyph_bbox_gridfit   FT_GLYPH_BBOX_GRIDFIT
 
#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE
 
#define ft_glyph_bbox_pixels   FT_GLYPH_BBOX_PIXELS
 

Typedefs

typedef typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
 
typedef struct FT_GlyphRec_FT_Glyph
 
typedef struct FT_GlyphRec_ FT_GlyphRec
 
typedef struct FT_BitmapGlyphRec_FT_BitmapGlyph
 
typedef struct FT_BitmapGlyphRec_ FT_BitmapGlyphRec
 
typedef struct FT_OutlineGlyphRec_FT_OutlineGlyph
 
typedef struct FT_OutlineGlyphRec_ FT_OutlineGlyphRec
 
typedef enum FT_Glyph_BBox_Mode_ FT_Glyph_BBox_Mode
 

Enumerations

enum  FT_Glyph_BBox_Mode_ {
  FT_GLYPH_BBOX_UNSCALED = 0 , FT_GLYPH_BBOX_SUBPIXELS = 0 , FT_GLYPH_BBOX_GRIDFIT = 1 , FT_GLYPH_BBOX_TRUNCATE = 2 ,
  FT_GLYPH_BBOX_PIXELS = 3
}
 

Functions

 FT_New_Glyph (FT_Library library, FT_Glyph_Format format, FT_Glyph *aglyph)
 
 FT_Get_Glyph (FT_GlyphSlot slot, FT_Glyph *aglyph)
 
 FT_Glyph_Copy (FT_Glyph source, FT_Glyph *target)
 
 FT_Glyph_Transform (FT_Glyph glyph, FT_Matrix *matrix, FT_Vector *delta)
 
 FT_Glyph_Get_CBox (FT_Glyph glyph, FT_UInt bbox_mode, FT_BBox *acbox)
 
 FT_Glyph_To_Bitmap (FT_Glyph *the_glyph, FT_Render_Mode render_mode, FT_Vector *origin, FT_Bool destroy)
 
 FT_Done_Glyph (FT_Glyph glyph)
 
 FT_Matrix_Multiply (const FT_Matrix *a, FT_Matrix *b)
 
 FT_Matrix_Invert (FT_Matrix *matrix)
 

Macro Definition Documentation

◆ ft_glyph_bbox_gridfit

#define ft_glyph_bbox_gridfit   FT_GLYPH_BBOX_GRIDFIT

Definition at line 385 of file ftglyph.h.

◆ ft_glyph_bbox_pixels

#define ft_glyph_bbox_pixels   FT_GLYPH_BBOX_PIXELS

Definition at line 387 of file ftglyph.h.

◆ ft_glyph_bbox_subpixels

#define ft_glyph_bbox_subpixels   FT_GLYPH_BBOX_SUBPIXELS

Definition at line 384 of file ftglyph.h.

◆ ft_glyph_bbox_truncate

#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE

Definition at line 386 of file ftglyph.h.

◆ ft_glyph_bbox_unscaled

#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED

Definition at line 383 of file ftglyph.h.

Typedef Documentation

◆ FT_BitmapGlyph

Definition at line 132 of file ftglyph.h.

◆ FT_BitmapGlyphRec

◆ FT_Glyph

Definition at line 88 of file ftglyph.h.

◆ FT_Glyph_BBox_Mode

◆ FT_Glyph_Class

typedef typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class

Definition at line 70 of file ftglyph.h.

◆ FT_GlyphRec

◆ FT_OutlineGlyph

Definition at line 187 of file ftglyph.h.

◆ FT_OutlineGlyphRec

Enumeration Type Documentation

◆ FT_Glyph_BBox_Mode_

Enumerator
FT_GLYPH_BBOX_UNSCALED 
FT_GLYPH_BBOX_SUBPIXELS 
FT_GLYPH_BBOX_GRIDFIT 
FT_GLYPH_BBOX_TRUNCATE 
FT_GLYPH_BBOX_PIXELS 

Definition at line 370 of file ftglyph.h.

371 {
377
@ FT_GLYPH_BBOX_UNSCALED
Definition: ftglyph.h:372
@ FT_GLYPH_BBOX_GRIDFIT
Definition: ftglyph.h:374
@ FT_GLYPH_BBOX_PIXELS
Definition: ftglyph.h:376
@ FT_GLYPH_BBOX_SUBPIXELS
Definition: ftglyph.h:373
@ FT_GLYPH_BBOX_TRUNCATE
Definition: ftglyph.h:375
enum FT_Glyph_BBox_Mode_ FT_Glyph_BBox_Mode

Function Documentation

◆ FT_Done_Glyph()

FT_Done_Glyph ( FT_Glyph  glyph)

Definition at line 640 of file ftglyph.c.

641 {
642 if ( glyph )
643 {
644 FT_Memory memory = glyph->library->memory;
645 const FT_Glyph_Class* clazz = glyph->clazz;
646
647
648 if ( clazz->glyph_done )
649 clazz->glyph_done( glyph );
650
651 FT_FREE( glyph );
652 }
653 }
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
Definition: ftglyph.h:70
#define FT_FREE(ptr)
Definition: ftmemory.h:328
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65
static char memory[1024 *256]
Definition: process.c:116
FT_Library library
Definition: ftglyph.h:115
const FT_Glyph_Class * clazz
Definition: ftglyph.h:116
FT_Memory memory
Definition: ftobjs.h:897

Referenced by FT_Get_Glyph(), FT_Glyph_Copy(), FT_Glyph_Stroke(), FT_Glyph_StrokeBorder(), FT_Glyph_To_Bitmap(), ftc_inode_free(), IntGetBitmapGlyphWithCache(), and RemoveCachedEntry().

◆ FT_Get_Glyph()

FT_Get_Glyph ( FT_GlyphSlot  slot,
FT_Glyph aglyph 
)

Definition at line 400 of file ftglyph.c.

402 {
404 FT_Glyph glyph;
405
406
407 if ( !slot )
408 return FT_THROW( Invalid_Slot_Handle );
409
410 if ( !aglyph )
411 return FT_THROW( Invalid_Argument );
412
413 /* create FT_Glyph object */
414 error = FT_New_Glyph( slot->library, slot->format, &glyph );
415 if ( error )
416 goto Exit;
417
418 /* copy advance while converting 26.6 to 16.16 format */
419 if ( slot->advance.x >= 0x8000L * 64 ||
420 slot->advance.x <= -0x8000L * 64 )
421 {
422 FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
423 error = FT_THROW( Invalid_Argument );
424 goto Exit2;
425 }
426 if ( slot->advance.y >= 0x8000L * 64 ||
427 slot->advance.y <= -0x8000L * 64 )
428 {
429 FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
430 error = FT_THROW( Invalid_Argument );
431 goto Exit2;
432 }
433
434 glyph->advance.x = slot->advance.x * 1024;
435 glyph->advance.y = slot->advance.y * 1024;
436
437 /* now import the image from the glyph slot */
438 error = glyph->clazz->glyph_init( glyph, slot );
439
440 Exit2:
441 /* if an error occurred, destroy the glyph */
442 if ( error )
443 FT_Done_Glyph( glyph );
444 else
445 *aglyph = glyph;
446
447 Exit:
448 return error;
449 }
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_THROW(e)
Definition: ftdebug.h:241
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:640
FT_New_Glyph(FT_Library library, FT_Glyph_Format format, FT_Glyph *aglyph)
Definition: ftglyph.c:362
int FT_Error
Definition: fttypes.h:299
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_Vector advance
Definition: ftglyph.h:118
FT_Pos x
Definition: ftimage.h:78
FT_Pos y
Definition: ftimage.h:79
Definition: vfat.h:185

Referenced by ftc_basic_family_load_glyph(), and IntGetBitmapGlyphWithCache().

◆ FT_Glyph_Copy()

FT_Glyph_Copy ( FT_Glyph  source,
FT_Glyph target 
)

Definition at line 315 of file ftglyph.c.

317 {
320 const FT_Glyph_Class* clazz;
321
322
323 /* check arguments */
324 if ( !target || !source || !source->clazz )
325 {
326 error = FT_THROW( Invalid_Argument );
327 goto Exit;
328 }
329
330 *target = NULL;
331
332 if ( !source || !source->clazz )
333 {
334 error = FT_THROW( Invalid_Argument );
335 goto Exit;
336 }
337
338 clazz = source->clazz;
339 error = ft_new_glyph( source->library, clazz, &copy );
340 if ( error )
341 goto Exit;
342
343 copy->advance = source->advance;
344 copy->format = source->format;
345
346 if ( clazz->glyph_copy )
347 error = clazz->glyph_copy( source, copy );
348
349 if ( error )
351 else
352 *target = copy;
353
354 Exit:
355 return error;
356 }
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define NULL
Definition: types.h:112
GLenum target
Definition: glext.h:7315

Referenced by FT_Glyph_Stroke(), and FT_Glyph_StrokeBorder().

◆ FT_Glyph_Get_CBox()

FT_Glyph_Get_CBox ( FT_Glyph  glyph,
FT_UInt  bbox_mode,
FT_BBox acbox 
)

Definition at line 488 of file ftglyph.c.

491 {
492 const FT_Glyph_Class* clazz;
493
494
495 if ( !acbox )
496 return;
497
498 acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;
499
500 if ( !glyph || !glyph->clazz )
501 return;
502
503 clazz = glyph->clazz;
504 if ( !clazz->glyph_bbox )
505 return;
506
507 /* retrieve bbox in 26.6 coordinates */
508 clazz->glyph_bbox( glyph, acbox );
509
510 /* perform grid fitting if needed */
511 if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
512 bbox_mode == FT_GLYPH_BBOX_PIXELS )
513 {
514 acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
515 acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
516 acbox->xMax = FT_PIX_CEIL_LONG( acbox->xMax );
517 acbox->yMax = FT_PIX_CEIL_LONG( acbox->yMax );
518 }
519
520 /* convert to integer pixels if needed */
521 if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||
522 bbox_mode == FT_GLYPH_BBOX_PIXELS )
523 {
524 acbox->xMin >>= 6;
525 acbox->yMin >>= 6;
526 acbox->xMax >>= 6;
527 acbox->yMax >>= 6;
528 }
529 }
#define FT_PIX_FLOOR(x)
Definition: ftobjs.h:91
#define FT_PIX_CEIL_LONG(x)
Definition: ftobjs.h:102
FT_Pos xMin
Definition: ftimage.h:121
FT_Pos yMax
Definition: ftimage.h:122
FT_Pos yMin
Definition: ftimage.h:121
FT_Pos xMax
Definition: ftimage.h:122

◆ FT_Glyph_To_Bitmap()

FT_Glyph_To_Bitmap ( FT_Glyph the_glyph,
FT_Render_Mode  render_mode,
FT_Vector origin,
FT_Bool  destroy 
)

Definition at line 535 of file ftglyph.c.

539 {
541 FT_GlyphSlot_InternalRec dummy_internal;
543 FT_Glyph b, glyph;
545 const FT_Glyph_Class* clazz;
546
548
549
550 /* check argument */
551 if ( !the_glyph )
552 goto Bad;
553 glyph = *the_glyph;
554 if ( !glyph )
555 goto Bad;
556
557 clazz = glyph->clazz;
558 library = glyph->library;
559 if ( !library || !clazz )
560 goto Bad;
561
562 /* when called with a bitmap glyph, do nothing and return successfully */
563 if ( clazz == &ft_bitmap_glyph_class )
564 goto Exit;
565
566 if ( !clazz->glyph_prepare )
567 goto Bad;
568
569 /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
570 /* then calling FT_Render_Glyph_Internal() */
571
572 FT_ZERO( &dummy );
573 FT_ZERO( &dummy_internal );
574 dummy.internal = &dummy_internal;
575 dummy.library = library;
576 dummy.format = clazz->glyph_format;
577
578 /* create result bitmap glyph */
579 error = ft_new_glyph( library, &ft_bitmap_glyph_class, &b );
580 if ( error )
581 goto Exit;
583
584#if 1
585 /* if `origin' is set, translate the glyph image */
586 if ( origin )
587 FT_Glyph_Transform( glyph, 0, origin );
588#else
589 FT_UNUSED( origin );
590#endif
591
592 /* prepare dummy slot for rendering */
593 error = clazz->glyph_prepare( glyph, &dummy );
594 if ( !error )
595 error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
596
597#if 1
598 if ( !destroy && origin )
599 {
600 FT_Vector v;
601
602
603 v.x = -origin->x;
604 v.y = -origin->y;
605 FT_Glyph_Transform( glyph, 0, &v );
606 }
607#endif
608
609 if ( error )
610 goto Exit;
611
612 /* in case of success, copy the bitmap to the glyph bitmap */
614 if ( error )
615 goto Exit;
616
617 /* copy advance */
618 bitmap->root.advance = glyph->advance;
619
620 if ( destroy )
621 FT_Done_Glyph( glyph );
622
623 *the_glyph = FT_GLYPH( bitmap );
624
625 Exit:
626 if ( error && bitmap )
628
629 return error;
630
631 Bad:
632 error = FT_THROW( Invalid_Argument );
633 goto Exit;
634 }
void destroy(_Tp *__pointer)
Definition: _construct.h:278
FT_Library library
Definition: cffdrivr.c:661
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_UNUSED(arg)
Definition: ftconfig.h:100
ft_bitmap_glyph_init(FT_Glyph bitmap_glyph, FT_GlyphSlot slot)
Definition: ftglyph.c:59
FT_Glyph_Transform(FT_Glyph glyph, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftglyph.c:455
struct FT_BitmapGlyphRec_ * FT_BitmapGlyph
Definition: ftglyph.h:132
#define FT_ZERO(p)
Definition: ftmemory.h:237
FT_Render_Glyph_Internal(FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4528
#define FT_GLYPH(x)
Definition: ftobjs.h:738
const GLdouble * v
Definition: gl.h:2040
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
voidpf uLong int origin
Definition: ioapi.h:144
#define b
Definition: ke_i.h:79
Definition: uimain.c:89

Referenced by IntGetBitmapGlyphWithCache().

◆ FT_Glyph_Transform()

FT_Glyph_Transform ( FT_Glyph  glyph,
FT_Matrix matrix,
FT_Vector delta 
)

Definition at line 455 of file ftglyph.c.

458 {
460
461
462 if ( !glyph || !glyph->clazz )
463 error = FT_THROW( Invalid_Argument );
464 else
465 {
466 const FT_Glyph_Class* clazz = glyph->clazz;
467
468
469 if ( clazz->glyph_transform )
470 {
471 /* transform glyph image */
472 clazz->glyph_transform( glyph, matrix, delta );
473
474 /* transform advance vector */
475 if ( matrix )
477 }
478 else
479 error = FT_THROW( Invalid_Glyph_Format );
480 }
481 return error;
482 }
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:675
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by FT_Glyph_To_Bitmap().

◆ FT_Matrix_Invert()

FT_Matrix_Invert ( FT_Matrix matrix)

Definition at line 689 of file ftcalc.c.

690 {
691 FT_Pos delta, xx, yy;
692
693
694 if ( !matrix )
695 return FT_THROW( Invalid_Argument );
696
697 /* compute discriminant */
698 delta = FT_MulFix( matrix->xx, matrix->yy ) -
699 FT_MulFix( matrix->xy, matrix->yx );
700
701 if ( !delta )
702 return FT_THROW( Invalid_Argument ); /* matrix can't be inverted */
703
704 matrix->xy = -FT_DivFix( matrix->xy, delta );
705 matrix->yx = -FT_DivFix( matrix->yx, delta );
706
707 xx = matrix->xx;
708 yy = matrix->yy;
709
710 matrix->xx = FT_DivFix( yy, delta );
711 matrix->yy = FT_DivFix( xx, delta );
712
713 return FT_Err_Ok;
714 }
FT_MulFix(FT_Long a_, FT_Long b_)
Definition: ftcalc.c:509
FT_DivFix(FT_Long a_, FT_Long b_)
Definition: ftcalc.c:608
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
int xx
Definition: npserver.c:29

Referenced by af_loader_load_glyph().

◆ FT_Matrix_Multiply()

FT_Matrix_Multiply ( const FT_Matrix a,
FT_Matrix b 
)

Definition at line 661 of file ftcalc.c.

663 {
664 FT_Fixed xx, xy, yx, yy;
665
666
667 if ( !a || !b )
668 return;
669
670 xx = ADD_LONG( FT_MulFix( a->xx, b->xx ),
671 FT_MulFix( a->xy, b->yx ) );
672 xy = ADD_LONG( FT_MulFix( a->xx, b->xy ),
673 FT_MulFix( a->xy, b->yy ) );
674 yx = ADD_LONG( FT_MulFix( a->yx, b->xx ),
675 FT_MulFix( a->yy, b->yx ) );
676 yy = ADD_LONG( FT_MulFix( a->yx, b->xy ),
677 FT_MulFix( a->yy, b->yy ) );
678
679 b->xx = xx;
680 b->xy = xy;
681 b->yx = yx;
682 b->yy = yy;
683 }
#define ADD_LONG(a, b)
Definition: ftcalc.h:473
signed long FT_Fixed
Definition: fttypes.h:287
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by ftGdiGetGlyphOutline(), and IntExtTextOutW().

◆ FT_New_Glyph()

FT_New_Glyph ( FT_Library  library,
FT_Glyph_Format  format,
FT_Glyph aglyph 
)

Definition at line 362 of file ftglyph.c.

365 {
366 const FT_Glyph_Class* clazz = NULL;
367
368 if ( !library || !aglyph )
369 return FT_THROW( Invalid_Argument );
370
371 /* if it is a bitmap, that's easy :-) */
372 if ( format == FT_GLYPH_FORMAT_BITMAP )
373 clazz = &ft_bitmap_glyph_class;
374
375 /* if it is an outline */
376 else if ( format == FT_GLYPH_FORMAT_OUTLINE )
377 clazz = &ft_outline_glyph_class;
378
379 else
380 {
381 /* try to find a renderer that supports the glyph image format */
383
384
385 if ( render )
386 clazz = &render->glyph_class;
387 }
388
389 if ( !clazz )
390 return FT_THROW( Invalid_Glyph_Format );
391
392 /* create FT_Glyph object */
393 return ft_new_glyph( library, clazz, aglyph );
394 }
FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4307
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:465
FT_CALLBACK_TABLE const FT_Glyph_Class ft_outline_glyph_class
Definition: ftstroke.c:30
static void render(void)
Definition: ssstars.c:272
Definition: format.c:58

Referenced by FT_Get_Glyph().