Minor
[ttfautohint.git] / lib / tagloadr.h
blob5e6c0ac92cd19481ddd76501b1e37ba6b490051f
1 /* tagloadr.h */
3 /*
4 * Copyright (C) 2011-2013 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__
23 #include <ft2build.h>
24 #include FT_FREETYPE_H
27 typedef struct TA_SubGlyphRec_
29 FT_Int index;
30 FT_UShort flags;
32 FT_Int arg1;
33 FT_Int arg2;
35 FT_Matrix transform;
36 } TA_SubGlyphRec, *TA_SubGlyph;
39 typedef struct TA_GlyphLoadRec_
41 FT_Outline outline; /* outline */
43 FT_Vector* extra_points; /* extra points table */
44 FT_Vector* extra_points2; /* second extra points table */
46 FT_UInt num_subglyphs; /* number of subglyphs */
47 TA_SubGlyph subglyphs; /* subglyphs */
48 } TA_GlyphLoadRec, *TA_GlyphLoad;
51 typedef struct TA_GlyphLoaderRec_
53 FT_UInt max_points;
54 FT_UInt max_contours;
55 FT_UInt max_subglyphs;
56 FT_Bool use_extra;
58 TA_GlyphLoadRec base;
59 TA_GlyphLoadRec current;
60 } TA_GlyphLoaderRec, *TA_GlyphLoader;
63 /* create new empty glyph loader */
64 FT_Error
65 TA_GlyphLoader_New(TA_GlyphLoader *aloader);
67 /* add an extra points table to a glyph loader */
68 FT_Error
69 TA_GlyphLoader_CreateExtra(TA_GlyphLoader loader);
71 /* destroy a glyph loader */
72 void
73 TA_GlyphLoader_Done(TA_GlyphLoader loader);
75 /* reset a glyph loader (frees everything int it) */
76 void
77 TA_GlyphLoader_Reset(TA_GlyphLoader loader);
79 /* rewind a glyph loader */
80 void
81 TA_GlyphLoader_Rewind(TA_GlyphLoader loader);
83 /* check that there is enough space to add */
84 /* `n_points' and `n_contours' to the glyph loader */
85 FT_Error
86 TA_GlyphLoader_CheckPoints(TA_GlyphLoader loader,
87 FT_UInt n_points,
88 FT_UInt n_contours);
91 #define TA_GLYPHLOADER_CHECK_P(_loader, _count) \
92 ((_count) == 0 || ((_loader)->base.outline.n_points \
93 + (_loader)->current.outline.n_points \
94 + (unsigned long)(_count)) <= (_loader)->max_points)
96 #define TA_GLYPHLOADER_CHECK_C(_loader, _count) \
97 ((_count) == 0 || ((_loader)->base.outline.n_contours \
98 + (_loader)->current.outline.n_contours \
99 + (unsigned long)(_count)) <= (_loader)->max_contours)
101 #define TA_GLYPHLOADER_CHECK_POINTS(_loader, _points, _contours) \
102 ((TA_GLYPHLOADER_CHECK_P(_loader, _points) \
103 && TA_GLYPHLOADER_CHECK_C(_loader, _contours)) \
104 ? 0 \
105 : TA_GlyphLoader_CheckPoints((_loader), (_points), (_contours)))
108 /* check that there is enough space to add */
109 /* `n_subs' sub-glyphs to a glyph loader */
110 FT_Error
111 TA_GlyphLoader_CheckSubGlyphs(TA_GlyphLoader loader,
112 FT_UInt n_subs);
114 /* prepare a glyph loader, i.e. empty the current glyph */
115 void
116 TA_GlyphLoader_Prepare(TA_GlyphLoader loader);
118 /* add the current glyph to the base glyph */
119 void
120 TA_GlyphLoader_Add(TA_GlyphLoader loader);
122 /* copy points from one glyph loader to another */
123 FT_Error
124 TA_GlyphLoader_CopyPoints(TA_GlyphLoader target,
125 TA_GlyphLoader source);
127 #endif /* __TAGLOADR_H__ */
129 /* end of tagloadr.h */