Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenafhints.h
Go to the documentation of this file.
00001 /***************************************************************************/ 00002 /* */ 00003 /* afhints.h */ 00004 /* */ 00005 /* Auto-fitter hinting routines (specification). */ 00006 /* */ 00007 /* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __AFHINTS_H__ 00020 #define __AFHINTS_H__ 00021 00022 #include "aftypes.h" 00023 00024 #define xxAF_SORT_SEGMENTS 00025 00026 FT_BEGIN_HEADER 00027 00028 /* 00029 * The definition of outline glyph hints. These are shared by all 00030 * script analysis routines (until now). 00031 */ 00032 00033 typedef enum AF_Dimension_ 00034 { 00035 AF_DIMENSION_HORZ = 0, /* x coordinates, */ 00036 /* i.e., vertical segments & edges */ 00037 AF_DIMENSION_VERT = 1, /* y coordinates, */ 00038 /* i.e., horizontal segments & edges */ 00039 00040 AF_DIMENSION_MAX /* do not remove */ 00041 00042 } AF_Dimension; 00043 00044 00045 /* hint directions -- the values are computed so that two vectors are */ 00046 /* in opposite directions iff `dir1 + dir2 == 0' */ 00047 typedef enum AF_Direction_ 00048 { 00049 AF_DIR_NONE = 4, 00050 AF_DIR_RIGHT = 1, 00051 AF_DIR_LEFT = -1, 00052 AF_DIR_UP = 2, 00053 AF_DIR_DOWN = -2 00054 00055 } AF_Direction; 00056 00057 00058 /* point hint flags */ 00059 typedef enum AF_Flags_ 00060 { 00061 AF_FLAG_NONE = 0, 00062 00063 /* point type flags */ 00064 AF_FLAG_CONIC = 1 << 0, 00065 AF_FLAG_CUBIC = 1 << 1, 00066 AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC, 00067 00068 /* point extremum flags */ 00069 AF_FLAG_EXTREMA_X = 1 << 2, 00070 AF_FLAG_EXTREMA_Y = 1 << 3, 00071 00072 /* point roundness flags */ 00073 AF_FLAG_ROUND_X = 1 << 4, 00074 AF_FLAG_ROUND_Y = 1 << 5, 00075 00076 /* point touch flags */ 00077 AF_FLAG_TOUCH_X = 1 << 6, 00078 AF_FLAG_TOUCH_Y = 1 << 7, 00079 00080 /* candidates for weak interpolation have this flag set */ 00081 AF_FLAG_WEAK_INTERPOLATION = 1 << 8, 00082 00083 /* all inflection points in the outline have this flag set */ 00084 AF_FLAG_INFLECTION = 1 << 9 00085 00086 } AF_Flags; 00087 00088 00089 /* edge hint flags */ 00090 typedef enum AF_Edge_Flags_ 00091 { 00092 AF_EDGE_NORMAL = 0, 00093 AF_EDGE_ROUND = 1 << 0, 00094 AF_EDGE_SERIF = 1 << 1, 00095 AF_EDGE_DONE = 1 << 2 00096 00097 } AF_Edge_Flags; 00098 00099 00100 typedef struct AF_PointRec_* AF_Point; 00101 typedef struct AF_SegmentRec_* AF_Segment; 00102 typedef struct AF_EdgeRec_* AF_Edge; 00103 00104 00105 typedef struct AF_PointRec_ 00106 { 00107 FT_UShort flags; /* point flags used by hinter */ 00108 FT_Char in_dir; /* direction of inwards vector */ 00109 FT_Char out_dir; /* direction of outwards vector */ 00110 00111 FT_Pos ox, oy; /* original, scaled position */ 00112 FT_Short fx, fy; /* original, unscaled position (font units) */ 00113 FT_Pos x, y; /* current position */ 00114 FT_Pos u, v; /* current (x,y) or (y,x) depending on context */ 00115 00116 AF_Point next; /* next point in contour */ 00117 AF_Point prev; /* previous point in contour */ 00118 00119 } AF_PointRec; 00120 00121 00122 typedef struct AF_SegmentRec_ 00123 { 00124 FT_Byte flags; /* edge/segment flags for this segment */ 00125 FT_Char dir; /* segment direction */ 00126 FT_Short pos; /* position of segment */ 00127 FT_Short min_coord; /* minimum coordinate of segment */ 00128 FT_Short max_coord; /* maximum coordinate of segment */ 00129 FT_Short height; /* the hinted segment height */ 00130 00131 AF_Edge edge; /* the segment's parent edge */ 00132 AF_Segment edge_next; /* link to next segment in parent edge */ 00133 00134 AF_Segment link; /* (stem) link segment */ 00135 AF_Segment serif; /* primary segment for serifs */ 00136 FT_Pos num_linked; /* number of linked segments */ 00137 FT_Pos score; /* used during stem matching */ 00138 FT_Pos len; /* used during stem matching */ 00139 00140 AF_Point first; /* first point in edge segment */ 00141 AF_Point last; /* last point in edge segment */ 00142 AF_Point* contour; /* ptr to first point of segment's contour */ 00143 00144 } AF_SegmentRec; 00145 00146 00147 typedef struct AF_EdgeRec_ 00148 { 00149 FT_Short fpos; /* original, unscaled position (font units) */ 00150 FT_Pos opos; /* original, scaled position */ 00151 FT_Pos pos; /* current position */ 00152 00153 FT_Byte flags; /* edge flags */ 00154 FT_Char dir; /* edge direction */ 00155 FT_Fixed scale; /* used to speed up interpolation between edges */ 00156 AF_Width blue_edge; /* non-NULL if this is a blue edge */ 00157 00158 AF_Edge link; 00159 AF_Edge serif; 00160 FT_Short num_linked; 00161 00162 FT_Int score; 00163 00164 AF_Segment first; 00165 AF_Segment last; 00166 00167 } AF_EdgeRec; 00168 00169 00170 typedef struct AF_AxisHintsRec_ 00171 { 00172 FT_Int num_segments; 00173 FT_Int max_segments; 00174 AF_Segment segments; 00175 #ifdef AF_SORT_SEGMENTS 00176 FT_Int mid_segments; 00177 #endif 00178 00179 FT_Int num_edges; 00180 FT_Int max_edges; 00181 AF_Edge edges; 00182 00183 AF_Direction major_dir; 00184 00185 } AF_AxisHintsRec, *AF_AxisHints; 00186 00187 00188 typedef struct AF_GlyphHintsRec_ 00189 { 00190 FT_Memory memory; 00191 00192 FT_Fixed x_scale; 00193 FT_Pos x_delta; 00194 00195 FT_Fixed y_scale; 00196 FT_Pos y_delta; 00197 00198 FT_Pos edge_distance_threshold; 00199 00200 FT_Int max_points; 00201 FT_Int num_points; 00202 AF_Point points; 00203 00204 FT_Int max_contours; 00205 FT_Int num_contours; 00206 AF_Point* contours; 00207 00208 AF_AxisHintsRec axis[AF_DIMENSION_MAX]; 00209 00210 FT_UInt32 scaler_flags; /* copy of scaler flags */ 00211 FT_UInt32 other_flags; /* free for script-specific */ 00212 /* implementations */ 00213 AF_ScriptMetrics metrics; 00214 00215 FT_Pos xmin_delta; /* used for warping */ 00216 FT_Pos xmax_delta; 00217 00218 } AF_GlyphHintsRec; 00219 00220 00221 #define AF_HINTS_TEST_SCALER( h, f ) ( (h)->scaler_flags & (f) ) 00222 #define AF_HINTS_TEST_OTHER( h, f ) ( (h)->other_flags & (f) ) 00223 00224 00225 #ifdef AF_DEBUG 00226 00227 #define AF_HINTS_DO_HORIZONTAL( h ) \ 00228 ( !_af_debug_disable_horz_hints && \ 00229 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) ) 00230 00231 #define AF_HINTS_DO_VERTICAL( h ) \ 00232 ( !_af_debug_disable_vert_hints && \ 00233 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) ) 00234 00235 #define AF_HINTS_DO_ADVANCE( h ) \ 00236 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) 00237 00238 #define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints ) 00239 00240 #else /* !AF_DEBUG */ 00241 00242 #define AF_HINTS_DO_HORIZONTAL( h ) \ 00243 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) 00244 00245 #define AF_HINTS_DO_VERTICAL( h ) \ 00246 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) 00247 00248 #define AF_HINTS_DO_ADVANCE( h ) \ 00249 !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) 00250 00251 #define AF_HINTS_DO_BLUES( h ) 1 00252 00253 #endif /* !AF_DEBUG */ 00254 00255 00256 FT_LOCAL( AF_Direction ) 00257 af_direction_compute( FT_Pos dx, 00258 FT_Pos dy ); 00259 00260 00261 FT_LOCAL( FT_Error ) 00262 af_axis_hints_new_segment( AF_AxisHints axis, 00263 FT_Memory memory, 00264 AF_Segment *asegment ); 00265 00266 FT_LOCAL( FT_Error) 00267 af_axis_hints_new_edge( AF_AxisHints axis, 00268 FT_Int fpos, 00269 AF_Direction dir, 00270 FT_Memory memory, 00271 AF_Edge *edge ); 00272 00273 FT_LOCAL( void ) 00274 af_glyph_hints_init( AF_GlyphHints hints, 00275 FT_Memory memory ); 00276 00277 00278 00279 /* 00280 * recompute all AF_Point in a AF_GlyphHints from the definitions 00281 * in a source outline 00282 */ 00283 FT_LOCAL( void ) 00284 af_glyph_hints_rescale( AF_GlyphHints hints, 00285 AF_ScriptMetrics metrics ); 00286 00287 FT_LOCAL( FT_Error ) 00288 af_glyph_hints_reload( AF_GlyphHints hints, 00289 FT_Outline* outline ); 00290 00291 FT_LOCAL( void ) 00292 af_glyph_hints_save( AF_GlyphHints hints, 00293 FT_Outline* outline ); 00294 00295 FT_LOCAL( void ) 00296 af_glyph_hints_align_edge_points( AF_GlyphHints hints, 00297 AF_Dimension dim ); 00298 00299 FT_LOCAL( void ) 00300 af_glyph_hints_align_strong_points( AF_GlyphHints hints, 00301 AF_Dimension dim ); 00302 00303 FT_LOCAL( void ) 00304 af_glyph_hints_align_weak_points( AF_GlyphHints hints, 00305 AF_Dimension dim ); 00306 00307 #ifdef AF_USE_WARPER 00308 FT_LOCAL( void ) 00309 af_glyph_hints_scale_dim( AF_GlyphHints hints, 00310 AF_Dimension dim, 00311 FT_Fixed scale, 00312 FT_Pos delta ); 00313 #endif 00314 00315 FT_LOCAL( void ) 00316 af_glyph_hints_done( AF_GlyphHints hints ); 00317 00318 /* */ 00319 00320 #define AF_SEGMENT_LEN( seg ) ( (seg)->max_coord - (seg)->min_coord ) 00321 00322 #define AF_SEGMENT_DIST( seg1, seg2 ) ( ( (seg1)->pos > (seg2)->pos ) \ 00323 ? (seg1)->pos - (seg2)->pos \ 00324 : (seg2)->pos - (seg1)->pos ) 00325 00326 00327 FT_END_HEADER 00328 00329 #endif /* __AFHINTS_H__ */ 00330 00331 00332 /* END */ Generated on Fri May 25 2012 04:32:07 for ReactOS by
1.7.6.1
|