[BACK]Return to term_ps.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/term_ps.c between version 1.88 and 1.89

version 1.88, 2017/10/26 18:11:31 version 1.89, 2017/10/29 19:25:31
Line 77  struct termp_ps {
Line 77  struct termp_ps {
         size_t            lineheight;   /* line height (AFM units) */          size_t            lineheight;   /* line height (AFM units) */
         size_t            top;          /* body top (AFM units) */          size_t            top;          /* body top (AFM units) */
         size_t            bottom;       /* body bottom (AFM units) */          size_t            bottom;       /* body bottom (AFM units) */
           const char       *medianame;    /* for DocumentMedia and PageSize */
         size_t            height;       /* page height (AFM units */          size_t            height;       /* page height (AFM units */
         size_t            width;        /* page width (AFM units) */          size_t            width;        /* page width (AFM units) */
         size_t            lastwidth;    /* page width before last ll */          size_t            lastwidth;    /* page width before last ll */
Line 559  pspdf_alloc(const struct manoutput *outopts)
Line 560  pspdf_alloc(const struct manoutput *outopts)
   
         /* Default to US letter (millimetres). */          /* Default to US letter (millimetres). */
   
           p->ps->medianame = "Letter";
         pagex = 216;          pagex = 216;
         pagey = 279;          pagey = 279;
   
Line 570  pspdf_alloc(const struct manoutput *outopts)
Line 572  pspdf_alloc(const struct manoutput *outopts)
          */           */
   
         pp = outopts->paper;          pp = outopts->paper;
         if (pp && strcasecmp(pp, "letter")) {          if (pp != NULL && strcasecmp(pp, "letter") != 0) {
                 if (0 == strcasecmp(pp, "a3")) {                  if (strcasecmp(pp, "a3") == 0) {
                           p->ps->medianame = "A3";
                         pagex = 297;                          pagex = 297;
                         pagey = 420;                          pagey = 420;
                 } else if (0 == strcasecmp(pp, "a4")) {                  } else if (strcasecmp(pp, "a4") == 0) {
                           p->ps->medianame = "A4";
                         pagex = 210;                          pagex = 210;
                         pagey = 297;                          pagey = 297;
                 } else if (0 == strcasecmp(pp, "a5")) {                  } else if (strcasecmp(pp, "a5") == 0) {
                           p->ps->medianame = "A5";
                         pagex = 148;                          pagex = 148;
                         pagey = 210;                          pagey = 210;
                 } else if (0 == strcasecmp(pp, "legal")) {                  } else if (strcasecmp(pp, "legal") == 0) {
                           p->ps->medianame = "Legal";
                         pagex = 216;                          pagex = 216;
                         pagey = 356;                          pagey = 356;
                 } else if (2 != sscanf(pp, "%ux%u", &pagex, &pagey))                  } else if (sscanf(pp, "%ux%u", &pagex, &pagey) == 2)
                           p->ps->medianame = "CustomSize";
                   else
                         warnx("%s: Unknown paper", pp);                          warnx("%s: Unknown paper", pp);
         }          }
   
Line 846  ps_end(struct termp *p)
Line 854  ps_end(struct termp *p)
 static void  static void
 ps_begin(struct termp *p)  ps_begin(struct termp *p)
 {  {
           size_t           width, height;
         int              i;          int              i;
   
         /*          /*
Line 887  ps_begin(struct termp *p)
Line 896  ps_begin(struct termp *p)
          */           */
   
         if (TERMTYPE_PS == p->type) {          if (TERMTYPE_PS == p->type) {
                   width = AFM2PNT(p, p->ps->width);
                   height = AFM2PNT(p, p->ps->height);
   
                 ps_printf(p, "%%!PS-Adobe-3.0\n");                  ps_printf(p, "%%!PS-Adobe-3.0\n");
                 ps_printf(p, "%%%%DocumentData: Clean7Bit\n");                  ps_printf(p, "%%%%DocumentData: Clean7Bit\n");
                 ps_printf(p, "%%%%Orientation: Portrait\n");                  ps_printf(p, "%%%%Orientation: Portrait\n");
                 ps_printf(p, "%%%%Pages: (atend)\n");                  ps_printf(p, "%%%%Pages: (atend)\n");
                 ps_printf(p, "%%%%PageOrder: Ascend\n");                  ps_printf(p, "%%%%PageOrder: Ascend\n");
                 ps_printf(p, "%%%%DocumentMedia: "                  ps_printf(p, "%%%%DocumentMedia: man-%s %zu %zu 0 () ()\n",
                     "Default %zu %zu 0 () ()\n",                      p->ps->medianame, width, height);
                     (size_t)AFM2PNT(p, p->ps->width),  
                     (size_t)AFM2PNT(p, p->ps->height));  
                 ps_printf(p, "%%%%DocumentNeededResources: font");                  ps_printf(p, "%%%%DocumentNeededResources: font");
   
                 for (i = 0; i < (int)TERMFONT__MAX; i++)                  for (i = 0; i < (int)TERMFONT__MAX; i++)
                         ps_printf(p, " %s", fonts[i].name);                          ps_printf(p, " %s", fonts[i].name);
   
                 ps_printf(p, "\n%%%%EndComments\n");                  ps_printf(p, "\n%%%%EndComments\n");
                   ps_printf(p, "%%%%BeginSetup\n");
                   ps_printf(p, "%%%%BeginFeature: *PageSize %s\n",
                       p->ps->medianame);
                   ps_printf(p, "<</PageSize [%zu %zu]>>setpagedevice\n",
                       width, height);
                   ps_printf(p, "%%%%EndFeature\n");
                   ps_printf(p, "%%%%EndSetup\n");
         } else {          } else {
                 ps_printf(p, "%%PDF-1.1\n");                  ps_printf(p, "%%PDF-1.1\n");
                 pdf_obj(p, 1);                  pdf_obj(p, 1);

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.89

CVSweb