From 67f13fa7f272e64646e0777e5f184a2926787081 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 20 Sep 2004 15:52:46 +0000 Subject: [PATCH] Make the PostScript prologue look less like it was written by a C programmer. In particular, use the operand stack to hold "x" and "y", and use a dictionary lookup to switch based on the type of "x". This also seems to give a slight speed increase. git-svn-id: svn://svn.tartarus.org/sgt/halibut@4553 cda61777-01e9-0310-a592-d414129be87e --- bk_ps.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bk_ps.c b/bk_ps.c index d64bc6a..5750ec0 100644 --- a/bk_ps.c +++ b/bk_ps.c @@ -74,15 +74,13 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords, * - a string is shown */ fprintf(fp, - "/t {\n" - " exch /y exch def {\n" - " /x exch def\n" - " x type /arraytype eq {x aload pop scalefont setfont} if\n" - " x type dup /integertype eq exch /realtype eq or " - "{x y moveto} if\n" - " x type /stringtype eq {x show} if\n" - " } forall\n" - "} bind def\n"); + "/tdict 4 dict dup begin\n" + " /arraytype {aload pop scalefont setfont} bind def\n" + " /realtype {1 index moveto} bind def\n" + " /integertype /realtype load def\n" + " /stringtype {show} bind def\n" + "end def\n" + "/t { tdict begin {dup type exec} forall end } bind def\n"); fprintf(fp, "%%%%EndResource\n"); fprintf(fp, "%%%%EndProlog\n"); -- 2.11.0