some changes used to debug the new raster and the OS/2 graphics driver
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
diff --git a/demos/src/fttimer.c b/demos/src/fttimer.c
index 84fa222..ed80990 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 74ebde0..425289d 100644
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#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;