chiark / gitweb /
Convert a bunch of printfs to %g.
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 6 Apr 2018 22:20:34 +0000 (23:20 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Fri, 6 Apr 2018 22:20:34 +0000 (23:20 +0100)
Along with casting arguments to (double), obviously.

bedstead.c

index 1e66284301e55eb5002a45f3cae14e21db2046c4..ef1b25df171a401f348337f0ad58122d0e6323c3 100644 (file)
@@ -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]);