• Have Any Question?
  • contact@eitworld.com

Settextstyle() Function





settextstyle() function changes the appearance of the text. This function is used to change the font, direction and size of text.

Declaration

void settextstyle( int font, int direction, int size);
    • settextstyle() function contains three arguments font, direction and size of text. There are various number of font style already enumerated in graphics.h library as given below:

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

};

  • Text can contain two directions either vertical or horizontal represented as VERT_DIR and HORIZ_DIR respectively. By default settextstyle() function contains DEFAULT_FONT, HORIZ_DIR and font size 1.
  • For better understanding go through the program:

Program

#include<stdio.h>

#include<conio.h>

#include<graphics.h>

void main()

{

int gd=DETECT,gm,font,X=100, Y=100;

initgraph(&gd,&gm,” “);

for(font=0;font<10;font++)

{

settextstyle( font,HORIZ_DIR,1);

outtextxy(X,Y,”Graphics Programming”);

y=y+50;

}

getch();

closegraph();

}

Above program will print the text of font size1 1 in ten different- different fonts that are already mentioned in graphics.h library in horizontal direction. The output of the program is given below:

Output

c graphics



Real Time Web Analytics