1 /****************************************************************************
5 * The FreeType glyph loader (specification).
7 * Copyright (C) 2002-2023 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
23 #include <freetype/freetype.h>
25 #include "compiler-macros.h"
30 /**************************************************************************
36 * The glyph loader is an internal object used to load several glyphs
37 * together (for example, in the case of composites).
39 typedef struct FT_SubGlyphRec_
50 typedef struct FT_GlyphLoadRec_
52 FT_Outline outline; /* outline */
53 FT_Vector* extra_points; /* extra points table */
54 FT_Vector* extra_points2; /* second extra points table */
55 FT_UInt num_subglyphs; /* number of subglyphs */
56 FT_SubGlyph subglyphs; /* subglyphs */
58 } FT_GlyphLoadRec, *FT_GlyphLoad;
61 typedef struct FT_GlyphLoaderRec_
66 FT_UInt max_subglyphs;
70 FT_GlyphLoadRec current;
72 void* other; /* for possible future extension? */
74 } FT_GlyphLoaderRec, *FT_GlyphLoader;
77 /* create new empty glyph loader */
79 FT_GlyphLoader_New( FT_Memory memory,
80 FT_GlyphLoader *aloader );
82 /* add an extra points table to a glyph loader */
84 FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
86 /* destroy a glyph loader */
88 FT_GlyphLoader_Done( FT_GlyphLoader loader );
90 /* reset a glyph loader (frees everything int it) */
92 FT_GlyphLoader_Reset( FT_GlyphLoader loader );
94 /* rewind a glyph loader */
96 FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
98 /* check that there is enough space to add `n_points' and `n_contours' */
99 /* to the glyph loader */
101 FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
103 FT_UInt n_contours );
106 #define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \
108 ( (FT_UInt)(_loader)->base.outline.n_points + \
109 (FT_UInt)(_loader)->current.outline.n_points + \
110 (FT_UInt)(_count) ) <= (_loader)->max_points )
112 #define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \
114 ( (FT_UInt)(_loader)->base.outline.n_contours + \
115 (FT_UInt)(_loader)->current.outline.n_contours + \
116 (FT_UInt)(_count) ) <= (_loader)->max_contours )
118 #define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points, _contours ) \
119 ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \
120 FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \
122 : FT_GlyphLoader_CheckPoints( (_loader), \
123 (FT_UInt)(_points), \
124 (FT_UInt)(_contours) ) )
127 /* check that there is enough space to add `n_subs' sub-glyphs to */
130 FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
133 /* prepare a glyph loader, i.e. empty the current glyph */
135 FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
137 /* add the current glyph to the base glyph */
139 FT_GlyphLoader_Add( FT_GlyphLoader loader );
144 #endif /* FTGLOADR_H_ */