• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ttgxvar.h                                                              */
4 /*                                                                         */
5 /*    TrueType GX Font Variation loader (specification)                    */
6 /*                                                                         */
7 /*  Copyright 2004 by                                                      */
8 /*  David Turner, Robert Wilhelm, Werner Lemberg and George Williams.      */
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 __TTGXVAR_H__
20 #define __TTGXVAR_H__
21 
22 
23 #include <ft2build.h>
24 #include "ttobjs.h"
25 
26 
27 FT_BEGIN_HEADER
28 
29 
30   /*************************************************************************/
31   /*                                                                       */
32   /* <Struct>                                                              */
33   /*    GX_AVarCorrespondenceRec                                           */
34   /*                                                                       */
35   /* <Description>                                                         */
36   /*    A data structure representing `shortFracCorrespondence' in `avar'  */
37   /*    table according to the specifications from Apple.                  */
38   /*                                                                       */
39   typedef struct  GX_AVarCorrespondenceRec_
40   {
41     FT_Fixed  fromCoord;
42     FT_Fixed  toCoord;
43 
44   } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence;
45 
46 
47   /*************************************************************************/
48   /*                                                                       */
49   /* <Struct>                                                              */
50   /*    GX_AVarRec                                                         */
51   /*                                                                       */
52   /* <Description>                                                         */
53   /*    Data from the segment field of `avar' table.                       */
54   /*    There is one of these for each axis.                               */
55   /*                                                                       */
56   typedef struct  GX_AVarSegmentRec_
57   {
58     FT_UShort              pairCount;
59     GX_AVarCorrespondence  correspondence; /* array with pairCount entries */
60 
61   } GX_AVarSegmentRec, *GX_AVarSegment;
62 
63 
64   /*************************************************************************/
65   /*                                                                       */
66   /* <Struct>                                                              */
67   /*    GX_BlendRec                                                        */
68   /*                                                                       */
69   /* <Description>                                                         */
70   /*    Data for interpolating a font from a distortable font specified    */
71   /*    by the GX *var tables ([fgca]var).                                 */
72   /*                                                                       */
73   /* <Fields>                                                              */
74   /*    num_axis         :: The number of axes along which interpolation   */
75   /*                         may happen                                    */
76   /*                                                                       */
77   /*    normalizedcoords :: A normalized value (between [-1,1]) indicating */
78   /*                        the contribution along each axis to the final  */
79   /*                        interpolated font.                             */
80   /*                                                                       */
81   typedef struct  GX_BlendRec_
82   {
83     FT_UInt         num_axis;
84     FT_Fixed*       normalizedcoords;
85 
86     FT_MM_Var*      mmvar;
87     FT_Int          mmvar_len;
88 
89     FT_Bool         avar_checked;
90     GX_AVarSegment  avar_segment;
91 
92     FT_UInt         tuplecount;      /* shared tuples in `gvar'           */
93     FT_Fixed*       tuplecoords;     /* tuplecoords[tuplecount][num_axis] */
94 
95     FT_UInt         gv_glyphcnt;
96     FT_ULong*       glyphoffsets;
97 
98   } GX_BlendRec;
99 
100 
101   /*************************************************************************/
102   /*                                                                       */
103   /* <enum>                                                                */
104   /*    GX_TupleCountFlags                                                 */
105   /*                                                                       */
106   /* <Description>                                                         */
107   /*    Flags used within the `TupleCount' field of the `gvar' table.      */
108   /*                                                                       */
109   typedef enum  GX_TupleCountFlags_
110   {
111     GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000,
112     GX_TC_RESERVED_TUPLE_FLAGS       = 0x7000,
113     GX_TC_TUPLE_COUNT_MASK           = 0x0FFF
114 
115   } GX_TupleCountFlags;
116 
117 
118   /*************************************************************************/
119   /*                                                                       */
120   /* <enum>                                                                */
121   /*    GX_TupleIndexFlags                                                 */
122   /*                                                                       */
123   /* <Description>                                                         */
124   /*    Flags used within the `TupleIndex' field of the `gvar' and `cvar'  */
125   /*    tables.                                                            */
126   /*                                                                       */
127   typedef enum  GX_TupleIndexFlags_
128   {
129     GX_TI_EMBEDDED_TUPLE_COORD  = 0x8000,
130     GX_TI_INTERMEDIATE_TUPLE    = 0x4000,
131     GX_TI_PRIVATE_POINT_NUMBERS = 0x2000,
132     GX_TI_RESERVED_TUPLE_FLAG   = 0x1000,
133     GX_TI_TUPLE_INDEX_MASK      = 0x0FFF
134 
135   } GX_TupleIndexFlags;
136 
137 
138 #define TTAG_wght  FT_MAKE_TAG( 'w', 'g', 'h', 't' )
139 #define TTAG_wdth  FT_MAKE_TAG( 'w', 'd', 't', 'h' )
140 #define TTAG_opsz  FT_MAKE_TAG( 'o', 'p', 's', 'z' )
141 #define TTAG_slnt  FT_MAKE_TAG( 's', 'l', 'n', 't' )
142 
143 
144   FT_LOCAL( FT_Error )
145   TT_Set_MM_Blend( TT_Face    face,
146                    FT_UInt    num_coords,
147                    FT_Fixed*  coords );
148 
149   FT_LOCAL( FT_Error )
150   TT_Set_Var_Design( TT_Face    face,
151                      FT_UInt    num_coords,
152                      FT_Fixed*  coords );
153 
154   FT_LOCAL( FT_Error )
155   TT_Get_MM_Var( TT_Face      face,
156                  FT_MM_Var*  *master );
157 
158 
159   FT_LOCAL( FT_Error )
160   tt_face_vary_cvt( TT_Face    face,
161                     FT_Stream  stream );
162 
163 
164   FT_LOCAL( FT_Error )
165   TT_Vary_Get_Glyph_Deltas( TT_Face      face,
166                             FT_UInt      glyph_index,
167                             FT_Vector*  *deltas,
168                             FT_UInt      n_points );
169 
170 
171   FT_LOCAL( void )
172   tt_done_blend( FT_Memory  memory,
173                  GX_Blend   blend );
174 
175 
176 FT_END_HEADER
177 
178 
179 #endif /* __TTGXVAR_H__ */
180 
181 
182 /* END */
183