From: Ben Harris Date: Fri, 6 Apr 2018 22:20:34 +0000 (+0100) Subject: Convert a bunch of printfs to %g. X-Git-Tag: bedstead-002.000~16 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=d655ebfcb10d247b9a493029300f1d1e48f6a820;p=bedstead-debian.git Convert a bunch of printfs to %g. Along with casting arguments to (double), obviously. --- diff --git a/bedstead.c b/bedstead.c index 1e66284..ef1b25d 100644 --- a/bedstead.c +++ b/bedstead.c @@ -1671,12 +1671,12 @@ main(int argc, char **argv) printf("Copyright: Dedicated to the public domain\n"); printf("Version: 001.003\n"); printf("ItalicAngle: 0\n"); - printf("UnderlinePosition: %d\n", (int)(-YPIX / 2)); - printf("UnderlineWidth: %d\n", (int)(YPIX)); + printf("UnderlinePosition: %g\n", (double)(-YPIX / 2)); + printf("UnderlineWidth: %g\n", (double)(YPIX)); printf("OS2StrikeYPos: %d\n", (int)(3 * YPIX)); printf("OS2StrikeYSize: %d\n", (int)(YPIX)); - printf("Ascent: %d\n", (int)(8 * YPIX)); - printf("Descent: %d\n", (int)(2 * YPIX)); + printf("Ascent: %g\n", (double)(8 * YPIX)); + printf("Descent: %g\n", (double)(2 * YPIX)); /* Sub/Superscript are three by five pixels */ printf("OS2SubXSize: %d\n", (int)(YSIZE * YPIX * 3 / (XSIZE - 1))); printf("OS2SupXSize: %d\n", (int)(YSIZE * YPIX * 3 / (XSIZE - 1))); @@ -1704,15 +1704,16 @@ main(int argc, char **argv) printf("StrokeWidth: 50\n"); } printf("BeginPrivate: 5\n"); - printf(" StdHW 6 [%4d]\n", (int)YPIX); - printf(" StdVW 6 [%4d]\n", (int)(XPIX * (100 + weight->weight) / 100)); - printf(" BlueValues 35 [0 0 %4d %4d %4d %4d %4d %4d]\n", - (int)(YPIX * 5), (int)(YPIX * 5), - (int)(YPIX * 6), (int)(YPIX * 6), - (int)(YPIX * 7), (int)(YPIX * 7)); - printf(" OtherBlues 21 [%4d %4d %4d %4d]\n", - (int)(YPIX * -2), (int)(YPIX * -2), - (int)(YPIX * 1), (int)(YPIX * 1)); + printf(" StdHW 6 [%4g]\n", (double)YPIX); + printf(" StdVW 6 [%4g]\n", + (double)(XPIX * (100 + weight->weight) / 100)); + printf(" BlueValues 35 [0 0 %4g %4g %4g %4g %4g %4g]\n", + (double)(YPIX * 5), (double)(YPIX * 5), + (double)(YPIX * 6), (double)(YPIX * 6), + (double)(YPIX * 7), (double)(YPIX * 7)); + printf(" OtherBlues 21 [%4g %4g %4g %4g]\n", + (double)(YPIX * -2), (double)(YPIX * -2), + (double)(YPIX * 1), (double)(YPIX * 1)); printf(" BlueFuzz 1 0\n"); printf("EndPrivate\n"); /* Force monochrome at 10 and 20 pixels, and greyscale elsewhere. */ @@ -1745,7 +1746,7 @@ main(int argc, char **argv) printf("Encoding: %d %d %d\n", glyphs[i].unicode != -1 ? glyphs[i].unicode : 65536 + extraglyphs++, glyphs[i].unicode, i); - printf("Width: %d\n", (int)(XSIZE * XPIX)); + printf("Width: %g\n", (double)(XSIZE * XPIX)); printf("Flags: HW\n"); printf("LayerCount: 2\n"); dolookups(&glyphs[i]);