From 9e01d0b9f9c700e02453f614c04a22110656b1b0 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Thu, 1 Nov 2018 21:58:33 +0100 Subject: [PATCH] postsc.c, enable postscript output for extended ascii. Currently only Western European latin-1 (ISO/IEC 8859-1) encoding is supported. --- src/frontend/postsc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontend/postsc.c b/src/frontend/postsc.c index 8c31d0a04..fd409df70 100644 --- a/src/frontend/postsc.c +++ b/src/frontend/postsc.c @@ -202,7 +202,20 @@ PS_NewViewport(GRAPH *graph) fprintf(plotfile, "%%%%Creator: nutmeg\n"); fprintf(plotfile, "%%%%BoundingBox: %d %d %d %d\n", x1, y1, x2, y2); - fprintf(plotfile, "%g %g scale\n", 1.0 / scale, 1.0 / scale); + /* ReEncoding to allow 'extended asccii' + * thanks to http://apps.jcns.fz-juelich.de/doku/sc/ps-latin/ */ + fprintf(plotfile, "/ReEncode { %% inFont outFont encoding | -\n"); + fprintf(plotfile, " /MyEncoding exch def\n"); + fprintf(plotfile, " exch findfont\n"); + fprintf(plotfile, " dup length dict\n"); + fprintf(plotfile, " begin\n"); + fprintf(plotfile, " {def} forall\n"); + fprintf(plotfile, " /Encoding MyEncoding def\n"); + fprintf(plotfile, " currentdict\n"); + fprintf(plotfile, " end\n"); + fprintf(plotfile, " definefont\n"); + fprintf(plotfile, "} def\n"); + fprintf(plotfile, "/%s /%sLatin1 ISOLatin1Encoding ReEncode\n", psfont, psfont); if (colorflag == 1) { /* set the background to color given in spinit (or 0) */ @@ -215,7 +228,7 @@ PS_NewViewport(GRAPH *graph) } /* set up a reasonable font */ - fprintf(plotfile, "/%s findfont %d scalefont setfont\n\n", + fprintf(plotfile, "/%sLatin1 findfont %d scalefont setfont\n\n", psfont, (int) (fontsize * scale)); graph->devdep = TMALLOC(PSdevdep, 1);