Print this page
9718 update mandoc to 1.14.4

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mandoc/term_ps.c
          +++ new/usr/src/cmd/mandoc/term_ps.c
   1      -/*      $Id: term_ps.c,v 1.85 2017/06/07 17:38:26 schwarze Exp $ */
        1 +/*      $Id: term_ps.c,v 1.91 2017/11/10 23:42:52 schwarze Exp $ */
   2    2  /*
   3    3   * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4    4   * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
        5 + * Copyright (c) 2017 Marc Espie <espie@openbsd.org>
   5    6   *
   6    7   * Permission to use, copy, modify, and distribute this software for any
   7    8   * purpose with or without fee is hereby granted, provided that the above
   8    9   * copyright notice and this permission notice appear in all copies.
   9   10   *
  10   11   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11   12   * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12   13   * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13   14   * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14   15   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
↓ open down ↓ 44 lines elided ↑ open up ↑
  59   60  
  60   61  struct  termp_ps {
  61   62          int               flags;
  62   63  #define PS_INLINE        (1 << 0)       /* we're in a word */
  63   64  #define PS_MARGINS       (1 << 1)       /* we're in the margins */
  64   65  #define PS_NEWPAGE       (1 << 2)       /* new page, no words yet */
  65   66  #define PS_BACKSP        (1 << 3)       /* last character was backspace */
  66   67          size_t            pscol;        /* visible column (AFM units) */
  67   68          size_t            pscolnext;    /* used for overstrike */
  68   69          size_t            psrow;        /* visible row (AFM units) */
       70 +        size_t            lastrow;      /* psrow of the previous word */
  69   71          char             *psmarg;       /* margin buf */
  70   72          size_t            psmargsz;     /* margin buf size */
  71   73          size_t            psmargcur;    /* cur index in margin buf */
  72   74          char              last;         /* last non-backspace seen */
  73   75          enum termfont     lastf;        /* last set font */
  74   76          enum termfont     nextf;        /* building next font here */
  75   77          size_t            scale;        /* font scaling factor */
  76   78          size_t            pages;        /* number of pages shown */
  77   79          size_t            lineheight;   /* line height (AFM units) */
  78   80          size_t            top;          /* body top (AFM units) */
  79   81          size_t            bottom;       /* body bottom (AFM units) */
       82 +        const char       *medianame;    /* for DocumentMedia and PageSize */
  80   83          size_t            height;       /* page height (AFM units */
  81   84          size_t            width;        /* page width (AFM units) */
  82   85          size_t            lastwidth;    /* page width before last ll */
  83   86          size_t            left;         /* body left (AFM units) */
  84   87          size_t            header;       /* header pos (AFM units) */
  85   88          size_t            footer;       /* footer pos (AFM units) */
  86   89          size_t            pdfbytes;     /* current output byte */
  87   90          size_t            pdflastpg;    /* byte of last page mark */
  88   91          size_t            pdfbody;      /* start of body object */
  89   92          size_t           *pdfobjs;      /* table of object offsets */
↓ open down ↓ 11 lines elided ↑ open up ↑
 101  104  static  void              ps_growbuf(struct termp *, size_t);
 102  105  static  void              ps_letter(struct termp *, int);
 103  106  static  void              ps_pclose(struct termp *);
 104  107  static  void              ps_plast(struct termp *);
 105  108  static  void              ps_pletter(struct termp *, int);
 106  109  static  void              ps_printf(struct termp *, const char *, ...)
 107  110                                  __attribute__((__format__ (__printf__, 2, 3)));
 108  111  static  void              ps_putchar(struct termp *, char);
 109  112  static  void              ps_setfont(struct termp *, enum termfont);
 110  113  static  void              ps_setwidth(struct termp *, int, int);
 111      -static  struct termp     *pspdf_alloc(const struct manoutput *);
      114 +static  struct termp     *pspdf_alloc(const struct manoutput *, enum termtype);
 112  115  static  void              pdf_obj(struct termp *, size_t);
 113  116  
 114  117  /*
 115  118   * We define, for the time being, three fonts: bold, oblique/italic, and
 116  119   * normal (roman).  The following table hard-codes the font metrics for
 117  120   * ASCII, i.e., 32--127.
 118  121   */
 119  122  
 120  123  static  const struct font fonts[TERMFONT__MAX] = {
 121  124          { "Times-Roman", {
↓ open down ↓ 382 lines elided ↑ open up ↑
 504  507                  {  348 },
 505  508                  {  220 },
 506  509                  {  348 },
 507  510                  {  570 },
 508  511          } },
 509  512  };
 510  513  
 511  514  void *
 512  515  pdf_alloc(const struct manoutput *outopts)
 513  516  {
 514      -        struct termp    *p;
 515      -
 516      -        if (NULL != (p = pspdf_alloc(outopts)))
 517      -                p->type = TERMTYPE_PDF;
 518      -
 519      -        return p;
      517 +        return pspdf_alloc(outopts, TERMTYPE_PDF);
 520  518  }
 521  519  
 522  520  void *
 523  521  ps_alloc(const struct manoutput *outopts)
 524  522  {
 525      -        struct termp    *p;
 526      -
 527      -        if (NULL != (p = pspdf_alloc(outopts)))
 528      -                p->type = TERMTYPE_PS;
 529      -
 530      -        return p;
      523 +        return pspdf_alloc(outopts, TERMTYPE_PS);
 531  524  }
 532  525  
 533  526  static struct termp *
 534      -pspdf_alloc(const struct manoutput *outopts)
      527 +pspdf_alloc(const struct manoutput *outopts, enum termtype type)
 535  528  {
 536  529          struct termp    *p;
 537  530          unsigned int     pagex, pagey;
 538  531          size_t           marginx, marginy, lineheight;
 539  532          const char      *pp;
 540  533  
 541  534          p = mandoc_calloc(1, sizeof(*p));
 542  535          p->tcol = p->tcols = mandoc_calloc(1, sizeof(*p->tcol));
 543  536          p->maxtcol = 1;
      537 +        p->type = type;
 544  538  
 545  539          p->enc = TERMENC_ASCII;
 546  540          p->fontq = mandoc_reallocarray(NULL,
 547  541              (p->fontsz = 8), sizeof(*p->fontq));
 548  542          p->fontq[0] = p->fontl = TERMFONT_NONE;
 549  543          p->ps = mandoc_calloc(1, sizeof(*p->ps));
 550  544  
 551  545          p->advance = ps_advance;
 552  546          p->begin = ps_begin;
 553  547          p->end = ps_end;
 554  548          p->endline = ps_endline;
 555  549          p->hspan = ps_hspan;
 556  550          p->letter = ps_letter;
 557  551          p->setwidth = ps_setwidth;
 558  552          p->width = ps_width;
 559  553  
 560  554          /* Default to US letter (millimetres). */
 561  555  
      556 +        p->ps->medianame = "Letter";
 562  557          pagex = 216;
 563  558          pagey = 279;
 564  559  
 565  560          /*
 566  561           * The ISO-269 paper sizes can be calculated automatically, but
 567  562           * it would require bringing in -lm for pow() and I'd rather not
 568  563           * do that.  So just do it the easy way for now.  Since this
 569  564           * only happens once, I'm not terribly concerned.
 570  565           */
 571  566  
 572  567          pp = outopts->paper;
 573      -        if (pp && strcasecmp(pp, "letter")) {
 574      -                if (0 == strcasecmp(pp, "a3")) {
      568 +        if (pp != NULL && strcasecmp(pp, "letter") != 0) {
      569 +                if (strcasecmp(pp, "a3") == 0) {
      570 +                        p->ps->medianame = "A3";
 575  571                          pagex = 297;
 576  572                          pagey = 420;
 577      -                } else if (0 == strcasecmp(pp, "a4")) {
      573 +                } else if (strcasecmp(pp, "a4") == 0) {
      574 +                        p->ps->medianame = "A4";
 578  575                          pagex = 210;
 579  576                          pagey = 297;
 580      -                } else if (0 == strcasecmp(pp, "a5")) {
      577 +                } else if (strcasecmp(pp, "a5") == 0) {
      578 +                        p->ps->medianame = "A5";
 581  579                          pagex = 148;
 582  580                          pagey = 210;
 583      -                } else if (0 == strcasecmp(pp, "legal")) {
      581 +                } else if (strcasecmp(pp, "legal") == 0) {
      582 +                        p->ps->medianame = "Legal";
 584  583                          pagex = 216;
 585  584                          pagey = 356;
 586      -                } else if (2 != sscanf(pp, "%ux%u", &pagex, &pagey))
      585 +                } else if (sscanf(pp, "%ux%u", &pagex, &pagey) == 2)
      586 +                        p->ps->medianame = "CustomSize";
      587 +                else
 587  588                          warnx("%s: Unknown paper", pp);
 588  589          }
 589  590  
 590  591          /*
 591  592           * This MUST be defined before any PNT2AFM or AFM2PNT
 592  593           * calculations occur.
 593  594           */
 594  595  
 595  596          p->ps->scale = 11;
 596  597  
 597  598          /* Remember millimetres -> AFM units. */
 598  599  
 599      -        pagex = PNT2AFM(p, ((double)pagex * 2.834));
 600      -        pagey = PNT2AFM(p, ((double)pagey * 2.834));
      600 +        pagex = PNT2AFM(p, ((double)pagex * 72.0 / 25.4));
      601 +        pagey = PNT2AFM(p, ((double)pagey * 72.0 / 25.4));
 601  602  
 602  603          /* Margins are 1/9 the page x and y. */
 603  604  
 604  605          marginx = (size_t)((double)pagex / 9.0);
 605  606          marginy = (size_t)((double)pagey / 9.0);
 606  607  
 607  608          /* Line-height is 1.4em. */
 608  609  
 609  610          lineheight = PNT2AFM(p, ((double)p->ps->scale * 1.4));
 610  611  
↓ open down ↓ 115 lines elided ↑ open up ↑
 726  727  }
 727  728  
 728  729  static void
 729  730  ps_closepage(struct termp *p)
 730  731  {
 731  732          int              i;
 732  733          size_t           len, base;
 733  734  
 734  735          /*
 735  736           * Close out a page that we've already flushed to output.  In
 736      -         * PostScript, we simply note that the page must be showed.  In
      737 +         * PostScript, we simply note that the page must be shown.  In
 737  738           * PDF, we must now create the Length, Resource, and Page node
 738  739           * for the page contents.
 739  740           */
 740  741  
 741  742          assert(p->ps->psmarg && p->ps->psmarg[0]);
 742  743          ps_printf(p, "%s", p->ps->psmarg);
 743  744  
 744  745          if (TERMTYPE_PS != p->type) {
 745      -                ps_printf(p, "ET\n");
 746      -
 747  746                  len = p->ps->pdfbytes - p->ps->pdflastpg;
 748  747                  base = p->ps->pages * 4 + p->ps->pdfbody;
 749  748  
 750  749                  ps_printf(p, "endstream\nendobj\n");
 751  750  
 752  751                  /* Length of content. */
 753  752                  pdf_obj(p, base + 1);
 754  753                  ps_printf(p, "%zu\nendobj\n", len);
 755  754  
 756  755                  /* Resource for content. */
 757  756                  pdf_obj(p, base + 2);
 758  757                  ps_printf(p, "<<\n/ProcSet [/PDF /Text]\n");
 759  758                  ps_printf(p, "/Font <<\n");
 760  759                  for (i = 0; i < (int)TERMFONT__MAX; i++)
 761  760                          ps_printf(p, "/F%d %d 0 R\n", i, 3 + i);
 762      -                ps_printf(p, ">>\n>>\n");
      761 +                ps_printf(p, ">>\n>>\nendobj\n");
 763  762  
 764  763                  /* Page node. */
 765  764                  pdf_obj(p, base + 3);
 766  765                  ps_printf(p, "<<\n");
 767  766                  ps_printf(p, "/Type /Page\n");
 768  767                  ps_printf(p, "/Parent 2 0 R\n");
 769  768                  ps_printf(p, "/Resources %zu 0 R\n", base + 2);
 770  769                  ps_printf(p, "/Contents %zu 0 R\n", base);
 771  770                  ps_printf(p, ">>\nendobj\n");
 772  771          } else
↓ open down ↓ 44 lines elided ↑ open up ↑
 817  816          for (i = 0; i < p->ps->pages; i++)
 818  817                  ps_printf(p, " %zu 0 R", i * 4 + p->ps->pdfbody + 3);
 819  818  
 820  819          base = (p->ps->pages - 1) * 4 + p->ps->pdfbody + 4;
 821  820  
 822  821          ps_printf(p, "]\n>>\nendobj\n");
 823  822          pdf_obj(p, base);
 824  823          ps_printf(p, "<<\n");
 825  824          ps_printf(p, "/Type /Catalog\n");
 826  825          ps_printf(p, "/Pages 2 0 R\n");
 827      -        ps_printf(p, ">>\n");
      826 +        ps_printf(p, ">>\nendobj\n");
 828  827          xref = p->ps->pdfbytes;
 829  828          ps_printf(p, "xref\n");
 830  829          ps_printf(p, "0 %zu\n", base + 1);
 831  830          ps_printf(p, "0000000000 65535 f \n");
 832  831  
 833  832          for (i = 0; i < base; i++)
 834  833                  ps_printf(p, "%.10zu 00000 n \n",
 835  834                      p->ps->pdfobjs[(int)i]);
 836  835  
 837  836          ps_printf(p, "trailer\n");
↓ open down ↓ 3 lines elided ↑ open up ↑
 841  840          ps_printf(p, "/Info 1 0 R\n");
 842  841          ps_printf(p, ">>\n");
 843  842          ps_printf(p, "startxref\n");
 844  843          ps_printf(p, "%zu\n", xref);
 845  844          ps_printf(p, "%%%%EOF\n");
 846  845  }
 847  846  
 848  847  static void
 849  848  ps_begin(struct termp *p)
 850  849  {
      850 +        size_t           width, height;
 851  851          int              i;
 852  852  
 853  853          /*
 854  854           * Print margins into margin buffer.  Nothing gets output to the
 855  855           * screen yet, so we don't need to initialise the primary state.
 856  856           */
 857  857  
 858  858          if (p->ps->psmarg) {
 859  859                  assert(p->ps->psmargsz);
 860  860                  p->ps->psmarg[0] = '\0';
 861  861          }
 862  862  
 863  863          /*p->ps->pdfbytes = 0;*/
 864  864          p->ps->psmargcur = 0;
 865  865          p->ps->flags = PS_MARGINS;
 866  866          p->ps->pscol = p->ps->left;
 867  867          p->ps->psrow = p->ps->header;
      868 +        p->ps->lastrow = 0; /* impossible row */
 868  869  
 869  870          ps_setfont(p, TERMFONT_NONE);
 870  871  
 871  872          (*p->headf)(p, p->argf);
 872  873          (*p->endline)(p);
 873  874  
 874  875          p->ps->pscol = p->ps->left;
 875  876          p->ps->psrow = p->ps->footer;
 876  877  
 877  878          (*p->footf)(p, p->argf);
↓ open down ↓ 4 lines elided ↑ open up ↑
 882  883          assert(0 == p->ps->flags);
 883  884          assert(p->ps->psmarg);
 884  885          assert('\0' != p->ps->psmarg[0]);
 885  886  
 886  887          /*
 887  888           * Print header and initialise page state.  Following this,
 888  889           * stuff gets printed to the screen, so make sure we're sane.
 889  890           */
 890  891  
 891  892          if (TERMTYPE_PS == p->type) {
      893 +                width = AFM2PNT(p, p->ps->width);
      894 +                height = AFM2PNT(p, p->ps->height);
      895 +
 892  896                  ps_printf(p, "%%!PS-Adobe-3.0\n");
 893  897                  ps_printf(p, "%%%%DocumentData: Clean7Bit\n");
 894  898                  ps_printf(p, "%%%%Orientation: Portrait\n");
 895  899                  ps_printf(p, "%%%%Pages: (atend)\n");
 896  900                  ps_printf(p, "%%%%PageOrder: Ascend\n");
 897      -                ps_printf(p, "%%%%DocumentMedia: "
 898      -                    "Default %zu %zu 0 () ()\n",
 899      -                    (size_t)AFM2PNT(p, p->ps->width),
 900      -                    (size_t)AFM2PNT(p, p->ps->height));
      901 +                ps_printf(p, "%%%%DocumentMedia: man-%s %zu %zu 0 () ()\n",
      902 +                    p->ps->medianame, width, height);
 901  903                  ps_printf(p, "%%%%DocumentNeededResources: font");
 902  904  
 903  905                  for (i = 0; i < (int)TERMFONT__MAX; i++)
 904  906                          ps_printf(p, " %s", fonts[i].name);
 905  907  
 906      -                ps_printf(p, "\n%%%%EndComments\n");
      908 +                ps_printf(p, "\n%%%%DocumentSuppliedResources: "
      909 +                    "procset MandocProcs 1.0 0\n");
      910 +                ps_printf(p, "%%%%EndComments\n");
      911 +                ps_printf(p, "%%%%BeginProlog\n");
      912 +                ps_printf(p, "%%%%BeginResource: procset MandocProcs "
      913 +                    "10170 10170\n");
      914 +                /* The font size is effectively hard-coded for now. */
      915 +                ps_printf(p, "/fs %zu def\n", p->ps->scale);
      916 +                for (i = 0; i < (int)TERMFONT__MAX; i++)
      917 +                        ps_printf(p, "/f%d { /%s fs selectfont } def\n",
      918 +                            i, fonts[i].name);
      919 +                ps_printf(p, "/s { 3 1 roll moveto show } bind def\n");
      920 +                ps_printf(p, "/c { exch currentpoint exch pop "
      921 +                    "moveto show } bind def\n");
      922 +                ps_printf(p, "%%%%EndResource\n");
      923 +                ps_printf(p, "%%%%EndProlog\n");
      924 +                ps_printf(p, "%%%%BeginSetup\n");
      925 +                ps_printf(p, "%%%%BeginFeature: *PageSize %s\n",
      926 +                    p->ps->medianame);
      927 +                ps_printf(p, "<</PageSize [%zu %zu]>>setpagedevice\n",
      928 +                    width, height);
      929 +                ps_printf(p, "%%%%EndFeature\n");
      930 +                ps_printf(p, "%%%%EndSetup\n");
 907  931          } else {
 908  932                  ps_printf(p, "%%PDF-1.1\n");
 909  933                  pdf_obj(p, 1);
 910  934                  ps_printf(p, "<<\n");
 911  935                  ps_printf(p, ">>\n");
 912  936                  ps_printf(p, "endobj\n");
 913  937  
 914  938                  for (i = 0; i < (int)TERMFONT__MAX; i++) {
 915  939                          pdf_obj(p, (size_t)i + 3);
 916  940                          ps_printf(p, "<<\n");
 917  941                          ps_printf(p, "/Type /Font\n");
 918  942                          ps_printf(p, "/Subtype /Type1\n");
 919  943                          ps_printf(p, "/Name /F%d\n", i);
 920  944                          ps_printf(p, "/BaseFont /%s\n", fonts[i].name);
 921      -                        ps_printf(p, ">>\n");
      945 +                        ps_printf(p, ">>\nendobj\n");
 922  946                  }
 923  947          }
 924  948  
 925  949          p->ps->pdfbody = (size_t)TERMFONT__MAX + 3;
 926  950          p->ps->pscol = p->ps->left;
 927  951          p->ps->psrow = p->ps->top;
 928  952          p->ps->flags |= PS_NEWPAGE;
 929  953          ps_setfont(p, TERMFONT_NONE);
 930  954  }
 931  955  
↓ open down ↓ 4 lines elided ↑ open up ↑
 936  960  
 937  961          /*
 938  962           * If we haven't opened a page context, then output that we're
 939  963           * in a new page and make sure the font is correctly set.
 940  964           */
 941  965  
 942  966          if (PS_NEWPAGE & p->ps->flags) {
 943  967                  if (TERMTYPE_PS == p->type) {
 944  968                          ps_printf(p, "%%%%Page: %zu %zu\n",
 945  969                              p->ps->pages + 1, p->ps->pages + 1);
 946      -                        ps_printf(p, "/%s %zu selectfont\n",
 947      -                            fonts[(int)p->ps->lastf].name,
 948      -                            p->ps->scale);
      970 +                        ps_printf(p, "f%d\n", (int)p->ps->lastf);
 949  971                  } else {
 950  972                          pdf_obj(p, p->ps->pdfbody +
 951  973                              p->ps->pages * 4);
 952  974                          ps_printf(p, "<<\n");
 953  975                          ps_printf(p, "/Length %zu 0 R\n",
 954  976                              p->ps->pdfbody + 1 + p->ps->pages * 4);
 955  977                          ps_printf(p, ">>\nstream\n");
 956  978                  }
 957  979                  p->ps->pdflastpg = p->ps->pdfbytes;
 958  980                  p->ps->flags &= ~PS_NEWPAGE;
↓ open down ↓ 4 lines elided ↑ open up ↑
 963  985           * now at the current cursor.
 964  986           */
 965  987  
 966  988          if ( ! (PS_INLINE & p->ps->flags)) {
 967  989                  if (TERMTYPE_PS != p->type) {
 968  990                          ps_printf(p, "BT\n/F%d %zu Tf\n",
 969  991                              (int)p->ps->lastf, p->ps->scale);
 970  992                          ps_printf(p, "%.3f %.3f Td\n(",
 971  993                              AFM2PNT(p, p->ps->pscol),
 972  994                              AFM2PNT(p, p->ps->psrow));
 973      -                } else
 974      -                        ps_printf(p, "%.3f %.3f moveto\n(",
 975      -                            AFM2PNT(p, p->ps->pscol),
 976      -                            AFM2PNT(p, p->ps->psrow));
      995 +                } else {
      996 +                        ps_printf(p, "%.3f", AFM2PNT(p, p->ps->pscol));
      997 +                        if (p->ps->psrow != p->ps->lastrow)
      998 +                                ps_printf(p, " %.3f",
      999 +                                    AFM2PNT(p, p->ps->psrow));
     1000 +                        ps_printf(p, "(");
     1001 +                }
 977 1002                  p->ps->flags |= PS_INLINE;
 978 1003          }
 979 1004  
 980 1005          assert( ! (PS_NEWPAGE & p->ps->flags));
 981 1006  
 982 1007          /*
 983 1008           * We need to escape these characters as per the PostScript
 984 1009           * specification.  We would also escape non-graphable characters
 985 1010           * (like tabs), but none of them would get to this point and
 986 1011           * it's superfluous to abort() on them.
↓ open down ↓ 27 lines elided ↑ open up ↑
1014 1039  
1015 1040          /*
1016 1041           * Spit out that we're exiting a word context (this is a
1017 1042           * "partial close" because we don't check the last-char buffer
1018 1043           * or anything).
1019 1044           */
1020 1045  
1021 1046          if ( ! (PS_INLINE & p->ps->flags))
1022 1047                  return;
1023 1048  
1024      -        if (TERMTYPE_PS != p->type) {
     1049 +        if (TERMTYPE_PS != p->type)
1025 1050                  ps_printf(p, ") Tj\nET\n");
1026      -        } else
1027      -                ps_printf(p, ") show\n");
     1051 +        else if (p->ps->psrow == p->ps->lastrow)
     1052 +                ps_printf(p, ")c\n");
     1053 +        else {
     1054 +                ps_printf(p, ")s\n");
     1055 +                p->ps->lastrow = p->ps->psrow;
     1056 +        }
1028 1057  
1029 1058          p->ps->flags &= ~PS_INLINE;
1030 1059  }
1031 1060  
1032 1061  /* If we have a `last' char that wasn't printed yet, print it now. */
1033 1062  static void
1034 1063  ps_plast(struct termp *p)
1035 1064  {
1036 1065          size_t   wx;
1037 1066  
↓ open down ↓ 198 lines elided ↑ open up ↑
1236 1265  
1237 1266          /*
1238 1267           * If we're still at the top of the page, let the font-setting
1239 1268           * be delayed until we actually have stuff to print.
1240 1269           */
1241 1270  
1242 1271          if (PS_NEWPAGE & p->ps->flags)
1243 1272                  return;
1244 1273  
1245 1274          if (TERMTYPE_PS == p->type)
1246      -                ps_printf(p, "/%s %zu selectfont\n",
1247      -                    fonts[(int)f].name, p->ps->scale);
     1275 +                ps_printf(p, "f%d\n", (int)f);
1248 1276          else
1249 1277                  ps_printf(p, "/F%d %zu Tf\n",
1250 1278                      (int)f, p->ps->scale);
1251 1279  }
1252 1280  
1253 1281  static size_t
1254 1282  ps_width(const struct termp *p, int c)
1255 1283  {
1256 1284  
1257 1285          if (c <= 32 || c - 32 >= MAXCHAR)
↓ open down ↓ 74 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX