Sample to illustrate using Fonts in graphics.

#include <graphics.h>

int main(void)
{
int gm = DETECT, gd, x, y, i, j;
char *fontname[] = { "DEFAULT FONT",
"TRIPLEX FONT",
"SMALL FONT",
"SANS SERIF FONT",
"GOTHIC FONT" };

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

settextjustify(CENTER_TEXT, TOP_TEXT);
x = getmaxx() / 2;
for(i = 0; i < 5; i++)
{
y = 0;
for(j = 1; j <= 10; j++)
{
settextstyle( i, HORIZ_DIR, j);
moveto(x,y);
outtext(fontname[i]);
y += (textheight(fontname[i]) + 2);
}
getch();
getch();
clearviewport();
}
closegraph();
restorecrtmode();

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin