ReactOS 0.4.15-dev-7934-g1dc8d80
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_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 338 of file ftglyph.h.

◆ ft_glyph_bbox_pixels

#define ft_glyph_bbox_pixels   FT_GLYPH_BBOX_PIXELS

Definition at line 340 of file ftglyph.h.

◆ ft_glyph_bbox_subpixels

#define ft_glyph_bbox_subpixels   FT_GLYPH_BBOX_SUBPIXELS

Definition at line 337 of file ftglyph.h.

◆ ft_glyph_bbox_truncate

#define ft_glyph_bbox_truncate   FT_GLYPH_BBOX_TRUNCATE

Definition at line 339 of file ftglyph.h.

◆ ft_glyph_bbox_unscaled

#define ft_glyph_bbox_unscaled   FT_GLYPH_BBOX_UNSCALED

Definition at line 336 of file ftglyph.h.

Typedef Documentation

◆ FT_BitmapGlyph

Definition at line 127 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 179 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 323 of file ftglyph.h.

324 {
330
@ FT_GLYPH_BBOX_UNSCALED
Definition: ftglyph.h:325
@ FT_GLYPH_BBOX_GRIDFIT
Definition: ftglyph.h:327
@ FT_GLYPH_BBOX_PIXELS
Definition: ftglyph.h:329
@ FT_GLYPH_BBOX_SUBPIXELS
Definition: ftglyph.h:326
@ FT_GLYPH_BBOX_TRUNCATE
Definition: ftglyph.h:328
enum FT_Glyph_BBox_Mode_ FT_Glyph_BBox_Mode

Function Documentation

◆ FT_Done_Glyph()

FT_Done_Glyph ( FT_Glyph  glyph)

Definition at line 633 of file ftglyph.c.

634 {
635 if ( glyph )
636 {
637 FT_Memory memory = glyph->library->memory;
638 const FT_Glyph_Class* clazz = glyph->clazz;
639
640
641 if ( clazz->glyph_done )
642 clazz->glyph_done( glyph );
643
644 FT_FREE( glyph );
645 }
646 }
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
Definition: ftglyph.h:69
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
static char memory[1024 *256]
Definition: process.c:116
FT_Library library
Definition: ftglyph.h:110
const FT_Glyph_Class * clazz
Definition: ftglyph.h:111
FT_Memory memory
Definition: ftobjs.h:918

Referenced by FT_Get_Glyph(), FT_Glyph_Copy(), FT_Glyph_Stroke(), FT_Glyph_StrokeBorder(), FT_Glyph_To_Bitmap(), ftc_inode_free(), IntExtTextOutW(), IntGetBitmapGlyphNoCache(), IntGetBitmapGlyphWithCache(), IntGetTextDisposition(), RemoveCachedEntry(), and TextIntGetTextExtentPoint().

◆ FT_Get_Glyph()

FT_Get_Glyph ( FT_GlyphSlot  slot,
FT_Glyph aglyph 
)

Definition at line 363 of file ftglyph.c.

365 {
368 FT_Glyph glyph;
369
370 const FT_Glyph_Class* clazz = NULL;
371
372
373 if ( !slot )
374 return FT_THROW( Invalid_Slot_Handle );
375
376 library = slot->library;
377
378 if ( !aglyph )
379 return FT_THROW( Invalid_Argument );
380
381 /* if it is a bitmap, that's easy :-) */
382 if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
384
385 /* if it is an outline */
386 else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
388
389 else
390 {
391 /* try to find a renderer that supports the glyph image format */
393
394
395 if ( render )
396 clazz = &render->glyph_class;
397 }
398
399 if ( !clazz )
400 {
401 error = FT_THROW( Invalid_Glyph_Format );
402 goto Exit;
403 }
404
405 /* create FT_Glyph object */
406 error = ft_new_glyph( library, clazz, &glyph );
407 if ( error )
408 goto Exit;
409
410 /* copy advance while converting 26.6 to 16.16 format */
411 if ( slot->advance.x >= 0x8000L * 64 ||
412 slot->advance.x <= -0x8000L * 64 )
413 {
414 FT_ERROR(( "FT_Get_Glyph: advance width too large\n" ));
415 error = FT_THROW( Invalid_Argument );
416 goto Exit2;
417 }
418 if ( slot->advance.y >= 0x8000L * 64 ||
419 slot->advance.y <= -0x8000L * 64 )
420 {
421 FT_ERROR(( "FT_Get_Glyph: advance height too large\n" ));
422 error = FT_THROW( Invalid_Argument );
423 goto Exit2;
424 }
425
426 glyph->advance.x = slot->advance.x * 1024;
427 glyph->advance.y = slot->advance.y * 1024;
428
429 /* now import the image from the glyph slot */
430 error = clazz->glyph_init( glyph, slot );
431
432 Exit2:
433 /* if an error occurred, destroy the glyph */
434 if ( error )
435 FT_Done_Glyph( glyph );
436 else
437 *aglyph = glyph;
438
439 Exit:
440 return error;
441 }
#define FT_BITMAP_GLYPH_CLASS_GET
Definition: basepic.h:29
#define FT_OUTLINE_GLYPH_CLASS_GET
Definition: basepic.h:28
FT_Library library
Definition: cffdrivr.c:654
#define NULL
Definition: types.h:112
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
FT_Lookup_Renderer(FT_Library library, FT_Glyph_Format format, FT_ListNode *node)
Definition: ftobjs.c:4264
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:426
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
static void render(void)
Definition: ssstars.c:272
FT_Vector advance
Definition: ftglyph.h:113
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
Definition: vfat.h:185

Referenced by ftc_basic_family_load_glyph(), IntGetBitmapGlyphNoCache(), 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
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 480 of file ftglyph.c.

483 {
484 const FT_Glyph_Class* clazz;
485
486
487 if ( !acbox )
488 return;
489
490 acbox->xMin = acbox->yMin = acbox->xMax = acbox->yMax = 0;
491
492 if ( !glyph || !glyph->clazz )
493 return;
494
495 clazz = glyph->clazz;
496 if ( !clazz->glyph_bbox )
497 return;
498
499 /* retrieve bbox in 26.6 coordinates */
500 clazz->glyph_bbox( glyph, acbox );
501
502 /* perform grid fitting if needed */
503 if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
504 bbox_mode == FT_GLYPH_BBOX_PIXELS )
505 {
506 acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
507 acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
508 acbox->xMax = FT_PIX_CEIL( acbox->xMax );
509 acbox->yMax = FT_PIX_CEIL( acbox->yMax );
510 }
511
512 /* convert to integer pixels if needed */
513 if ( bbox_mode == FT_GLYPH_BBOX_TRUNCATE ||
514 bbox_mode == FT_GLYPH_BBOX_PIXELS )
515 {
516 acbox->xMin >>= 6;
517 acbox->yMin >>= 6;
518 acbox->xMax >>= 6;
519 acbox->yMax >>= 6;
520 }
521 }
#define FT_PIX_CEIL(x)
Definition: ftobjs.h:94
#define FT_PIX_FLOOR(x)
Definition: ftobjs.h:92
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118

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

