ReactOS 0.4.16-dev-2354-g16de117
ftglyph.h File Reference
Include dependency graph for ftglyph.h:
This graph shows which files directly or indirectly include this file:

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 384 of file ftglyph.h.

◆ ft_glyph_bbox_pixels

#define ft_glyph_bbox_pixels   FT_GLYPH_BBOX_PIXELS

Definition at line 386 of file ftglyph.h.

◆ ft_glyph_bbox_subpixels

#define ft_glyph_bbox_subpixels   FT_GLYPH_BBOX_SUBPIXELS

Definition at line 383 of file ftglyph.h.

◆ ft_glyph_bbox_truncate

#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE

Definition at line 385 of file ftglyph.h.

◆ ft_glyph_bbox_unscaled

#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED

Definition at line 382 of file ftglyph.h.

Typedef Documentation

◆ FT_BitmapGlyph

Definition at line 131 of file ftglyph.h.

◆ FT_BitmapGlyphRec

◆ FT_Glyph

Definition at line 87 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 69 of file ftglyph.h.

◆ FT_GlyphRec

◆ FT_OutlineGlyph

Definition at line 186 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 369 of file ftglyph.h.

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

Function Documentation

◆ FT_Done_Glyph()

FT_Done_Glyph ( FT_Glyph  glyph)

Definition at line 641 of file ftglyph.c.

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

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 401 of file ftglyph.c.

403 {
405 FT_Glyph glyph;
406
407
408 if ( !slot )
409 return FT_THROW( Invalid_Slot_Handle );
410
411 if ( !aglyph )
412 return FT_THROW( Invalid_Argument );
413
414 /* create FT_Glyph object */
415 error = FT_New_Glyph( slot->library, slot->format, &glyph );
416 if ( error )
417 goto Exit;
418
419 /* copy advance while converting 26.6 to 16.16 format */
420 if ( slot->advance.x >= 0x8000L * 64 ||
421 slot->advance.x <= -0x8000L * 64 )
422 {
423 FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
424 error = FT_THROW( Invalid_Argument );
425 goto Exit2;
426 }
427 if ( slot->advance.y >= 0x8000L * 64 ||
428 slot->advance.y <= -0x8000L * 64 )
429 {
430 FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
431 error = FT_THROW( Invalid_Argument );
432 goto Exit2;
433 }
434
435 glyph->advance.x = slot->advance.x * 1024;
436 glyph->advance.y = slot->advance.y * 1024;
437
438 /* now import the image from the glyph slot */
439 error = glyph->clazz->glyph_init( glyph, slot );
440
441 Exit2:
442 /* if an error occurred, destroy the glyph */
443 if ( error )
444 FT_Done_Glyph( glyph );
445 else
446 *aglyph = glyph;
447
448 Exit:
449 return error;
450 }
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:243
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:641
FT_New_Glyph(FT_Library library, FT_Glyph_Format format, FT_Glyph *aglyph)
Definition: ftglyph.c:363
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:117
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
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 316 of file ftglyph.c.

318 {
321 const FT_Glyph_Class* clazz;
322
323
324 /* check arguments */
325 if ( !target || !source || !source->clazz )
326 {
327 error = FT_THROW( Invalid_Argument );
328 goto Exit;
329 }
330
331 *target = NULL;
332
333 if ( !source || !source->clazz )
334 {
335 error = FT_THROW( Invalid_Argument );
336 goto Exit;
337 }
338
339 clazz = source->clazz;
340 error = ft_new_glyph( source->library, clazz, &copy );
341 if ( error )
342 goto Exit;
343
344 copy->advance = source->advance;
345 copy->format = source->format;
346
347 if ( clazz->glyph_copy )
348 error = clazz->glyph_copy( source, copy );
349
350 if ( error )
352 else
353 *target = copy;
354
355 Exit:
356 return error;
357 }
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
Definition: tools.h:99

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 489 of file ftglyph.c.

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

◆ 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 536 of file ftglyph.c.

