3
void dosizes(gdImagePtr im, int color, char *fontfile,
4
int x, int y, const char *string)
12
for (cursize = 1; cursize <= 20; cursize++)
14
sprintf(buf,"%d: %s", cursize, string);
16
/* The case of newlines is taken care of in the gdImageStringTTF call */
18
cp = gdImageStringTTF (im, brect, color, fontfile, cursize, curang, x, y, buf);
20
cp = gdImageStringFT (im, brect, color, fontfile, cursize, curang, x, y, buf);
23
fprintf(stderr, "%s\n", cp);
26
/* render the same fontsize with antialiasing turned off */
28
cp = gdImageStringTTF (im, brect, 0-color, fontfile, cursize, curang, x, y, buf);
30
cp = gdImageStringFT (im, brect, 0-color, fontfile, cursize, curang, x, y, buf);
33
fprintf(stderr, "%s\n", cp);
38
void dotest(char *font,
39
int w, int h, char *string,
48
im = gdImageCreate(w, h);
49
bg = gdImageColorAllocate(im, 0, 0, 0);
51
gdImageFilledRectangle(im, 1, 1, w-1, h-1, bg);
53
fc = gdImageColorAllocate(im, 255, 192, 192);
54
lc = gdImageColorAllocate(im, 192, 255, 255);
56
out = fopen(filename, "wb");
58
dosizes(im, fc, font, 20, 20, string);
64
int main(int argc, char **argv)
67
dotest("times", 400, 600, ".....Hello, there!", "fontsizetest1.png");
68
dotest("cour", 400, 600, ".....Hello, there!", "fontsizetest2.png");
69
dotest("arial", 400, 600, ".....Hello, there!", "fontsizetest3.png");
70
dotest("verdana", 400, 600, ".....Hello, there!", "fontsizetest4.png");