chiark / gitweb /
Stop using %stdout for writing BDF files
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 27 Nov 2024 10:41:17 +0000 (10:41 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Wed, 27 Nov 2024 10:51:38 +0000 (10:51 +0000)
Instead, pass the destination filename to the bdf.ps program and have it
open the file itself.  This avoids capturing Ghostscript's own
diagnostics in the output file.

Makefile
bedstead.c

index 104220db265984a6e2fda1827cc7bcf812efef5f..d12182f5f7666d1475c97cbdc10a83c9a3c21ae7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,7 @@ bedstead-bold-%.bdf.ps: bedstead
 # Dependency of all of OTFFILES could be narrowed to just the relevant
 # one.
 %.bdf: %.bdf.ps $(OTFFILES) Fontmap
-       gs -q -P -dSAFER -dNODISPLAY -dBATCH $< > $@
+       gs -P -q -dSAFER --permit-file-write=$@ -dNODISPLAY -dBATCH -- $< $@
 
 %.otf: %.ttx
        ttx --no-recalc-timestamp -o $@ $<
index 31b3f0e02f569c43e8da6c40bceeb2e85aac4d01..1176a8754aaa6e5284e158111938c13b7f842c58 100644 (file)
@@ -4567,7 +4567,7 @@ bdf_gen(int px_height)
        printf("d setdevice\n");
        printf("/%s findfont %d scalefont setfont\n",
               fullname_to_fontname(get_fullname()), px_height);
-       printf("/f (%%stdout) (w) file def\n");
+       printf("/f ARGUMENTS 0 get (w) file def\n");
        printf("/buf %d string def\n", (px_width + 7) / 8);
        printf("(\\\n");
        printf("STARTFONT 2.1\n");
@@ -4600,8 +4600,8 @@ bdf_gen(int px_height)
        printf("RELATIVE_SETWIDTH %d\n", width->ttfwidth * 10);
        printf("RELATIVE_WEIGHT %d\n", weight->ttfweight / 10);
        printf("FACE_NAME \"%s\"\n", get_fullname());
-       printf("FONT_VERSION \") print\n");
-       printf("currentfont /FontInfo get /version get print\n");
+       printf("FONT_VERSION \") f exch writestring\n");
+       printf("currentfont /FontInfo get /version get f exch writestring\n");
        printf("(\"\n");
        printf("FONT_ASCENT %d\n", px_height - base);
        printf("FONT_DESCENT %d\n", base);
@@ -4616,17 +4616,17 @@ bdf_gen(int px_height)
                printf("DWIDTH %d 0\n", px_width);
                printf("BBX %d %d 0 %d\n", px_width, px_height, -base);
                printf("BITMAP\n");
-               printf(") print\n");
+               printf(") f exch writestring\n");
                printf("erasepage\n");
                printf("0 %d moveto\n", base);
                printf("/%s glyphshow\n", g->name);
                printf("%d -1 0 {\n", px_height - 1);
                printf(" d exch buf copyscanlines\n");
-               printf(" f exch writehexstring (\n) print\n");
+               printf(" f exch writehexstring (\n) f exch writestring\n");
                printf("} for\n");
                printf("(\\\n");
                printf("ENDCHAR\n");
        }
        printf("ENDFONT\n");
-       printf(") print\n");
+       printf(") f exch writestring\n");
 }