xref: /inferno-os/include/freetype/internal/ftgloadr.h (revision d0e1d143ef6f03c75c008c7ec648859dd260cbab)
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftgloadr.h                                                             */
4 /*                                                                         */
5 /*    The FreeType glyph loader (specification).                           */
6 /*                                                                         */
7 /*  Copyright 2002 by                                                      */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
9 /*                                                                         */
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.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17 
18 
19 #ifndef __FTGLOADR_H__
20 #define __FTGLOADR_H__
21 
22 
23 #include <ft2build.h>
24 #include FT_FREETYPE_H
25 
26 
27 FT_BEGIN_HEADER
28 
29 
30   /*************************************************************************/
31   /*                                                                       */
32   /* <Struct>                                                              */
33   /*    FT_GlyphLoader                                                     */
34   /*                                                                       */
35   /* <Description>                                                         */
36   /*    The glyph loader is an internal object used to load several glyphs */
37   /*    together (for example, in the case of composites).                 */
38   /*                                                                       */
39   /* <Note>                                                                */
40   /*    The glyph loader implementation is not part of the high-level API, */
41   /*    hence the forward structure declaration.                           */
42   /*                                                                       */
43   typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;
44 
45 
46 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
47 #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES      2
48 #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID        4
49 #define FT_SUBGLYPH_FLAG_SCALE                   8
50 #define FT_SUBGLYPH_FLAG_XY_SCALE             0x40
51 #define FT_SUBGLYPH_FLAG_2X2                  0x80
52 #define FT_SUBGLYPH_FLAG_USE_MY_METRICS      0x200
53 
54 
55   enum
56   {
57     FT_GLYPH_OWN_BITMAP = 1
58   };
59 
60 
61   typedef struct  FT_SubGlyphRec_
62   {
63     FT_Int     index;
64     FT_UShort  flags;
65     FT_Int     arg1;
66     FT_Int     arg2;
67     FT_Matrix  transform;
68 
69   } FT_SubGlyphRec;
70 
71 
72   typedef struct  FT_GlyphLoadRec_
73   {
74     FT_Outline   outline;       /* outline             */
75     FT_Vector*   extra_points;  /* extra points table  */
76     FT_UInt      num_subglyphs; /* number of subglyphs */
77     FT_SubGlyph  subglyphs;     /* subglyphs           */
78 
79   } FT_GlyphLoadRec, *FT_GlyphLoad;
80 
81 
82   typedef struct  FT_GlyphLoaderRec_
83   {
84     FT_Memory        memory;
85     FT_UInt          max_points;
86     FT_UInt          max_contours;
87     FT_UInt          max_subglyphs;
88     FT_Bool          use_extra;
89 
90     FT_GlyphLoadRec  base;
91     FT_GlyphLoadRec  current;
92 
93     void*            other;            /* for possible future extension? */
94 
95   } FT_GlyphLoaderRec;
96 
97 
98   /* create new empty glyph loader */
99   FT_BASE( FT_Error )
100   FT_GlyphLoader_New( FT_Memory        memory,
101                       FT_GlyphLoader  *aloader );
102 
103   /* add an extra points table to a glyph loader */
104   FT_BASE( FT_Error )
105   FT_GlyphLoader_CreateExtra( FT_GlyphLoader  loader );
106 
107   /* destroy a glyph loader */
108   FT_BASE( void )
109   FT_GlyphLoader_Done( FT_GlyphLoader  loader );
110 
111   /* reset a glyph loader (frees everything int it) */
112   FT_BASE( void )
113   FT_GlyphLoader_Reset( FT_GlyphLoader  loader );
114 
115   /* rewind a glyph loader */
116   FT_BASE( void )
117   FT_GlyphLoader_Rewind( FT_GlyphLoader  loader );
118 
119   /* check that there is enough room to add 'n_points' and 'n_contours' */
120   /* to the glyph loader                                                */
121   FT_BASE( FT_Error )
122   FT_GlyphLoader_CheckPoints( FT_GlyphLoader  loader,
123                               FT_UInt         n_points,
124                               FT_UInt         n_contours );
125 
126   /* check that there is enough room to add 'n_subs' sub-glyphs to */
127   /* a glyph loader                                                */
128   FT_BASE( FT_Error )
129   FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader  loader,
130                                  FT_UInt         n_subs );
131 
132   /* prepare a glyph loader, i.e. empty the current glyph */
133   FT_BASE( void )
134   FT_GlyphLoader_Prepare( FT_GlyphLoader  loader );
135 
136   /* add the current glyph to the base glyph */
137   FT_BASE( void )
138   FT_GlyphLoader_Add( FT_GlyphLoader  loader );
139 
140   /* copy points from one glyph loader to another */
141   FT_BASE( FT_Error )
142   FT_GlyphLoader_CopyPoints( FT_GlyphLoader  target,
143                              FT_GlyphLoader  source );
144 
145  /* */
146 
147 
148 FT_END_HEADER
149 
150 #endif /* __FTGLOADR_H__ */
151 
152 
153 /* END */
154