@ -74,6 +74,7 @@ static int option_show_blues = 0;
static int option_show_edges = 0 ;
static int option_show_segments = 1 ;
static int option_show_links = 1 ;
static int option_show_indices = 0 ;
static int option_show_ps_hints = 1 ;
static int option_show_horz_hints = 1 ;
@ -112,7 +113,7 @@ static NV_Path symbol_rect_v = NULL;
# define EDGE_COLOR 0xF0704070
# define SEGMENT_COLOR 0xF0206040
# define LINK_COLOR 0xF0FFFF00
# define SERIF_LINK_COLOR 0xF0FF808F
# define SERIF_LINK_COLOR 0xF0FF808F
/* print message and abort program */
static void
@ -160,15 +161,15 @@ done_symbols( void )
static void
reset_scale ( NV_Scale scale )
{
{
/* compute font units -> grid pixels scale factor */
glyph_scale = target - > width * 0.75 / face - > units_per_EM * scale ;
/* setup font units -> grid pixels transform */
nv_transform_set_scale ( & glyph_transform , glyph_scale , - glyph_scale ) ;
glyph_org_x = glyph_transform . delta . x = target - > width * 0.125 ;
glyph_org_y = glyph_transform . delta . y = target - > height * 0.875 ;
/* setup subpixels -> grid pixels transform */
nv_transform_set_scale ( & size_transform ,
glyph_scale / nv_fromfixed ( face - > size - > metrics . x_scale ) ,
@ -176,8 +177,8 @@ reset_scale( NV_Scale scale )
size_transform . delta = glyph_transform . delta ;
}
static void
reset_size ( int pixel_size , NV_Scale scale )
{
@ -204,7 +205,7 @@ draw_grid( void )
if ( option_show_grid )
{
NV_Scale min , max , x , step ;
/* draw vertical grid bars */
step = 64. * size_transform . matrix . xx ;
if ( step > 1. )
@ -212,12 +213,12 @@ draw_grid( void )
min = max = glyph_org_x ;
while ( min - step > = 0 ) min - = step ;
while ( max + step < target - > width ) max + = step ;
for ( x = min ; x < = max ; x + = step )
nv_pixmap_fill_rect ( target , ( NV_Int ) ( x + .5 ) , 0 ,
1 , target - > height , GRID_COLOR ) ;
}
/* draw horizontal grid bars */
step = - 64. * size_transform . matrix . yy ;
if ( step > 1. )
@ -225,29 +226,29 @@ draw_grid( void )
min = max = glyph_org_y ;
while ( min - step > = 0 ) min - = step ;
while ( max + step < target - > height ) max + = step ;
for ( x = min ; x < = max ; x + = step )
nv_pixmap_fill_rect ( target , 0 , ( NV_Int ) ( x + .5 ) ,
target - > width , 1 , GRID_COLOR ) ;
}
}
}
/* draw axis */
if ( option_show_axis )
{
nv_pixmap_fill_rect ( target , x , 0 , 1 , target - > height , AXIS_COLOR ) ;
nv_pixmap_fill_rect ( target , 0 , y , target - > width , 1 , AXIS_COLOR ) ;
}
if ( option_show_em )
{
NV_Path path ;
NV_Path stroke ;
NV_UInt units = ( NV_UInt ) face - > units_per_EM ;
nv_path_new_rectangle ( renderer , 0 , 0 , units , units , 0 , 0 , & path ) ;
nv_path_transform ( path , & glyph_transform ) ;
nv_path_stroke ( path , 1.5 , nv_path_linecap_butt , nv_path_linejoin_miter ,
4.0 , & stroke ) ;
@ -282,12 +283,12 @@ draw_ps_blue_zones( void )
FT_Int y1 , y2 ;
FT_UInt count ;
PSH_Blue_Zone zone ;
/* draw top zones */
table = & blues - > normal_top ;
count = table - > count ;
zone = table - > zones ;
for ( ; count > 0 ; count - - , zone + + )
{
v . x = 0 ;
@ -302,7 +303,7 @@ draw_ps_blue_zones( void )
nv_vector_transform ( & v , & glyph_transform ) ;
}
y1 = ( int ) ( v . y + 0.5 ) ;
v . x = 0 ;
if ( ! ps_debug_no_horz_hints )
{
@ -315,34 +316,34 @@ draw_ps_blue_zones( void )
nv_vector_transform ( & v , & glyph_transform ) ;
}
y2 = ( int ) ( v . y + 0.5 ) ;
nv_pixmap_fill_rect ( target , 0 , y1 ,
target - > width , y2 - y1 + 1 ,
BLUES_TOP_COLOR ) ;
#if 0
#if 0
printf ( " top [%.3f %.3f] \n " , zone - > cur_bottom / 64.0 , zone - > cur_top / 64.0 ) ;
# endif
# endif
}
/* draw bottom zones */
table = & blues - > normal_bottom ;
count = table - > count ;
zone = table - > zones ;
for ( ; count > 0 ; count - - , zone + + )
{
v . x = 0 ;
v . y = zone - > cur_ref ;
nv_vector_transform ( & v , & size_transform ) ;
y1 = ( int ) ( v . y + 0.5 ) ;
v . x = 0 ;
v . y = zone - > cur_ref + zone - > cur_delta ;
nv_vector_transform ( & v , & size_transform ) ;
y2 = ( int ) ( v . y + 0.5 ) ;
nv_pixmap_fill_rect ( target , 0 , y1 ,
target - > width , y2 - y1 + 1 ,
BLUES_BOT_COLOR ) ;
@ -372,23 +373,23 @@ draw_ps1_hint( PSH1_Hint hint, FT_Bool vertical )
{
int x1 , x2 ;
NV_Vector v ;
if ( pshint_vertical ! = vertical )
{
if ( vertical )
pshint_cpos = 40 ;
else
pshint_cpos = 10 ;
pshint_vertical = vertical ;
}
if ( vertical )
{
if ( ! option_show_vert_hints )
return ;
v . x = hint - > cur_pos ;
v . y = 0 ;
nv_vector_transform ( & v , & size_transform ) ;
@ -420,7 +421,7 @@ draw_ps1_hint( PSH1_Hint hint, FT_Bool vertical )
{
if ( ! option_show_horz_hints )
return ;
v . y = hint - > cur_pos ;
v . x = 0 ;
nv_vector_transform ( & v , & size_transform ) ;
@ -452,7 +453,7 @@ draw_ps1_hint( PSH1_Hint hint, FT_Bool vertical )
#if 0
printf ( " [%7.3f %7.3f] %c \n " , hint - > cur_pos / 64.0 , ( hint - > cur_pos + hint - > cur_len ) / 64.0 , vertical ? ' v ' : ' h ' ) ;
# endif
pshint_cpos + = 10 ;
}
@ -473,22 +474,22 @@ draw_ps2_hint( PSH2_Hint hint, FT_Bool vertical )
{
int x1 , x2 ;
NV_Vector v ;
if ( pshint_vertical ! = vertical )
{
if ( vertical )
pshint_cpos = 40 ;
else
pshint_cpos = 10 ;
pshint_vertical = vertical ;
}
if ( vertical )
{
if ( ! option_show_vert_hints )
return ;
v . x = hint - > cur_pos ;
v . y = 0 ;
nv_vector_transform ( & v , & size_transform ) ;
@ -520,7 +521,7 @@ draw_ps2_hint( PSH2_Hint hint, FT_Bool vertical )
{
if ( ! option_show_horz_hints )
return ;
v . y = hint - > cur_pos ;
v . x = 0 ;
nv_vector_transform ( & v , & size_transform ) ;
@ -552,7 +553,7 @@ draw_ps2_hint( PSH2_Hint hint, FT_Bool vertical )
#if 0
printf ( " [%7.3f %7.3f] %c \n " , hint - > cur_pos / 64.0 , ( hint - > cur_pos + hint - > cur_len ) / 64.0 , vertical ? ' v ' : ' h ' ) ;
# endif
pshint_cpos + = 10 ;
}
@ -569,15 +570,15 @@ ps2_draw_control_points( void )
NV_Path vert_rect ;
NV_Path horz_rect ;
NV_Path dot , circle ;
for ( ; count > 0 ; count - - , point + + )
{
NV_Vector vec ;
vec . x = point - > cur_x ;
vec . y = point - > cur_y ;
nv_vector_transform ( & vec , & size_transform ) ;
nv_transform_set_translate ( trans , vec . x , vec . y ) ;
if ( option_show_smooth & & ! psh2_point_is_smooth ( point ) )
@ -585,7 +586,7 @@ ps2_draw_control_points( void )
nv_painter_set_color ( painter , SMOOTH_COLOR , 256 ) ;
nv_painter_fill_path ( painter , trans , 0 , symbol_circle ) ;
}
if ( option_show_horz_hints )
{
if ( point - > flags_y & PSH2_POINT_STRONG )
@ -594,7 +595,7 @@ ps2_draw_control_points( void )
nv_painter_fill_path ( painter , trans , 0 , symbol_rect_h ) ;
}
}
if ( option_show_vert_hints )
{
if ( point - > flags_x & PSH2_POINT_STRONG )
@ -607,6 +608,44 @@ ps2_draw_control_points( void )
}
}
static void
ps_print_hints ( void )
{
if ( ps_debug_hints )
{
FT_Int dimension ;
PSH_Dimension dim ;
for ( dimension = 1 ; dimension > = 0 ; dimension - - )
{
PS_Dimension dim = & ps_debug_hints - > dimension [ dimension ] ;
PS_Mask mask = dim - > masks . masks ;
FT_UInt count = dim - > masks . num_masks ;
printf ( " %s hints ------------------------- \n " ,
dimension ? " vertical " : " horizontal " ) ;
for ( ; count > 0 ; count - - , mask + + )
{
FT_UInt index ;
printf ( " mask -> %d \n " , mask - > end_point ) ;
for ( index = 0 ; index < mask - > num_bits ; index + + )
{
if ( mask - > bytes [ index > > 3 ] & ( 0x80 > > ( index & 7 ) ) )
{
PS_Hint hint = dim - > hints . hints + index ;
printf ( " %c [%3d %3d (%4d)] \n " , dimension ? " v " : " h " ,
hint - > pos , hint - > pos + hint - > len , hint - > len ) ;
}
}
}
}
}
}
/************************************************************************/
/************************************************************************/
/***** *****/
@ -628,7 +667,7 @@ ah_link_path( NV_Vector* p1,
{
p2 . x = p4 - > x ;
p2 . y = p1 - > y ;
p3 . x = p1 - > x ;
p3 . y = p4 - > y ;
}
@ -636,25 +675,25 @@ ah_link_path( NV_Vector* p1,
{
p2 . x = p1 - > x ;
p2 . y = p4 - > y ;
p3 . x = p4 - > x ;
p3 . y = p1 - > y ;
}
}
nv_path_writer_new ( renderer , & writer ) ;
nv_path_writer_moveto ( writer , p1 ) ;
nv_path_writer_cubicto ( writer , & p2 , & p3 , p4 ) ;
nv_path_writer_end ( writer ) ;
path = nv_path_writer_get_path ( writer ) ;
nv_path_writer_destroy ( writer ) ;
nv_path_stroke ( path , 1. , nv_path_linecap_butt , nv_path_linejoin_round , 1. , & stroke ) ;
nv_path_destroy ( path ) ;
return stroke ;
}
}
static void
@ -665,20 +704,20 @@ ah_draw_smooth_points( void )
AH_Outline * glyph = ah_debug_hinter - > glyph ;
FT_UInt count = glyph - > num_points ;
AH_Point * point = glyph - > points ;
nv_painter_set_color ( painter , SMOOTH_COLOR , 256 ) ;
for ( ; count > 0 ; count - - , point + + )
{
if ( ! ( point - > flags & ah_flag_weak_interpolation ) )
{
NV_Transform transform , * trans = & transform ;
NV_Vector vec ;
vec . x = point - > x - ah_debug_hinter - > pp1 . x ;
vec . y = point - > y ;
nv_vector_transform ( & vec , & size_transform ) ;
nv_transform_set_translate ( & transform , vec . x , vec . y ) ;
nv_painter_fill_path ( painter , trans , 0 , symbol_circle ) ;
}
@ -696,31 +735,31 @@ ah_draw_edges( void )
FT_UInt count ;
AH_Edge * edge ;
FT_Pos pp1 = ah_debug_hinter - > pp1 . x ;
nv_painter_set_color ( painter , EDGE_COLOR , 256 ) ;
if ( option_show_edges )
{
/* draw verticla edges */
if ( option_show_vert_hints )
{
{
count = glyph - > num_vedges ;
edge = glyph - > vert_edges ;
for ( ; count > 0 ; count - - , edge + + )
{
NV_Vector vec ;
NV_Pos x ;
vec . x = edge - > pos - pp1 ;
vec . y = 0 ;
nv_vector_transform ( & vec , & size_transform ) ;
x = ( FT_Pos ) ( vec . x + 0.5 ) ;
nv_pixmap_fill_rect ( target , x , 0 , 1 , target - > height , EDGE_COLOR ) ;
}
}
/* draw horizontal edges */
if ( option_show_horz_hints )
{
@ -730,18 +769,18 @@ ah_draw_edges( void )
{
NV_Vector vec ;
NV_Pos x ;
vec . x = 0 ;
vec . y = edge - > pos ;
nv_vector_transform ( & vec , & size_transform ) ;
x = ( FT_Pos ) ( vec . y + 0.5 ) ;
nv_pixmap_fill_rect ( target , 0 , x , target - > width , 1 , EDGE_COLOR ) ;
}
}
}
if ( option_show_segments )
{
/* draw vertical segments */
@ -749,18 +788,18 @@ ah_draw_edges( void )
{
AH_Segment * seg = glyph - > vert_segments ;
FT_UInt count = glyph - > num_vsegments ;
for ( ; count > 0 ; count - - , seg + + )
{
AH_Point * first , * last ;
NV_Vector v1 , v2 ;
NV_Pos y1 , y2 , x ;
first = seg - > first ;
last = seg - > last ;
v1 . x = v2 . x = first - > x - pp1 ;
if ( first - > y < = last - > y )
{
v1 . y = first - > y ;
@ -771,35 +810,35 @@ ah_draw_edges( void )
v1 . y = last - > y ;
v2 . y = first - > y ;
}
nv_vector_transform ( & v1 , & size_transform ) ;
nv_vector_transform ( & v2 , & size_transform ) ;
y1 = ( NV_Pos ) ( v1 . y + 0.5 ) ;
y2 = ( NV_Pos ) ( v2 . y + 0.5 ) ;
x = ( NV_Pos ) ( v1 . x + 0.5 ) ;
nv_pixmap_fill_rect ( target , x - 1 , y2 , 3 , ABS ( y1 - y2 ) + 1 , SEGMENT_COLOR ) ;
}
}
/* draw horizontal segments */
if ( option_show_horz_hints )
{
AH_Segment * seg = glyph - > horz_segments ;
FT_UInt count = glyph - > num_hsegments ;
for ( ; count > 0 ; count - - , seg + + )
{
AH_Point * first , * last ;
NV_Vector v1 , v2 ;
NV_Pos y1 , y2 , x ;
first = seg - > first ;
last = seg - > last ;
v1 . y = v2 . y = first - > y ;
if ( first - > x < = last - > x )
{
v1 . x = first - > x - pp1 ;
@ -810,14 +849,14 @@ ah_draw_edges( void )
v1 . x = last - > x - pp1 ;
v2 . x = first - > x - pp1 ;
}
nv_vector_transform ( & v1 , & size_transform ) ;
nv_vector_transform ( & v2 , & size_transform ) ;
y1 = ( NV_Pos ) ( v1 . x + 0.5 ) ;
y2 = ( NV_Pos ) ( v2 . x + 0.5 ) ;
x = ( NV_Pos ) ( v1 . y + 0.5 ) ;
nv_pixmap_fill_rect ( target , y1 , x - 1 , ABS ( y1 - y2 ) + 1 , 3 , SEGMENT_COLOR ) ;
}
}
@ -827,13 +866,13 @@ ah_draw_edges( void )
{
AH_Segment * seg = glyph - > vert_segments ;
FT_UInt count = glyph - > num_vsegments ;
for ( ; count > 0 ; count - - , seg + + )
{
AH_Segment * seg2 = NULL ;
NV_Path link ;
NV_Vector v1 , v2 ;
if ( seg - > link )
{
if ( seg - > link > seg )
@ -841,19 +880,19 @@ ah_draw_edges( void )
}
else if ( seg - > serif )
seg2 = seg - > serif ;
if ( seg2 )
{
v1 . x = seg - > first - > x - pp1 ;
v2 . x = seg2 - > first - > x - pp1 ;
v1 . y = ( seg - > first - > y + seg - > last - > y ) / 2 ;
v2 . y = ( seg2 - > first - > y + seg2 - > last - > y ) / 2 ;
link = ah_link_path ( & v1 , & v2 , 1 ) ;
nv_painter_set_color ( painter , seg - > serif ? SERIF_LINK_COLOR : LINK_COLOR , 256 ) ;
nv_painter_fill_path ( painter , & size_transform , 0 , link ) ;
nv_path_destroy ( link ) ;
}
}
@ -863,13 +902,13 @@ ah_draw_edges( void )
{
AH_Segment * seg = glyph - > horz_segments ;
FT_UInt count = glyph - > num_hsegments ;
for ( ; count > 0 ; count - - , seg + + )
{
AH_Segment * seg2 = NULL ;
NV_Path link ;
NV_Vector v1 , v2 ;
if ( seg - > link )
{
if ( seg - > link > seg )
@ -877,19 +916,19 @@ ah_draw_edges( void )
}
else if ( seg - > serif )
seg2 = seg - > serif ;
if ( seg2 )
{
v1 . y = seg - > first - > y ;
v2 . y = seg2 - > first - > y ;
v1 . x = ( seg - > first - > x + seg - > last - > x ) / 2 - pp1 ;
v2 . x = ( seg2 - > first - > x + seg2 - > last - > x ) / 2 - pp1 ;
link = ah_link_path ( & v1 , & v2 , 0 ) ;
nv_painter_set_color ( painter , seg - > serif ? SERIF_LINK_COLOR : LINK_COLOR , 256 ) ;
nv_painter_fill_path ( painter , & size_transform , 0 , link ) ;
nv_path_destroy ( link ) ;
}
}
@ -912,7 +951,7 @@ draw_glyph( int glyph_index )
NV_Path path ;
pshint_vertical = - 1 ;
ps1_debug_hint_func = option_show_ps_hints ? draw_ps1_hint : 0 ;
ps2_debug_hint_func = option_show_ps_hints ? draw_ps2_hint : 0 ;
@ -922,16 +961,16 @@ draw_glyph( int glyph_index )
? FT_LOAD_NO_BITMAP
: FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING ) ;
if ( error ) Panic ( " could not load glyph " ) ;
if ( face - > glyph - > format ! = ft_glyph_format_outline )
Panic ( " could not load glyph outline " ) ;
error = nv_path_new_from_outline ( renderer ,
( NV_Outline * ) & face - > glyph - > outline ,
& size_transform ,
& path ) ;
if ( error ) Panic ( " could not create glyph path " ) ;
/* tracé du glyphe plein */
if ( option_show_glyph )
{
@ -942,16 +981,16 @@ draw_glyph( int glyph_index )
if ( option_show_stroke )
{
NV_Path stroke ;
error = nv_path_stroke ( path , 0.6 ,
nv_path_linecap_butt ,
nv_path_linejoin_miter ,
1.0 , & stroke ) ;
if ( error ) Panic ( " could not stroke glyph path " ) ;
nv_painter_set_color ( painter , 0xFF000040 , 256 ) ;
nv_painter_fill_path ( painter , 0 , 0 , stroke ) ;
nv_path_destroy ( stroke ) ;
}
@ -964,7 +1003,7 @@ draw_glyph( int glyph_index )
NV_Int n , first , last ;
nv_path_get_outline ( path , NULL , memory , & out ) ;
first = 0 ;
for ( n = 0 ; n < out . n_contours ; n + + )
{
@ -972,47 +1011,55 @@ draw_glyph( int glyph_index )
NV_Transform trans ;
NV_Color color ;
NV_SubVector * vec ;
last = out . contours [ n ] ;
for ( m = first ; m < = last ; m + + )
{
color = ( out . tags [ m ] & FT_Curve_Tag_On )
? ON_COLOR
: OFF_COLOR ;
vec = out . points + m ;
nv_transform_set_translate ( & trans , vec - > x / 64.0 , vec - > y / 64.0 ) ;
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 , symbol_dot ) ;
if ( option_show_indices )
{
char temp [ 5 ] ;
sprintf ( temp , " %d " , m ) ;
nv_pixmap_cell_text ( target , vec - > x / 64 + 4 , vec - > y / 64 - 4 ,
temp , TEXT_COLOR ) ;
}
}
first = last + 1 ;
}
}
ah_draw_smooth_points ( ) ;
ah_draw_edges ( ) ;
nv_path_destroy ( path ) ;
/* autre infos */
{
char temp [ 1024 ] ;
char temp2 [ 64 ] ;
sprintf ( temp , " font name : %s (%s) " , face - > family_name , face - > style_name ) ;
nv_pixmap_cell_text ( target , 0 , 0 , temp , TEXT_COLOR ) ;
FT_Get_Glyph_Name ( face , glyph_index , temp2 , 63 ) ;
temp2 [ 63 ] = 0 ;
sprintf ( temp , " glyph %4d: %s " , glyph_index , temp2 ) ;
nv_pixmap_cell_text ( target , 0 , 8 , temp , TEXT_COLOR ) ;
if ( temp_message [ 0 ] )
{
nv_pixmap_cell_text ( target , 0 , 16 , temp_message , TEXT_COLOR ) ;
@ -1040,7 +1087,7 @@ draw_glyph( int glyph_index )
break ; \
}
static void
handle_event ( NVV_EventRec * ev )
{
@ -1065,23 +1112,23 @@ handle_event( NVV_EventRec* ev )
case NVV_KEY ( ' s ' ) :
TOGGLE_OPTION ( option_show_stroke , " glyph stroke display " )
case NVV_KEY ( ' g ' ) :
TOGGLE_OPTION ( option_show_glyph , " glyph fill display " )
case NVV_KEY ( ' d ' ) :
TOGGLE_OPTION ( option_show_dots , " control points display " )
case NVV_KEY ( ' e ' ) :
TOGGLE_OPTION ( option_show_em , " EM square display " )
case NVV_KEY ( ' + ' ) :
{
grid_scale * = 1.2 ;
reset_scale ( grid_scale ) ;
break ;
}
case NVV_KEY ( ' - ' ) :
{
if ( grid_scale > 0.3 )
@ -1126,12 +1173,19 @@ handle_event( NVV_EventRec* ev )
case NVV_KEY ( ' S ' ) :
TOGGLE_OPTION ( option_show_smooth , " smooth points display " ) ;
case NVV_KEY ( ' i ' ) :
TOGGLE_OPTION ( option_show_indices , " point index display " ) ;
case NVV_KEY ( ' b ' ) :
TOGGLE_OPTION ( option_show_blues , " blue zones display " ) ;
case NVV_KEY ( ' h ' ) :
TOGGLE_OPTION ( option_hinting , " hinting " )
case NVV_KEY ( ' H ' ) :
ps_print_hints ( ) ;
break ;
default :
;
}
@ -1166,7 +1220,7 @@ parse_options( int* argc_p, char*** argv_p )
{
int argc = * argc_p ;
char * * argv = * argv_p ;
while ( argc > 2 & & argv [ 1 ] [ 0 ] = = ' - ' )
{
switch ( argv [ 1 ] [ 1 ] )
@ -1174,28 +1228,28 @@ parse_options( int* argc_p, char*** argv_p )
OPTION2 ( ' f ' , first_glyph = atoi ( argv [ 2 ] ) ; )
OPTION2 ( ' s ' , pixel_size = atoi ( argv [ 2 ] ) ; )
default :
usage ( ) ;
}
}
* argc_p = argc ;
* argv_p = argv ;
}
int main ( int argc , char * * argv )
{
char * filename = " /winnt/fonts/arial.ttf " ;
parse_options ( & argc , & argv ) ;
if ( argc > = 2 )
filename = argv [ 1 ] ;
/* create library */
error = nv_renderer_new ( 0 , & renderer ) ;
if ( error ) Panic ( " could not create Nirvana renderer " ) ;
@ -1205,7 +1259,7 @@ int main( int argc, char** argv )
error = nvv_display_new ( renderer , & display ) ;
if ( error ) Panic ( " could not create display " ) ;
error = nvv_surface_new ( display , 460 , 460 , nv_pixmap_type_argb , & surface ) ;
if ( error ) Panic ( " could not create surface " ) ;
@ -1213,26 +1267,26 @@ int main( int argc, char** argv )
error = nv_painter_new ( renderer , & painter ) ;
if ( error ) Panic ( " could not create painter " ) ;
nv_painter_set_target ( painter , target ) ;
clear_background ( ) ;
error = FT_Init_FreeType ( & freetype ) ;
if ( error ) Panic ( " could not initialise FreeType " ) ;
error = FT_New_Face ( freetype , filename , 0 , & face ) ;
if ( error ) Panic ( " could not open font face " ) ;
reset_size ( pixel_size , grid_scale ) ;
nvv_surface_set_title ( surface , " FreeType Glyph Viewer " ) ;
{
NVV_EventRec event ;
glyph_index = first_glyph ;
glyph_index = first_glyph ;
for ( ; ; )
{
clear_background ( ) ;
@ -1247,29 +1301,29 @@ int main( int argc, char** argv )
draw_ps_blue_zones ( ) ;
draw_glyph ( glyph_index ) ;
ps2_draw_control_points ( ) ;
nvv_surface_refresh ( surface , NULL ) ;
nvv_surface_listen ( surface , 0 , & event ) ;
if ( event . key = = NVV_Key_Esc )
break ;
handle_event ( & event ) ;
switch ( event . key )
{
case NVV_Key_Esc :
goto Exit ;
default :
;
}
}
}
Exit :
/* wait for escape */
/* destroy display (and surface) */
nvv_display_unref ( display ) ;