Add code to build a `gasp' table.
[ttfautohint.git] / src / tagloadr.h
bloba8f9f90523c5621b2f9d1be899a4dc11d045c941
1 /* tagloadr.h */
3 /* originally file `ftgloadr.h' (2011-Mar-28) from FreeType */
5 /* heavily modified 2011 by Werner Lemberg <wl@gnu.org> */
7 #ifndef __TAGLOADR_H__
8 #define __TAGLOADR_H__
10 #include <ft2build.h>
11 #include FT_FREETYPE_H
14 typedef struct TA_SubGlyphRec_
16 FT_Int index;
17 FT_UShort flags;
19 FT_Int arg1;
20 FT_Int arg2;
22 FT_Matrix transform;
23 } TA_SubGlyphRec, *TA_SubGlyph;
26 typedef struct TA_GlyphLoadRec_
28 FT_Outline outline; /* outline */
30 FT_Vector* extra_points; /* extra points table */
31 FT_Vector* extra_points2; /* second extra points table */
33 FT_UInt num_subglyphs; /* number of subglyphs */
34 TA_SubGlyph subglyphs; /* subglyphs */
35 } TA_GlyphLoadRec, *TA_GlyphLoad;
38 typedef struct TA_GlyphLoaderRec_
40 FT_UInt max_points;
41 FT_UInt max_contours;
42 FT_UInt max_subglyphs;
43 FT_Bool use_extra;
45 TA_GlyphLoadRec base;
46 TA_GlyphLoadRec current;
47 } TA_GlyphLoaderRec, *TA_GlyphLoader;
50 /* create new empty glyph loader */
51 FT_Error
52 TA_GlyphLoader_New(TA_GlyphLoader *aloader);
54 /* add an extra points table to a glyph loader */
55 FT_Error
56 TA_GlyphLoader_CreateExtra(TA_GlyphLoader loader);
58 /* destroy a glyph loader */
59 void
60 TA_GlyphLoader_Done(TA_GlyphLoader loader);
62 /* reset a glyph loader (frees everything int it) */
63 void
64 TA_GlyphLoader_Reset(TA_GlyphLoader loader);
66 /* rewind a glyph loader */
67 void
68 TA_GlyphLoader_Rewind(TA_GlyphLoader loader);
70 /* check that there is enough space to add */
71 /* `n_points' and `n_contours' to the glyph loader */
72 FT_Error
73 TA_GlyphLoader_CheckPoints(TA_GlyphLoader loader,
74 FT_UInt n_points,
75 FT_UInt n_contours);
78 #define TA_GLYPHLOADER_CHECK_P(_loader, _count) \
79 ((_count) == 0 || ((_loader)->base.outline.n_points \
80 + (_loader)->current.outline.n_points \
81 + (unsigned long)(_count)) <= (_loader)->max_points)
83 #define TA_GLYPHLOADER_CHECK_C(_loader, _count) \
84 ((_count) == 0 || ((_loader)->base.outline.n_contours \
85 + (_loader)->current.outline.n_contours \
86 + (unsigned long)(_count)) <= (_loader)->max_contours)
88 #define TA_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours) \
89 ((TA_GLYPHLOADER_CHECK_P(_loader, _points) \
90 && TA_GLYPHLOADER_CHECK_C(_loader, _contours)) \
91 ? 0 \
92 : TA_GlyphLoader_CheckPoints((_loader), (_points), (_contours)))
95 /* check that there is enough space to add */
96 /* `n_subs' sub-glyphs to a glyph loader */
97 FT_Error
98 TA_GlyphLoader_CheckSubGlyphs(TA_GlyphLoader loader,
99 FT_UInt n_subs);
101 /* prepare a glyph loader, i.e. empty the current glyph */
102 void
103 TA_GlyphLoader_Prepare(TA_GlyphLoader loader);
105 /* add the current glyph to the base glyph */
106 void
107 TA_GlyphLoader_Add(TA_GlyphLoader loader);
109 /* copy points from one glyph loader to another */
110 FT_Error
111 TA_GlyphLoader_CopyPoints(TA_GlyphLoader target,
112 TA_GlyphLoader source);
114 #endif /* __TAGLOADR_H__ */
116 /* end of tagloadr.h */