|
From: <cn...@us...> - 2009-06-20 23:08:44
|
Revision: 346
http://hgengine.svn.sourceforge.net/hgengine/?rev=346&view=rev
Author: cnlohr
Date: 2009-06-20 23:08:43 +0000 (Sat, 20 Jun 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/tools/fonter/main.cpp
Modified: Mercury2/tools/fonter/main.cpp
===================================================================
--- Mercury2/tools/fonter/main.cpp 2009-06-19 04:21:37 UTC (rev 345)
+++ Mercury2/tools/fonter/main.cpp 2009-06-20 23:08:43 UTC (rev 346)
@@ -35,7 +35,7 @@
// imagedata[(x+y*1024)*4+3] = 255; //alpha
}
- my_read_font( argv[1], imagedata, 64, 64, 16, 16 );
+ my_read_font( argv[1], imagedata, 64, 64, 16, 8 );
my_write_png( argv[2], imagedata, 1024, 1024 );
}
@@ -68,41 +68,65 @@
exit( -1 );
}
- error = FT_Set_Pixel_Sizes( face, 0, 64 );
+ error = FT_Set_Pixel_Sizes( face, 0, 54 );
if( error )
{
fprintf( stderr, "Error with FT_Set_Pixel_Sizes\n" );
exit( -3 );
}
- glyph_index = FT_Get_Char_Index( face, 65 );
+ for( int ch = 0; ch < xq * yq; ch++ )
+ {
+ glyph_index = FT_Get_Char_Index( face, ch );
+
+ error = FT_Load_Glyph( face, glyph_index, 0 ); //FT_LOAD_NO_BITMAP (try as last parameter)
+
+ if( error )
+ {
+ fprintf( stderr, "FT_Load_Glyph had a problem.\n" );
+ exit( -4 );
+ }
+
+ error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL ); //try FT_LOAD_NO_HINTING
+ if( error )
+ {
+ fprintf( stderr, "FT_Render_Glyph had a problem.\n" );
+ exit( -4 );
+ }
- error = FT_Load_Glyph( face,
- glyph_index, 0 ); //FT_LOAD_NO_BITMAP (try as last thing)
+ FT_Bitmap l_bitmap = face->glyph->bitmap;
- if( error )
- {
- fprintf( stderr, "FT_Load_Glyph had a problem.\n" );
- exit( -4 );
+ printf( "%d (%c) %d %d\n", ch, ch, face->glyph->bitmap_left, face->glyph->bitmap_top );
+
+ for( int x = 0; x < xpp; x++ )
+ for( int y = 0; y < ypp; y++ )
+ {
+ int offx = x+(xpp*(ch%xq)) + face->glyph->bitmap_left+0;
+ int offy = y+(ypp*(ch/xq)) - face->glyph->bitmap_top+64;
+
+ if( x >= l_bitmap.width ) continue;
+ if( y >= l_bitmap.rows ) continue;
+
+ if( offx < 0 || offx >= xq*xpp ) continue;
+ if( offy < 0 || offy >= yq*ypp ) continue;
+
+ imagedata[(offx + offy*(xq*xpp))*2+1] = l_bitmap.buffer[x+y*l_bitmap.pitch ];
+ imagedata[(offx + offy*(xq*xpp))*2+0] = 0;
+ }
}
- error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL );
- if( error )
+ for( int x = 0; x < 1024; x+=64 )
+ for( int y = 0; y < 1024; y++ )
{
- fprintf( stderr, "FT_Render_Glyph had a problem.\n" );
- exit( -4 );
+ imagedata[(x+y*(xq*xpp))*2+0] = 0;
+ imagedata[(x+y*(xq*xpp))*2+1] = 255;
}
-
- FT_Bitmap l_bitmap = face->glyph->bitmap;
-
for( int x = 0; x < 1024; x++ )
- for( int y = 0; y < 1024; y++ )
- {
- if( x > l_bitmap.width ) continue;
- if( y > l_bitmap.rows ) continue;
- imagedata[(x+y*1024)*2+1] = face->glyph->bitmap.buffer[x+y*l_bitmap.width ];
- }
-
+ for( int y = 0; y < 1024; y+=64 )
+ {
+ imagedata[(x+y*(xq*xpp))*2+0] = 0;
+ imagedata[(x+y*(xq*xpp))*2+1] = 255;
+ }
}
int my_write_png( const char * fname, unsigned char * imagedata, int width, int height )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|