diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2004-09-20 15:52:46 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2004-09-20 15:52:46 +0000 |
| commit | 09f7b5393a0e4593b891773eedff72a953429f31 (patch) | |
| tree | 818a2428dbc079a6a240ffcef72081e3bb9a2ab1 | |
| parent | 10443f15627090be563b1e73996cf38ef6742097 (diff) | |
| download | halibut-09f7b5393a0e4593b891773eedff72a953429f31.zip halibut-09f7b5393a0e4593b891773eedff72a953429f31.tar.gz halibut-09f7b5393a0e4593b891773eedff72a953429f31.tar.bz2 halibut-09f7b5393a0e4593b891773eedff72a953429f31.tar.xz | |
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.
[originally from svn r4553]
| -rw-r--r-- | bk_ps.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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"); |