From f6356ab71370699a974fb1dedb544bb3b46abc26 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 14 Jan 2000 15:38:30 +0000 Subject: [PATCH] some changes used to debug the new raster and the OS/2 graphics driver --- demos/src/fttimer.c | 18 +++++++++++----- demos/src/ftview.c | 50 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/demos/src/fttimer.c b/demos/src/fttimer.c index 84fa22226..ed80990e1 100644 --- a/demos/src/fttimer.c +++ b/demos/src/fttimer.c @@ -77,7 +77,7 @@ short visual; /* display glyphs while rendering */ short gray_render; /* smooth fonts with gray levels */ - + short force_low; static void Clear_Buffer(); @@ -152,9 +152,11 @@ return error; glyph->outline.second_pass = 0; - glyph->outline.high_precision = 0; glyph->outline.dropout_mode = 0; + if (force_low) + glyph->outline.high_precision = 0; + /* debugging */ #if 0 if ( idx == 0 && !visual ) @@ -174,8 +176,10 @@ &outlines[cur_glyph] ); /* copy the glyph outline into it */ - glyph->outline.high_precision = 0; glyph->outline.second_pass = 0; + if (force_low) + glyph->outline.high_precision = 0; + FT_Copy_Outline( &glyph->outline, &outlines[cur_glyph] ); /* center outline around 0 */ @@ -208,8 +212,6 @@ FT_Error ConvertRaster( int index ) { outlines[index].second_pass = 0; - outlines[index].high_precision = 0; - return FT_Get_Outline_Bitmap( library, &outlines[index], &Bit ); } @@ -224,6 +226,7 @@ fprintf( stderr, " -s : character pixel size (default is 600)\n" ); fprintf( stderr, " -v : display results..\n" ); fprintf( stderr, " -g : render anti-aliased glyphs\n" ); + fprintf( stderr, " -l : force low quality even at small sizes\n" ); exit(1); } @@ -243,6 +246,7 @@ gray_render = 0; visual = 0; + force_low = 0; while ( argc > 1 && argv[1][0] == '-' ) { @@ -252,6 +256,10 @@ gray_render = 1; break; + case 'l': + force_low = 1; + break; + case 'v': visual = 1; break; diff --git a/demos/src/ftview.c b/demos/src/ftview.c index 74ebde00b..425289dc8 100644 --- a/demos/src/ftview.c +++ b/demos/src/ftview.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "graph.h" #include "grfont.h" @@ -34,7 +35,6 @@ #define MAXPTSIZE 500 /* dtp */ - char Header[128]; char* new_header = 0; @@ -64,6 +64,24 @@ int graph_init = 0; +#define DEBUGxxx + +#ifdef DEBUG +#define LOG(x) LogMessage##x +#else +#define LOG(x) /* rien */ +#endif + +#ifdef DEBUG + static void LogMessage( const char* fmt, ... ) + { + va_list ap; + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } +#endif /* PanicZ */ static void PanicZ( const char* message ) @@ -77,6 +95,8 @@ static void Clear_Display( void ) { long size = (long)bit.pitch * bit.rows; + + if (size < 0) size = -size; memset( bit.buffer, 0, size ); } @@ -100,7 +120,7 @@ } -#define MAX_BUFFER 65000 +#define MAX_BUFFER 300000 #define FLOOR(x) ((x) & -64) #define CEIL(x) (((x)+63) & -64) @@ -118,6 +138,7 @@ grBitmap bit3; int width, height, pitch, size; int left, right, top, bottom; + int x_top, y_top; left = FLOOR( glyph->metrics.horiBearingX ); right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width ); @@ -167,10 +188,17 @@ } /* Then, blit the image to the target surface */ + x_top = x_offset + TRUNC(left); + y_top = y_offset - TRUNC(top); + +/* + if (bit.pitch < 0) + y_top = bit.rows - y_top; +*/ grBlitGlyphToBitmap( &bit, &bit3, - x_offset + TRUNC(left), - y_offset - TRUNC(top), + x_top, + y_top, (grColor)127L ); return 0; } @@ -215,7 +243,6 @@ FT_Error error; - start_x = 4; start_y = 16 + ptsize ; @@ -231,6 +258,19 @@ { if ( !(error = LoadChar( i, hinted )) ) { +#ifdef DEBUG + if (i <= first_glyph+6) + { + LOG(( "metrics[%02d] = [%x %x]\n", + i, + glyph->metrics.horiBearingX, + glyph->metrics.horiAdvance )); + + if (i == first_glyph+6) + LOG(( "-------------------------\n")); + } + +#endif Render_Glyph( x, y ); x += ( glyph->metrics.horiAdvance >> 6 ) + 1;