Header file:
graphics.h
Synopsis:
void setusercharsize(int multx, int divx, int multy, int divy);
multx : divx - width magnification factor
multy : divy - height magnification factor
Description:
setusercharsize() sets user defined character magnification factor for stroked fonts. To make the text twice as wide as default text, set 2 to multx and 1 to divx.
multx : divx <=> 2 : 1
To make the text half the height of default, set 1 to multy and 2 to divy.
multy : divy <=> 1 : 2
setusercharsize function in c graphics
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
/* request autodetection */
int graphicDriver = DETECT, graphicMode, err;
/* initialize graphics and local variables */
initgraph(&graphicDriver, &graphicMode,
"C:/TURBOC3/BGI");
/* read result of initialization */
err = graphresult();
if (err != grOk) {
/* an error occurred */
printf("Graphics error: %s\n",
grapherrormsg(err));
getch();
return 0;
}
/* select a text style */
settextstyle(GOTHIC_FONT, HORIZ_DIR, 4);
/* move to the text starting position */
moveto(0, getmaxy() / 2);
/* output some normal text */
outtext("Normal ");
/* make the text 1/3 the normal width */
setusercharsize(1, 2, 1, 2);
outtext("Slim ");
/* make the text 3 times normal width */
setusercharsize(5, 1, 5, 1);
outtext("Fat");
/* clean up */
getch();
closegraph();
return 0;
}
Output: (setusercharsize built-in function in c graphics.h)
No comments:
Post a Comment