postsc.c, enable postscript output for extended ascii.

Currently only Western European latin-1 (ISO/IEC 8859-1) encoding
is supported.
This commit is contained in:
Holger Vogt 2018-11-01 21:58:33 +01:00
parent 87be5b9a41
commit 9e01d0b9f9
1 changed files with 15 additions and 2 deletions

View File

@ -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);