540 {
542 FT_GlyphSlot_InternalRec dummy_internal;
544 FT_Glyph b, glyph;
546 const FT_Glyph_Class* clazz;
547
549
550
551 /* check argument */
552 if ( !the_glyph )
553 goto Bad;
554 glyph = *the_glyph;
555 if ( !glyph )
556 goto Bad;
557
558 clazz = glyph->clazz;
559 library = glyph->library;
560 if ( !library || !clazz )
561 goto Bad;
562
563 /* when called with a bitmap glyph, do nothing and return successfully */
564 if ( clazz == &ft_bitmap_glyph_class )
565 goto Exit;
566
567 if ( !clazz->glyph_prepare )
568 goto Bad;
569
570 /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
571 /* then calling FT_Render_Glyph_Internal() */
572
573 FT_ZERO( &dummy );
574 FT_ZERO( &dummy_internal );
575 dummy.internal = &dummy_internal;
576 dummy.library = library;
577 dummy.format = clazz->glyph_format;
578
579 /* create result bitmap glyph */
580 error = ft_new_glyph( library, &ft_bitmap_glyph_class, &b );
581 if ( error )
582 goto Exit;
584
585#if 1
586 /* if `origin' is set, translate the glyph image */
587 if ( origin )
588 FT_Glyph_Transform( glyph, 0, origin );
589#else
590 FT_UNUSED( origin );
591#endif
592
593 /* prepare dummy slot for rendering */
594 error = clazz->glyph_prepare( glyph, &dummy );
595 if ( !error )
596 error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
597
598#if 1
599 if ( !destroy && origin )
600 {
601 FT_Vector v;
602
603
604 v.x = -origin->x;
605 v.y = -origin->y;
606 FT_Glyph_Transform( glyph, 0, &v );
607 }
608#endif
609
610 if ( error )
611 goto Exit;
612
613 /* in case of success, copy the bitmap to the glyph bitmap */
615 if ( error )
616 goto Exit;
617
618 /* copy advance */
619 bitmap->root.advance = glyph->advance;
620
621 if ( destroy )
622 FT_Done_Glyph( glyph );
623
624 *the_glyph = FT_GLYPH( bitmap );
625
626 Exit:
627 if ( error && bitmap )
629
630 return error;
631
632 Bad:
633 error = FT_THROW( Invalid_Argument );
634 goto Exit;
635 }
void destroy(_Tp *__pointer)
Definition: _construct.h:278
FT_Library library
Definition: cffdrivr.c:660
return FT_Err_Ok
Definition: ftbbox.c:526
ft_bitmap_glyph_init(FT_Glyph bitmap_glyph, FT_GlyphSlot slot)
Definition: ftglyph.c:60
FT_Glyph_Transform(FT_Glyph glyph, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftglyph.c:456
struct FT_BitmapGlyphRec_ * FT_BitmapGlyph
Definition: ftglyph.h:131
#define FT_ZERO(p)
Definition: ftmemory.h:246
FT_Render_Glyph_Internal(FT_Library library, FT_GlyphSlot slot, FT_Render_Mode render_mode)
Definition: ftobjs.c:4548
#define FT_GLYPH(x)
Definition: ftobjs.h:736
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
#define FT_UNUSED(arg)
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 456 of file ftglyph.c.

459 {
461
462
463 if ( !glyph || !glyph->clazz )
464 error = FT_THROW( Invalid_Argument );
465 else
466 {
467 const FT_Glyph_Class* clazz = glyph->clazz;
468
469
470 if ( clazz->glyph_transform )
471 {
472 /* transform glyph image */
473 clazz->glyph_transform( glyph, matrix, delta );
474
475 /* transform advance vector */
476 if ( matrix )
478 }
479 else
480 error = FT_THROW( Invalid_Glyph_Format );
481 }
482 return error;
483 }
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:683
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 688 of file ftcalc.c.

689 {
690 FT_Pos delta, xx, yy;
691
692
693 if ( !matrix )
694 return FT_THROW( Invalid_Argument );
695
696 /* compute discriminant */
697 delta = FT_MulFix( matrix->xx, matrix->yy ) -
698 FT_MulFix( matrix->xy, matrix->yx );
699
700 if ( !delta )
701 return FT_THROW( Invalid_Argument ); /* matrix can't be inverted */
702
703 matrix->xy = -FT_DivFix( matrix->xy, delta );
704 matrix->yx = -FT_DivFix( matrix->yx, delta );
705
706 xx = matrix->xx;
707 yy = matrix->yy;
708
709 matrix->xx = FT_DivFix( yy, delta );
710 matrix->yy = FT_DivFix( xx, delta );
711
712 return FT_Err_Ok;
713 }
FT_MulFix(FT_Long a_, FT_Long b_)
Definition: ftcalc.c:508
FT_DivFix(FT_Long a_, FT_Long b_)
Definition: ftcalc.c:607
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
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 660 of file ftcalc.c.

662 {
663 FT_Fixed xx, xy, yx, yy;
664
665
666 if ( !a || !b )
667 return;
668
669 xx = ADD_LONG( FT_MulFix( a->xx, b->xx ),
670 FT_MulFix( a->xy, b->yx ) );
671 xy = ADD_LONG( FT_MulFix( a->xx, b->xy ),
672 FT_MulFix( a->xy, b->yy ) );
673 yx = ADD_LONG( FT_MulFix( a->yx, b->xx ),
674 FT_MulFix( a->yy, b->yx ) );
675 yy = ADD_LONG( FT_MulFix( a->yx, b->xy ),
676 FT_MulFix( a->yy, b->yy ) );
677
678 b->xx = xx;
679 b->xy = xy;
680 b->yx = yx;
681 b->yy = yy;
682 }
#define ADD_LONG(a, b)
Definition: ftcalc.h:472
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 363 of file ftglyph.c.

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

Referenced by FT_Get_Glyph().