Use constants for ascent, descent, etc

This way there won't be quite so many magic numbers in the font metrics.
This commit is contained in:
Ben Harris 2024-11-02 11:40:09 +00:00
parent c354f9c3ac
commit 29b33c20af

View File

@ -108,8 +108,13 @@
#define VERSION "002.009"
/* Metrics expressed in pixels. */
#define XSIZE 6
#define YSIZE 10
#define ASCENT 8
#define DESCENT 2
#define XHEIGHT 5
#define CAPHEIGHT ASCENT
/*
* Design parameters. These can vary between fonts in the Bedstead family.
@ -2860,9 +2865,9 @@ main(int argc, char **argv)
printf(" <created value='%s'/>\n", timestr);
printf(" <modified value='%s'/>\n", timestr);
printf(" <xMin value='%d'/>\n", 0);
printf(" <yMin value='%d'/>\n", (int)(-2 * YPIX));
printf(" <yMin value='%d'/>\n", (int)(-DESCENT * YPIX));
printf(" <xMax value='%d'/>\n", (int)(XSIZE * XPIX));
printf(" <yMax value='%d'/>\n", (int)((YSIZE - 2) * YPIX));
printf(" <yMax value='%d'/>\n", (int)(ASCENT * YPIX));
printf(" <macStyle value='00000000 0%c%c000%c'/>\n",
width->ttfwidth > 5 ? '1' : '0', /* Expanded? */
width->ttfwidth < 5 ? '1' : '0', /* Condensed? */
@ -2875,8 +2880,8 @@ main(int argc, char **argv)
printf(" <hhea>\n");
printf(" <tableVersion value='0x00010000'/>\n");
printf(" <ascent value='%d'/>\n", (int)((YSIZE - 2) * YPIX));
printf(" <descent value='%d'/>\n", (int)(-2 * YPIX));
printf(" <ascent value='%d'/>\n", (int)(ASCENT * YPIX));
printf(" <descent value='%d'/>\n", (int)(-DESCENT * YPIX));
printf(" <lineGap value='0'/>\n");
printf(" <advanceWidthMax value='%d'/>\n", (int)(XSIZE * XPIX));
printf(" <minLeftSideBearing value='0'/>\n");
@ -3931,7 +3936,7 @@ bdf_gen(int px_height)
int px_width = (px_height * XPIX * XSIZE) / (YPIX * YSIZE);
int pt_height = (long)(px_height * 7227 + 3750) / 7500;
int dpt_height = (long)(px_height * 7227 + 375) / 750;
int base = (px_height * 200) / (YPIX * YSIZE);
int base = DESCENT;
int i;
printf("%%!\n");