Page

Settextstyle in graphics

// Different fonts in Graphics

enum font_names 

   DEFAULT_FONT, 
   TRIPLEX_FONT, 
   SMALL_FONT, 
   SANS_SERIF_FONT,
   GOTHIC_FONT, 
   SCRIPT_FONT, 
   SIMPLEX_FONT, 
   TRIPLEX_SCR_FONT,
   COMPLEX_FONT, 
   EUROPEAN_FONT, 
   BOLD_FONT 
};

// Program


#include <iostream.h>
#include <graphics.h>
#include <conio.h>

main()
{
   int gd = DETECT, gm, x = 25, y = 25, font = 0;

   initgraph(&gd,&gm,"C:\\TC\\BGI");

   for (font = 0; font <= 10; font++)
   {
      settextstyle(font, HORIZ_DIR, 1);
      outtextxy(x, y, "Text with different fonts");
      y = y + 25;
   }

   getch();
   closegraph();
   return 0;
}

No comments:

Post a Comment