531 {
533 FT_GlyphSlot_InternalRec dummy_internal;
535 FT_Glyph b, glyph;
537 const FT_Glyph_Class* clazz;
538
539 /* FT_BITMAP_GLYPH_CLASS_GET dereferences `library' in PIC mode */
541
542
543 /* check argument */
544 if ( !the_glyph )
545 goto Bad;
546 glyph = *the_glyph;
547 if ( !glyph )
548 goto Bad;
549
550 clazz = glyph->clazz;
551 library = glyph->library;
552 if ( !library || !clazz )
553 goto Bad;
554
555 /* when called with a bitmap glyph, do nothing and return successfully */
556 if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
557 goto Exit;
558
559 if ( !clazz->glyph_prepare )
560 goto Bad;
561
562 /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
563 /* then calling FT_Render_Glyph_Internal() */
564
565 FT_ZERO( &dummy );
566 FT_ZERO( &dummy_internal );
567 dummy.internal = &dummy_internal;
568 dummy.library = library;
569 dummy.format = clazz->glyph_format;
570
571 /* create result bitmap glyph */
572 error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b );
573 if ( error )
574 goto Exit;
576
577#if 1
578 /* if `origin' is set, translate the glyph image */
579 if ( origin )
580 FT_Glyph_Transform( glyph, 0, origin );
581#else
582 FT_UNUSED( origin );
583#endif
584
585 /* prepare dummy slot for rendering */
586 error = clazz->glyph_prepare( glyph, &dummy );
587 if ( !error )
588 error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
589
590#if 1
591 if ( !destroy && origin )
592 {
593 FT_Vector v;
594
595
596 v.x = -origin->x;
597 v.y = -origin->y;
598 FT_Glyph_Transform( glyph, 0, &v );
599 }
600#endif
601
602 if ( error )
603 goto Exit;
604
605 /* in case of success, copy the bitmap to the glyph bitmap */
607 if ( error )
608 goto Exit;
609
610 /* copy advance */
611 bitmap->root.advance = glyph->advance;
612
613 if ( destroy )
614 FT_Done_Glyph( glyph );
615
616 *the_glyph = FT_GLYPH( bitmap );
617
618 Exit:
619 if ( error && bitmap )
621
622 return error;
623
624 Bad:
625 error = FT_THROW( Invalid_Argument );
626 goto Exit;
627 }
void destroy(_Tp *__pointer)
Definition: _construct.h:278
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
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:447
struct FT_BitmapGlyphRec_ * FT_BitmapGlyph
Definition: ftglyph.h:127
#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:4485
#define FT_GLYPH(x)
Definition: ftobjs.h:766
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 IntGetBitmapGlyphNoCache(), and IntGetBitmapGlyphWithCache().

◆ FT_Glyph_Transform()

FT_Glyph_Transform ( FT_Glyph  glyph,
FT_Matrix matrix,
FT_Vector delta 
)

Definition at line 447 of file ftglyph.c.

450 {
452
453
454 if ( !glyph || !glyph->clazz )
455 error = FT_THROW( Invalid_Argument );
456 else
457 {
458 const FT_Glyph_Class* clazz = glyph->clazz;
459
460
461 if ( clazz->glyph_transform )
462 {
463 /* transform glyph image */
464 clazz->glyph_transform( glyph, matrix, delta );
465
466 /* transform advance vector */
467 if ( matrix )
469 }
470 else
471 error = FT_THROW( Invalid_Glyph_Format );
472 }
473 return error;
474 }
FT_Vector_Transform(FT_Vector *vec, const FT_Matrix *matrix)
Definition: ftoutln.c:688
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:420
signed long FT_Fixed
Definition: fttypes.h:288
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by ftGdiGetGlyphOutline(), and IntExtTextOutW().