settextstyle function in c graphic

settextstyle function is used to set text style of given string. It modify the font style, direction of string and font size. It is used with outtext or outtextxy function. settextstyle function takes 3 input arguments namely font-style, direction(horizontal or vertical) and font size.

General syntax of settextstyle function is : 
settextstyle(int fontstyle, int direction, int char-size);

                                        In settextstyle function we can choose font style by its int value or by font style name. And direction of text by int value( 0 or 1 ) or by direction name( HORIZ_DIR or VERT_DIR ).

                                        The following table shown the font style name and its corresponding int value.

Font Style Nameint value
DEFAULT_FONT0
TRIPLEX_FONT1
SMALL_FONT2
SANS_SERIF_FONT3
GOTHIC_FONT4
SCRIPT_FONT5
SIMPLEX_FONT6
TRIPLEX_SCR_FONT7
COMPLEX_FONT8
EUROPEAN_FONT9
BOLD_FONT10


C graphic program to demonstrate outtextxy function.


#include <graphics.h>
#include <stdio.h>

int main( )
{
    int gd=DETECT, gm;
    char msg[]="Demonstration of settextstyle function";
    initgraph(&gd,&gm,"C:\\tc\\bgi");

    setbkcolor(8);

    settextstyle(1,0,2);
    outtextxy(200,130,"Programmingcampus.com");

    settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3);
    outtextxy(200,170,msg);
    getch();
    closegraph();

    return 0;
}

settextstyle function of c graphics

Download


0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.