a few updates used to debug the auto-hinter as well as try to improve it significantly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c
index 97ac862..16af545 100644
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -752,7 +752,6 @@
if ( point == last )
break;
}
-
}
last = point;
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index 12f43fd..63a5d34 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1296,6 +1296,10 @@
slot->format = ft_glyph_format_outline;
}
+#ifdef DEBUG_HINTER
+ ah_debug_hinter = hinter;
+#endif
+
Exit:
return error;
}
diff --git a/src/autohint/ahmodule.c b/src/autohint/ahmodule.c
index 6b6969a..c506bf8 100644
--- a/src/autohint/ahmodule.c
+++ b/src/autohint/ahmodule.c
@@ -24,6 +24,10 @@
#include "ahhint.h"
+#ifdef DEBUG_HINTER
+ extern AH_Hinter* ah_debug_hinter = NULL;
+#endif
+
typedef struct FT_AutoHinterRec_
{
FT_ModuleRec root;
@@ -35,7 +39,14 @@
FT_CALLBACK_DEF( FT_Error )
ft_autohinter_init( FT_AutoHinter module )
{
- return ah_hinter_new( module->root.library, &module->hinter );
+ FT_Error error;
+
+ error = ah_hinter_new( module->root.library, &module->hinter );
+#ifdef DEBUG_HINTER
+ if ( !error )
+ ah_debug_hinter = module->hinter;
+#endif
+ return error;
}
@@ -43,6 +54,10 @@
ft_autohinter_done( FT_AutoHinter module )
{
ah_hinter_done( module->hinter );
+
+#ifdef DEBUG_HINTER
+ ah_debug_hinter = NULL;
+#endif
}
diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h
index 2b7b4f0..941563b 100644
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -26,7 +26,12 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
+
+#ifdef DEBUG_HINTER
+#include <../src/autohint/ahloader.h>
+#else
#include "ahloader.h"
+#endif
#define xxAH_DEBUG
@@ -186,7 +191,7 @@ FT_BEGIN_HEADER
/* */
/* fx, fy :: The current coordinates in font units. */
/* */
- /* x, y :: The current hinter coordinates. */
+ /* x, y :: The current hinted coordinates. */
/* */
/* u, v :: Point coordinates -- meaning varies with context. */
/* */
@@ -485,6 +490,10 @@ FT_BEGIN_HEADER
} AH_Hinter;
+#ifdef DEBUG_HINTER
+ extern AH_Hinter* ah_debug_hinter;
+#endif /* DEBUG_HINTER */
+
FT_END_HEADER
#endif /* __AHTYPES_H__ */
diff --git a/src/pshinter/pshalgo2.c b/src/pshinter/pshalgo2.c
index 135e4f7..4eb8978 100644
--- a/src/pshinter/pshalgo2.c
+++ b/src/pshinter/pshalgo2.c
@@ -460,6 +460,10 @@
FT_UInt count;
#ifdef DEBUG_HINTER
+ PSH_Dimension dim = &globals->dimension[vertical];
+ FT_Fixed scale = dim->scale_mult;
+ FT_Fixed delta = dim->scale_delta;
+
if ( ps_debug_no_vert_hints && vertical )
{
ps_simple_scale( table, scale, delta, vertical );
diff --git a/tests/Jamfile b/tests/Jamfile
index 06625a9..23f4b40 100644
--- a/tests/Jamfile
+++ b/tests/Jamfile
@@ -2,9 +2,9 @@ SubDir FT2_TOP tests ;
test_programs = gview ;
-SubDirHdrs [ FT2_SubDir .. .. nirvana include ] ;
+SubDirHdrs [ FT2_SubDir .. nirvana include ] ;
-NV_TOP = [ FT2_SubDir .. .. .. nirvana ] ;
+NV_TOP = [ FT2_SubDir .. .. nirvana ] ;
NIRVANA_LINKLIBS = $(NV_TOP)\\objs\\nirvana$(SUFLIB) ;
diff --git a/tests/gview.c b/tests/gview.c
index 35d2369..d1cddcf 100644
--- a/tests/gview.c
+++ b/tests/gview.c
@@ -10,6 +10,8 @@
#include <../src/pshinter/pshalgo1.h>
#include <../src/pshinter/pshalgo2.h>
+#include <../src/autohint/ahtypes.h>
+
/************************************************************************/
/************************************************************************/
/***** *****/
@@ -79,6 +81,14 @@ static int option_hinting = 1;
static char temp_message[1024];
+static NV_Path symbol_dot = NULL;
+static NV_Path symbol_circle = NULL;
+static NV_Path symbol_square = NULL;
+static NV_Path symbol_rect_h = NULL;
+static NV_Path symbol_rect_v = NULL;
+
+
+
#define AXIS_COLOR 0xFFFF0000
#define GRID_COLOR 0xFFD0D0D0
#define ON_COLOR 0xFFFF2000
@@ -105,6 +115,33 @@ Panic( const char* message )
}
+static void
+init_symbols( void )
+{
+ nv_path_new_rectangle( renderer, -1, -1, 3, 3, 0, 0, &symbol_square );
+ nv_path_new_rectangle( renderer, -1, -6, 2, 12, 0, 0, &symbol_rect_v );
+ nv_path_new_rectangle( renderer, -6, -1, 12, 2, 0, 0, &symbol_rect_h );
+ nv_path_new_circle( renderer, 0, 0, 3., &symbol_dot );
+ nv_path_stroke( symbol_dot, 0.6,
+ nv_path_linecap_butt,
+ nv_path_linejoin_miter, 1.,
+ &symbol_circle );
+
+ nv_path_destroy( symbol_dot );
+ nv_path_new_circle( renderer, 0, 0, 2., &symbol_dot );
+
+ }
+
+static void
+done_symbols( void )
+{
+ nv_path_destroy( symbol_circle );
+ nv_path_destroy( symbol_dot );
+ nv_path_destroy( symbol_rect_v );
+ nv_path_destroy( symbol_rect_h );
+ nv_path_destroy( symbol_square );
+}
+
/************************************************************************/
/************************************************************************/
/***** *****/
@@ -525,11 +562,6 @@ ps2_draw_control_points( void )
NV_Path horz_rect;
NV_Path dot, circle;
- nv_path_new_rectangle( renderer, -1, -6, 2, 12, 0, 0, &vert_rect );
- nv_path_new_rectangle( renderer, -6, -1, 12, 2, 0, 0, &horz_rect );
- nv_path_new_circle( renderer, 0, 0, 3., &dot );
- nv_path_stroke( dot, 0.6, nv_path_linecap_butt, nv_path_linejoin_miter, 1., &circle );
-
for ( ; count > 0; count--, point++ )
{
NV_Vector vec;
@@ -543,7 +575,7 @@ ps2_draw_control_points( void )
if ( option_show_smooth && !psh2_point_is_smooth(point) )
{
nv_painter_set_color( painter, SMOOTH_COLOR, 256 );
- nv_painter_fill_path( painter, trans, 0, circle );
+ nv_painter_fill_path( painter, trans, 0, symbol_circle );
}
if (option_show_horz_hints)
@@ -551,7 +583,7 @@ ps2_draw_control_points( void )
if ( point->flags_y & PSH2_POINT_STRONG )
{
nv_painter_set_color( painter, STRONG_COLOR, 256 );
- nv_painter_fill_path( painter, trans, 0, horz_rect );
+ nv_painter_fill_path( painter, trans, 0, symbol_rect_h );
}
}
@@ -560,18 +592,35 @@ ps2_draw_control_points( void )
if ( point->flags_x & PSH2_POINT_STRONG )
{
nv_painter_set_color( painter, STRONG_COLOR, 256 );
- nv_painter_fill_path( painter, trans, 0, vert_rect );
+ nv_painter_fill_path( painter, trans, 0, symbol_rect_v );
}
}
}
+ }
+}
- nv_path_destroy( circle );
- nv_path_destroy( dot );
- nv_path_destroy( horz_rect );
- nv_path_destroy( vert_rect );
+ /************************************************************************/
+ /************************************************************************/
+ /***** *****/
+ /***** AUTOHINTER DRAWING ROUTINES *****/
+ /***** *****/
+ /************************************************************************/
+ /************************************************************************/
+
+static void
+ah_draw_smooth_points( AH_Hinter hinter )
+{
+ if ( ah_debug_hinter )
+ {
+
}
}
+static void
+ah_draw_edges( AH_Hinter hinter )
+{
+}
+
/************************************************************************/
/************************************************************************/
/***** *****/
@@ -590,6 +639,8 @@ draw_glyph( int glyph_index )
ps1_debug_hint_func = option_show_ps_hints ? draw_ps1_hint : 0;
ps2_debug_hint_func = option_show_ps_hints ? draw_ps2_hint : 0;
+ ah_debug_hinter = NULL;
+
error = FT_Load_Glyph( face, glyph_index, option_hinting
? FT_LOAD_NO_BITMAP
: FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING );
@@ -635,8 +686,6 @@ draw_glyph( int glyph_index )
NV_Scale r = 2;
NV_Int n, first, last;
- nv_path_new_circle( renderer, 0, 0, 2., &plot );
-
nv_path_get_outline( path, NULL, memory, &out );
first = 0;
@@ -660,14 +709,12 @@ draw_glyph( int glyph_index )
nv_transform_set_translate( &trans, vec->x/64.0, vec->y/64.0 );
nv_painter_set_color( painter, color, 256 );
- nv_painter_fill_path( painter, &trans, 0, plot );
+ nv_painter_fill_path( painter, &trans, 0, symbol_dot );
}
first = last + 1;
}
-
- nv_path_destroy( plot );
}
nv_path_destroy( path );
@@ -872,8 +919,9 @@ int main( int argc, char** argv )
/* create library */
error = nv_renderer_new( 0, &renderer );
if (error) Panic( "could not create Nirvana renderer" );
-
+
memory = nv_renderer_get_memory( renderer );
+ init_symbols();
error = nvv_display_new( renderer, &display );
if (error) Panic( "could not create display" );
@@ -939,6 +987,8 @@ int main( int argc, char** argv )
/* destroy display (and surface) */
nvv_display_unref( display );
+
+ done_symbols();
nv_renderer_unref( renderer );
return 0;