]>
git.cameronkatri.com Git - mandoc.git/blob - term_ps.c
1 /* $Id: term_ps.c,v 1.39 2010/07/25 22:15:07 kristaps Exp $ */
3 * Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 #include <sys/param.h>
36 /* Convert PostScript point "x" to an AFM unit. */
37 #define PNT2AFM(p, x) /* LINTED */ \
38 (size_t)((double)(x) * (1000.0 / (double)(p)->engine.ps.scale))
40 /* Convert an AFM unit "x" to a PostScript points */
41 #define AFM2PNT(p, x) /* LINTED */ \
42 ((double)(x) / (1000.0 / (double)(p)->engine.ps.scale))
45 unsigned short wx
; /* WX in AFM */
49 const char *name
; /* FontName in AFM */
50 #define MAXCHAR 95 /* total characters we can handle */
51 struct glyph gly
[MAXCHAR
]; /* glyph metrics */
55 * We define, for the time being, three fonts: bold, oblique/italic, and
56 * normal (roman). The following table hard-codes the font metrics for
57 * ASCII, i.e., 32--127.
60 static const struct font fonts
[TERMFONT__MAX
] = {
354 /* These work the buffer used by the header and footer. */
355 #define PS_BUFSLOP 128
356 #define PS_GROWBUF(p, sz) \
357 do if ((p)->engine.ps.psmargcur + (sz) > \
358 (p)->engine.ps.psmargsz) { \
359 (p)->engine.ps.psmargsz += /* CONSTCOND */ \
360 MAX(PS_BUFSLOP, (sz)); \
361 (p)->engine.ps.psmarg = realloc \
362 ((p)->engine.ps.psmarg, \
363 (p)->engine.ps.psmargsz); \
364 if (NULL == (p)->engine.ps.psmarg) { \
366 exit(EXIT_FAILURE); \
368 } while (/* CONSTCOND */ 0)
371 static double ps_hspan(const struct termp
*,
372 const struct roffsu
*);
373 static size_t ps_width(const struct termp
*, char);
374 static void ps_advance(struct termp
*, size_t);
375 static void ps_begin(struct termp
*);
376 static void ps_closepage(struct termp
*);
377 static void ps_end(struct termp
*);
378 static void ps_endline(struct termp
*);
379 static void ps_fclose(struct termp
*);
380 static void ps_letter(struct termp
*, char);
381 static void ps_pclose(struct termp
*);
382 static void ps_pletter(struct termp
*, int);
383 static void ps_printf(struct termp
*, const char *, ...);
384 static void ps_putchar(struct termp
*, char);
385 static void ps_setfont(struct termp
*, enum termfont
);
386 static struct termp
*pspdf_alloc(char *);
387 static void pdf_obj(struct termp
*, size_t);
391 pdf_alloc(char *outopts
)
395 if (NULL
!= (p
= pspdf_alloc(outopts
)))
396 p
->type
= TERMTYPE_PDF
;
403 ps_alloc(char *outopts
)
407 if (NULL
!= (p
= pspdf_alloc(outopts
)))
408 p
->type
= TERMTYPE_PS
;
414 static struct termp
*
415 pspdf_alloc(char *outopts
)
418 size_t pagex
, pagey
, marginx
, marginy
, lineheight
;
423 if (NULL
== (p
= term_alloc(TERMENC_ASCII
)))
426 p
->advance
= ps_advance
;
429 p
->endline
= ps_endline
;
431 p
->letter
= ps_letter
;
439 while (outopts
&& *outopts
)
440 switch (getsubopt(&outopts
, UNCONST(toks
), &v
)) {
448 /* Default to US letter (millimetres). */
454 * The ISO-269 paper sizes can be calculated automatically, but
455 * it would require bringing in -lm for pow() and I'd rather not
456 * do that. So just do it the easy way for now. Since this
457 * only happens once, I'm not terribly concerned.
460 if (pp
&& strcasecmp(pp
, "letter")) {
461 if (0 == strcasecmp(pp
, "a3")) {
464 } else if (0 == strcasecmp(pp
, "a4")) {
467 } else if (0 == strcasecmp(pp
, "a5")) {
470 } else if (0 == strcasecmp(pp
, "legal")) {
473 } else if (2 != sscanf(pp
, "%zux%zu", &pagex
, &pagey
))
474 fprintf(stderr
, "%s: Unknown paper\n", pp
);
475 } else if (NULL
== pp
)
479 * This MUST be defined before any PNT2AFM or AFM2PNT
480 * calculations occur.
483 p
->engine
.ps
.scale
= 11;
485 /* Remember millimetres -> AFM units. */
487 pagex
= PNT2AFM(p
, ((double)pagex
* 2.834));
488 pagey
= PNT2AFM(p
, ((double)pagey
* 2.834));
490 /* Margins are 1/9 the page x and y. */
492 marginx
= /* LINTED */
493 (size_t)((double)pagex
/ 9.0);
494 marginy
= /* LINTED */
495 (size_t)((double)pagey
/ 9.0);
497 /* Line-height is 1.4em. */
499 lineheight
= PNT2AFM(p
, ((double)p
->engine
.ps
.scale
* 1.4));
501 p
->engine
.ps
.width
= pagex
;
502 p
->engine
.ps
.height
= pagey
;
503 p
->engine
.ps
.header
= pagey
- (marginy
/ 2) - (lineheight
/ 2);
504 p
->engine
.ps
.top
= pagey
- marginy
;
505 p
->engine
.ps
.footer
= (marginy
/ 2) - (lineheight
/ 2);
506 p
->engine
.ps
.bottom
= marginy
;
507 p
->engine
.ps
.left
= marginx
;
508 p
->engine
.ps
.lineheight
= lineheight
;
510 p
->defrmargin
= pagex
- (marginx
* 2);
516 pspdf_free(void *arg
)
520 p
= (struct termp
*)arg
;
522 if (p
->engine
.ps
.psmarg
)
523 free(p
->engine
.ps
.psmarg
);
524 if (p
->engine
.ps
.pdfobjs
)
525 free(p
->engine
.ps
.pdfobjs
);
532 ps_printf(struct termp
*p
, const char *fmt
, ...)
540 * If we're running in regular mode, then pipe directly into
541 * vprintf(). If we're processing margins, then push the data
542 * into our growable margin buffer.
545 if ( ! (PS_MARGINS
& p
->engine
.ps
.flags
)) {
546 len
= vprintf(fmt
, ap
);
548 p
->engine
.ps
.pdfbytes
+= /* LINTED */
549 len
< 0 ? 0 : (size_t)len
;
554 * XXX: I assume that the in-margin print won't exceed
555 * PS_BUFSLOP (128 bytes), which is reasonable but still an
556 * assumption that will cause pukeage if it's not the case.
559 PS_GROWBUF(p
, PS_BUFSLOP
);
561 pos
= (int)p
->engine
.ps
.psmargcur
;
562 len
= vsnprintf(&p
->engine
.ps
.psmarg
[pos
], PS_BUFSLOP
, fmt
, ap
);
566 p
->engine
.ps
.psmargcur
= strlen(p
->engine
.ps
.psmarg
);
571 ps_putchar(struct termp
*p
, char c
)
575 /* See ps_printf(). */
577 if ( ! (PS_MARGINS
& p
->engine
.ps
.flags
)) {
579 p
->engine
.ps
.pdfbytes
++;
585 pos
= (int)p
->engine
.ps
.psmargcur
++;
586 p
->engine
.ps
.psmarg
[pos
++] = c
;
587 p
->engine
.ps
.psmarg
[pos
] = '\0';
592 pdf_obj(struct termp
*p
, size_t obj
)
597 if ((obj
- 1) >= p
->engine
.ps
.pdfobjsz
) {
598 p
->engine
.ps
.pdfobjsz
= obj
+ 128;
599 p
->engine
.ps
.pdfobjs
= realloc
600 (p
->engine
.ps
.pdfobjs
,
601 p
->engine
.ps
.pdfobjsz
* sizeof(size_t));
602 if (NULL
== p
->engine
.ps
.pdfobjs
) {
608 p
->engine
.ps
.pdfobjs
[(int)obj
- 1] = p
->engine
.ps
.pdfbytes
;
609 ps_printf(p
, "%zu 0 obj\n", obj
);
614 ps_closepage(struct termp
*p
)
620 * Close out a page that we've already flushed to output. In
621 * PostScript, we simply note that the page must be showed. In
622 * PDF, we must now create the Length, Resource, and Page node
623 * for the page contents.
626 assert(p
->engine
.ps
.psmarg
&& p
->engine
.ps
.psmarg
[0]);
627 ps_printf(p
, "%s", p
->engine
.ps
.psmarg
);
629 if (TERMTYPE_PS
!= p
->type
) {
630 ps_printf(p
, "ET\n");
632 len
= p
->engine
.ps
.pdfbytes
- p
->engine
.ps
.pdflastpg
;
633 base
= p
->engine
.ps
.pages
* 4 + p
->engine
.ps
.pdfbody
;
635 ps_printf(p
, "endstream\nendobj\n");
637 /* Length of content. */
638 pdf_obj(p
, base
+ 1);
639 ps_printf(p
, "%zu\nendobj\n", len
);
641 /* Resource for content. */
642 pdf_obj(p
, base
+ 2);
643 ps_printf(p
, "<<\n/ProcSet [/PDF /Text]\n");
644 ps_printf(p
, "/Font <<\n");
645 for (i
= 0; i
< (int)TERMFONT__MAX
; i
++)
646 ps_printf(p
, "/F%d %d 0 R\n", i
, 3 + i
);
647 ps_printf(p
, ">>\n>>\n");
650 pdf_obj(p
, base
+ 3);
651 ps_printf(p
, "<<\n");
652 ps_printf(p
, "/Type /Page\n");
653 ps_printf(p
, "/Parent 2 0 R\n");
654 ps_printf(p
, "/Resources %zu 0 R\n", base
+ 2);
655 ps_printf(p
, "/Contents %zu 0 R\n", base
);
656 ps_printf(p
, ">>\nendobj\n");
658 ps_printf(p
, "showpage\n");
660 p
->engine
.ps
.pages
++;
661 p
->engine
.ps
.psrow
= p
->engine
.ps
.top
;
662 assert( ! (PS_NEWPAGE
& p
->engine
.ps
.flags
));
663 p
->engine
.ps
.flags
|= PS_NEWPAGE
;
669 ps_end(struct termp
*p
)
671 size_t i
, xref
, base
;
674 * At the end of the file, do one last showpage. This is the
675 * same behaviour as groff(1) and works for multiple pages as
679 if ( ! (PS_NEWPAGE
& p
->engine
.ps
.flags
)) {
680 assert(0 == p
->engine
.ps
.flags
);
681 assert('\0' == p
->engine
.ps
.last
);
685 if (TERMTYPE_PS
== p
->type
) {
686 ps_printf(p
, "%%%%Trailer\n");
687 ps_printf(p
, "%%%%Pages: %zu\n", p
->engine
.ps
.pages
);
688 ps_printf(p
, "%%%%EOF\n");
693 ps_printf(p
, "<<\n/Type /Pages\n");
694 ps_printf(p
, "/MediaBox [0 0 %zu %zu]\n",
695 (size_t)AFM2PNT(p
, p
->engine
.ps
.width
),
696 (size_t)AFM2PNT(p
, p
->engine
.ps
.height
));
698 ps_printf(p
, "/Count %zu\n", p
->engine
.ps
.pages
);
699 ps_printf(p
, "/Kids [");
701 for (i
= 0; i
< p
->engine
.ps
.pages
; i
++)
702 ps_printf(p
, " %zu 0 R", i
* 4 +
703 p
->engine
.ps
.pdfbody
+ 3);
705 base
= (p
->engine
.ps
.pages
- 1) * 4 +
706 p
->engine
.ps
.pdfbody
+ 4;
708 ps_printf(p
, "]\n>>\nendobj\n");
710 ps_printf(p
, "<<\n");
711 ps_printf(p
, "/Type /Catalog\n");
712 ps_printf(p
, "/Pages 2 0 R\n");
713 ps_printf(p
, ">>\n");
714 xref
= p
->engine
.ps
.pdfbytes
;
715 ps_printf(p
, "xref\n");
716 ps_printf(p
, "0 %zu\n", base
+ 1);
717 ps_printf(p
, "0000000000 65535 f \n");
719 for (i
= 0; i
< base
; i
++)
720 ps_printf(p
, "%.10zu 00000 n \n",
721 p
->engine
.ps
.pdfobjs
[(int)i
]);
723 ps_printf(p
, "trailer\n");
724 ps_printf(p
, "<<\n");
725 ps_printf(p
, "/Size %zu\n", base
+ 1);
726 ps_printf(p
, "/Root %zu 0 R\n", base
);
727 ps_printf(p
, "/Info 1 0 R\n");
728 ps_printf(p
, ">>\n");
729 ps_printf(p
, "startxref\n");
730 ps_printf(p
, "%zu\n", xref
);
731 ps_printf(p
, "%%%%EOF\n");
736 ps_begin(struct termp
*p
)
742 * Print margins into margin buffer. Nothing gets output to the
743 * screen yet, so we don't need to initialise the primary state.
746 if (p
->engine
.ps
.psmarg
) {
747 assert(p
->engine
.ps
.psmargsz
);
748 p
->engine
.ps
.psmarg
[0] = '\0';
751 /*p->engine.ps.pdfbytes = 0;*/
752 p
->engine
.ps
.psmargcur
= 0;
753 p
->engine
.ps
.flags
= PS_MARGINS
;
754 p
->engine
.ps
.pscol
= p
->engine
.ps
.left
;
755 p
->engine
.ps
.psrow
= p
->engine
.ps
.header
;
757 ps_setfont(p
, TERMFONT_NONE
);
759 (*p
->headf
)(p
, p
->argf
);
762 p
->engine
.ps
.pscol
= p
->engine
.ps
.left
;
763 p
->engine
.ps
.psrow
= p
->engine
.ps
.footer
;
765 (*p
->footf
)(p
, p
->argf
);
768 p
->engine
.ps
.flags
&= ~PS_MARGINS
;
770 assert(0 == p
->engine
.ps
.flags
);
771 assert(p
->engine
.ps
.psmarg
);
772 assert('\0' != p
->engine
.ps
.psmarg
[0]);
775 * Print header and initialise page state. Following this,
776 * stuff gets printed to the screen, so make sure we're sane.
781 if (TERMTYPE_PS
== p
->type
) {
782 ps_printf(p
, "%%!PS-Adobe-3.0\n");
783 ps_printf(p
, "%%%%Creator: mandoc-%s\n", VERSION
);
784 ps_printf(p
, "%%%%CreationDate: %s", ctime(&t
));
785 ps_printf(p
, "%%%%DocumentData: Clean7Bit\n");
786 ps_printf(p
, "%%%%Orientation: Portrait\n");
787 ps_printf(p
, "%%%%Pages: (atend)\n");
788 ps_printf(p
, "%%%%PageOrder: Ascend\n");
789 ps_printf(p
, "%%%%DocumentMedia: "
790 "Default %zu %zu 0 () ()\n",
791 (size_t)AFM2PNT(p
, p
->engine
.ps
.width
),
792 (size_t)AFM2PNT(p
, p
->engine
.ps
.height
));
793 ps_printf(p
, "%%%%DocumentNeededResources: font");
795 for (i
= 0; i
< (int)TERMFONT__MAX
; i
++)
796 ps_printf(p
, " %s", fonts
[i
].name
);
798 ps_printf(p
, "\n%%%%EndComments\n");
800 ps_printf(p
, "%%PDF-1.1\n");
802 ps_printf(p
, "<<\n");
803 ps_printf(p
, "/Creator mandoc-%s\n", VERSION
);
804 ps_printf(p
, ">>\n");
805 ps_printf(p
, "endobj\n");
807 for (i
= 0; i
< (int)TERMFONT__MAX
; i
++) {
808 pdf_obj(p
, (size_t)i
+ 3);
809 ps_printf(p
, "<<\n");
810 ps_printf(p
, "/Type /Font\n");
811 ps_printf(p
, "/Subtype /Type1\n");
812 ps_printf(p
, "/Name /F%zu\n", i
);
813 ps_printf(p
, "/BaseFont /%s\n", fonts
[i
].name
);
814 ps_printf(p
, ">>\n");
818 p
->engine
.ps
.pdfbody
= (size_t)TERMFONT__MAX
+ 3;
819 p
->engine
.ps
.pscol
= p
->engine
.ps
.left
;
820 p
->engine
.ps
.psrow
= p
->engine
.ps
.top
;
821 p
->engine
.ps
.flags
|= PS_NEWPAGE
;
822 ps_setfont(p
, TERMFONT_NONE
);
827 ps_pletter(struct termp
*p
, int c
)
832 * If we haven't opened a page context, then output that we're
833 * in a new page and make sure the font is correctly set.
836 if (PS_NEWPAGE
& p
->engine
.ps
.flags
) {
837 if (TERMTYPE_PS
== p
->type
) {
838 ps_printf(p
, "%%%%Page: %zu %zu\n",
839 p
->engine
.ps
.pages
+ 1,
840 p
->engine
.ps
.pages
+ 1);
841 ps_printf(p
, "/%s %zu selectfont\n",
842 fonts
[(int)p
->engine
.ps
.lastf
].name
,
845 pdf_obj(p
, p
->engine
.ps
.pdfbody
+
846 p
->engine
.ps
.pages
* 4);
847 ps_printf(p
, "<<\n");
848 ps_printf(p
, "/Length %zu 0 R\n",
849 p
->engine
.ps
.pdfbody
+ 1 +
850 p
->engine
.ps
.pages
* 4);
851 ps_printf(p
, ">>\nstream\n");
853 p
->engine
.ps
.pdflastpg
= p
->engine
.ps
.pdfbytes
;
854 p
->engine
.ps
.flags
&= ~PS_NEWPAGE
;
858 * If we're not in a PostScript "word" context, then open one
859 * now at the current cursor.
862 if ( ! (PS_INLINE
& p
->engine
.ps
.flags
)) {
863 if (TERMTYPE_PS
!= p
->type
) {
864 ps_printf(p
, "BT\n/F%d %zu Tf\n",
865 (int)p
->engine
.ps
.lastf
,
867 ps_printf(p
, "%.3f %.3f Td\n(",
868 AFM2PNT(p
, p
->engine
.ps
.pscol
),
869 AFM2PNT(p
, p
->engine
.ps
.psrow
));
871 ps_printf(p
, "%.3f %.3f moveto\n(",
872 AFM2PNT(p
, p
->engine
.ps
.pscol
),
873 AFM2PNT(p
, p
->engine
.ps
.psrow
));
874 p
->engine
.ps
.flags
|= PS_INLINE
;
877 assert( ! (PS_NEWPAGE
& p
->engine
.ps
.flags
));
880 * We need to escape these characters as per the PostScript
881 * specification. We would also escape non-graphable characters
882 * (like tabs), but none of them would get to this point and
883 * it's superfluous to abort() on them.
898 /* Write the character and adjust where we are on the page. */
900 f
= (int)p
->engine
.ps
.lastf
;
902 if (c
<= 32 || (c
- 32 > MAXCHAR
)) {
904 p
->engine
.ps
.pscol
+= (size_t)fonts
[f
].gly
[0].wx
;
908 ps_putchar(p
, (char)c
);
910 p
->engine
.ps
.pscol
+= (size_t)fonts
[f
].gly
[c
].wx
;
915 ps_pclose(struct termp
*p
)
919 * Spit out that we're exiting a word context (this is a
920 * "partial close" because we don't check the last-char buffer
924 if ( ! (PS_INLINE
& p
->engine
.ps
.flags
))
927 if (TERMTYPE_PS
!= p
->type
) {
928 ps_printf(p
, ") Tj\nET\n");
930 ps_printf(p
, ") show\n");
932 p
->engine
.ps
.flags
&= ~PS_INLINE
;
937 ps_fclose(struct termp
*p
)
941 * Strong closure: if we have a last-char, spit it out after
942 * checking that we're in the right font mode. This will of
943 * course open a new scope, if applicable.
945 * Following this, close out any scope that's open.
948 if ('\0' != p
->engine
.ps
.last
) {
949 if (p
->engine
.ps
.lastf
!= TERMFONT_NONE
) {
951 ps_setfont(p
, TERMFONT_NONE
);
953 ps_pletter(p
, p
->engine
.ps
.last
);
954 p
->engine
.ps
.last
= '\0';
957 if ( ! (PS_INLINE
& p
->engine
.ps
.flags
))
965 ps_letter(struct termp
*p
, char c
)
970 * State machine dictates whether to buffer the last character
971 * or not. Basically, encoded words are detected by checking if
972 * we're an "8" and switching on the buffer. Then we put "8" in
973 * our buffer, and on the next charater, flush both character
974 * and buffer. Thus, "regular" words are detected by having a
975 * regular character and a regular buffer character.
978 if ('\0' == p
->engine
.ps
.last
) {
980 p
->engine
.ps
.last
= c
;
982 } else if (8 == p
->engine
.ps
.last
) {
984 p
->engine
.ps
.last
= '\0';
986 assert(8 != p
->engine
.ps
.last
);
987 if ('_' == p
->engine
.ps
.last
) {
988 if (p
->engine
.ps
.lastf
!= TERMFONT_UNDER
) {
990 ps_setfont(p
, TERMFONT_UNDER
);
992 } else if (p
->engine
.ps
.lastf
!= TERMFONT_BOLD
) {
994 ps_setfont(p
, TERMFONT_BOLD
);
996 p
->engine
.ps
.last
= c
;
999 if (p
->engine
.ps
.lastf
!= TERMFONT_NONE
) {
1001 ps_setfont(p
, TERMFONT_NONE
);
1003 cc
= p
->engine
.ps
.last
;
1004 p
->engine
.ps
.last
= c
;
1013 ps_advance(struct termp
*p
, size_t len
)
1017 * Advance some spaces. This can probably be made smarter,
1018 * i.e., to have multiple space-separated words in the same
1019 * scope, but this is easier: just close out the current scope
1020 * and readjust our column settings.
1024 p
->engine
.ps
.pscol
+= len
;
1029 ps_endline(struct termp
*p
)
1032 /* Close out any scopes we have open: we're at eoln. */
1037 * If we're in the margin, don't try to recalculate our current
1038 * row. XXX: if the column tries to be fancy with multiple
1039 * lines, we'll do nasty stuff.
1042 if (PS_MARGINS
& p
->engine
.ps
.flags
)
1047 p
->engine
.ps
.pscol
= p
->engine
.ps
.left
;
1049 /* If we haven't printed anything, return. */
1051 if (PS_NEWPAGE
& p
->engine
.ps
.flags
)
1055 * Put us down a line. If we're at the page bottom, spit out a
1056 * showpage and restart our row.
1059 if (p
->engine
.ps
.psrow
>= p
->engine
.ps
.lineheight
+
1060 p
->engine
.ps
.bottom
) {
1061 p
->engine
.ps
.psrow
-= p
->engine
.ps
.lineheight
;
1070 ps_setfont(struct termp
*p
, enum termfont f
)
1073 assert(f
< TERMFONT__MAX
);
1074 p
->engine
.ps
.lastf
= f
;
1077 * If we're still at the top of the page, let the font-setting
1078 * be delayed until we actually have stuff to print.
1081 if (PS_NEWPAGE
& p
->engine
.ps
.flags
)
1084 if (TERMTYPE_PS
== p
->type
)
1085 ps_printf(p
, "/%s %zu selectfont\n",
1087 p
->engine
.ps
.scale
);
1089 ps_printf(p
, "/F%d %zu Tf\n",
1091 p
->engine
.ps
.scale
);
1097 ps_width(const struct termp
*p
, char c
)
1100 if (c
<= 32 || c
- 32 >= MAXCHAR
)
1101 return((size_t)fonts
[(int)TERMFONT_NONE
].gly
[0].wx
);
1104 return((size_t)fonts
[(int)TERMFONT_NONE
].gly
[(int)c
].wx
);
1109 ps_hspan(const struct termp
*p
, const struct roffsu
*su
)
1114 * All of these measurements are derived by converting from the
1115 * native measurement to AFM units.
1120 r
= PNT2AFM(p
, su
->scale
* 28.34);
1123 r
= PNT2AFM(p
, su
->scale
* 72);
1126 r
= PNT2AFM(p
, su
->scale
* 12);
1129 r
= PNT2AFM(p
, su
->scale
* 100);
1133 fonts
[(int)TERMFONT_NONE
].gly
[109 - 32].wx
;
1136 r
= PNT2AFM(p
, su
->scale
* 2.834);
1140 fonts
[(int)TERMFONT_NONE
].gly
[110 - 32].wx
;
1143 r
= su
->scale
* p
->engine
.ps
.lineheight
;