Q:

Settextstyle function in c using graphics.h

0

Settextstyle function in c using graphics.h

Settextstyle function is used to change the way in which text appears, using it we can modify the size of text, change direction of text and change the font of text.

Declaration: void settextstyle( int font, int direction, int charsize);
font argument specifies the font of text, Direction can be HORIZ_DIR (Left to right) or VERT_DIR (Bottom to top).

Different fonts

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
};

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now