I used the code from web-fonts documantation, it is the same as the one included inthe book of sgvalib,(written below) it has worked well but when it returns to the console I get a messed up console...
I do not forget vga_setmode(0), anyway other codes are working well.. what should I do? my vga vard is tnt2m64 nvidia, and using nv driver that comes with svgalib 1.4.3..
Thanks..
 
#include <stdlib.h>
#include <vga.h>
#include <vgagl.h>

#define FONT_HEIGHT  8
#define FONT_WIDTH   8

void prepare_font(void);

int main(void)
{
   int x = 10,
       y = 10;

   char text[] = "Hello, world!";

   vga_init();
   vga_setmode(G320x200x256);
   gl_setcontextvga(G320x200x256);

   prepare_font();
   gl_write(x, y, text);

   vga_getch();

   vga_setmode(TEXT);

   return 0;
}

void prepare_font(void)
{
   int color = 15;  /*  white  */

   void *font = malloc(256 * FONT_WIDTH * FONT_HEIGHT * BYTESPERPIXEL);
   gl_expandfont(FONT_WIDTH, FONT_HEIGHT, color, gl_font8x8, font);
   gl_setfont(FONT_WIDTH, FONT_HEIGHT, font);
}
----

Reply via email to