4 * Copyright (C) 2011-2015 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
16 /* originally file `ftgloadr.h' (2011-Mar-28) from FreeType */
18 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
20 #ifndef __TAGLOADR_H__
21 #define __TAGLOADR_H__
24 #include FT_FREETYPE_H
31 typedef struct TA_SubGlyphRec_
40 } TA_SubGlyphRec
, *TA_SubGlyph
;
43 typedef struct TA_GlyphLoadRec_
45 FT_Outline outline
; /* outline */
47 FT_Vector
* extra_points
; /* extra points table */
48 FT_Vector
* extra_points2
; /* second extra points table */
50 FT_UInt num_subglyphs
; /* number of subglyphs */
51 TA_SubGlyph subglyphs
; /* subglyphs */
52 } TA_GlyphLoadRec
, *TA_GlyphLoad
;
55 typedef struct TA_GlyphLoaderRec_
59 FT_UInt max_subglyphs
;
63 TA_GlyphLoadRec current
;
64 } TA_GlyphLoaderRec
, *TA_GlyphLoader
;
67 /* create new empty glyph loader */
69 TA_GlyphLoader_New(TA_GlyphLoader
*aloader
);
71 /* add an extra points table to a glyph loader */
73 TA_GlyphLoader_CreateExtra(TA_GlyphLoader loader
);
75 /* destroy a glyph loader */
77 TA_GlyphLoader_Done(TA_GlyphLoader loader
);
79 /* reset a glyph loader (frees everything int it) */
81 TA_GlyphLoader_Reset(TA_GlyphLoader loader
);
83 /* rewind a glyph loader */
85 TA_GlyphLoader_Rewind(TA_GlyphLoader loader
);
87 /* check that there is enough space to add */
88 /* `n_points' and `n_contours' to the glyph loader */
90 TA_GlyphLoader_CheckPoints(TA_GlyphLoader loader
,
95 #define TA_GLYPHLOADER_CHECK_P(_loader, _count) \
96 ((_count) == 0 || ((_loader)->base.outline.n_points \
97 + (_loader)->current.outline.n_points \
98 + (unsigned long)(_count)) <= (_loader)->max_points)
100 #define TA_GLYPHLOADER_CHECK_C(_loader, _count) \
101 ((_count) == 0 || ((_loader)->base.outline.n_contours \
102 + (_loader)->current.outline.n_contours \
103 + (unsigned long)(_count)) <= (_loader)->max_contours)
105 #define TA_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours) \
106 ((TA_GLYPHLOADER_CHECK_P(_loader, _points) \
107 && TA_GLYPHLOADER_CHECK_C(_loader, _contours)) \
109 : TA_GlyphLoader_CheckPoints((_loader), (_points), (_contours)))
112 /* check that there is enough space to add */
113 /* `n_subs' sub-glyphs to a glyph loader */
115 TA_GlyphLoader_CheckSubGlyphs(TA_GlyphLoader loader
,
118 /* prepare a glyph loader, i.e. empty the current glyph */
120 TA_GlyphLoader_Prepare(TA_GlyphLoader loader
);
122 /* add the current glyph to the base glyph */
124 TA_GlyphLoader_Add(TA_GlyphLoader loader
);
126 /* copy points from one glyph loader to another */
128 TA_GlyphLoader_CopyPoints(TA_GlyphLoader target
,
129 TA_GlyphLoader source
);
135 #endif /* __TAGLOADR_H__ */
137 /* end of tagloadr.h */