Imported Upstream version 1.22.3
[platform/upstream/groff.git] / src / devices / grops / grops.1.man
1 .TH GROPS @MAN1EXT@ "@MDATE@" "groff @VERSION@"
2 .SH NAME
3 grops \- PostScript driver for groff
4 .
5 .
6 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
7 .do nr grops_C \n[.C]
8 .cp 0
9 .
10 .
11 .\" ====================================================================
12 .\" Legal Terms
13 .\" ====================================================================
14 .\"
15 .\" Copyright (C) 1989-2018 Free Software Foundation, Inc.
16 .\"
17 .\" Permission is granted to make and distribute verbatim copies of this
18 .\" manual provided the copyright notice and this permission notice are
19 .\" preserved on all copies.
20 .\"
21 .\" Permission is granted to copy and distribute modified versions of
22 .\" this manual under the conditions for verbatim copying, provided that
23 .\" the entire resulting derived work is distributed under the terms of
24 .\" a permission notice identical to this one.
25 .\"
26 .\" Permission is granted to copy and distribute translations of this
27 .\" manual into another language, under the above conditions for
28 .\" modified versions, except that this permission notice may be
29 .\" included in translations approved by the Free Software Foundation
30 .\" instead of in the original English.
31 .
32 .
33 .de FT
34 .  if '\\*(.T'ps' .ft \\$1
35 .  if '\\*(.T'pdf' .ft \\$1
36 ..
37 .
38 .\" ====================================================================
39 .SH SYNOPSIS
40 .\" ====================================================================
41 .
42 .SY grops
43 .OP \-glmv
44 .OP \-b n
45 .OP \-c n
46 .OP \-F dir
47 .OP \-I dir
48 .OP \-p papersize
49 .OP \-P prologue
50 .OP \-w n
51 .RI [ file
52 \&.\|.\|.\&]
53 .YS
54 .
55 .
56 .\" ====================================================================
57 .SH DESCRIPTION
58 .\" ====================================================================
59 .
60 .B grops
61 translates the output of GNU
62 .B troff
63 to PostScript.
64 .
65 Normally
66 .B grops
67 should be invoked by using the groff command with a
68 .B \-Tps
69 option.
70 .
71 .if '@DEVICE@'ps' (Actually, this is the default for groff.)
72 .
73 If no files are given,
74 .B grops
75 reads the standard input.
76 .
77 A filename of
78 .B \-
79 also causes
80 .B grops
81 to read the standard input.
82 .
83 PostScript output is written to the standard output.
84 .
85 When
86 .B grops
87 is run by
88 .B groff
89 options can be passed to
90 .B grops
91 using
92 .BR groff 's
93 .B \-P
94 option.
95 .
96 .
97 .LP
98 Note that
99 .B grops
100 doesn't produce a valid document structure (conforming to the
101 Document Structuring Convention) if called with multiple file
102 arguments.
103 .
104 To print such concatenated output it is necessary to deactivate DSC
105 handling in the printing program or previewer.
106 .
107 See section \[lq]Font Installation\[rq] below for a guide how to install
108 fonts for
109 .BR grops .
110 .
111 .
112 .\" ====================================================================
113 .SH OPTIONS
114 .\" ====================================================================
115 .
116 Whitespace is permitted between a command-line option and its argument.
117 .
118 .
119 .TP
120 .BI \-b n
121 Provide workarounds for older printers, broken spoolers, and previewers.
122 .
123 Normally
124 .B grops
125 produces output at PostScript LanguageLevel\~2 that conforms to the
126 Document Structuring Conventions version 3.0.
127 .
128 Some older printers, spoolers, and previewers can't handle such
129 output.
130 .
131 The value of\~\c
132 .I n
133 controls what
134 .B grops
135 does to make its output acceptable to such programs.
136 .
137 A value of\~0 causes grops not to employ any workarounds.
138 .
139 .IP
140 Add\~1 if no
141 .B %%Begin\%Document\%Setup
142 and
143 .B %%End\%Document\%Setup
144 comments should be generated;
145 this is needed for early versions of TranScript that get confused by
146 anything between the
147 .B %%End\%Prolog
148 comment and the first
149 .B %%Page
150 comment.
151 .
152 .IP
153 Add\~2 if lines in included files beginning with
154 .B %!\&
155 should be stripped out; this is needed for Sun's pageview
156 previewer.
157 .
158 .IP
159 Add\~4 if
160 .BR %%Page ,
161 .B %%Trailer
162 and
163 .B %%End\%Prolog
164 comments should be
165 stripped out of included files; this is needed for spoolers that
166 don't understand the
167 .B %%Begin\%Document
168 and
169 .B %%End\%Document
170 comments.
171 .
172 .IP
173 Add\~8 if the first line of the PostScript output should be
174 .B %!PS-Adobe-2.0
175 rather than
176 .BR %!PS-Adobe-3.0 ;
177 this is needed when using Sun's Newsprint with a printer that
178 requires page reversal.
179 .
180 .IP
181 Add\~16 if no media size information should be included in the
182 document (this is, neither use
183 .B %%Document\%Media
184 nor the
185 .B setpagedevice
186 PostScript command).
187 .
188 This was the behaviour of groff version 1.18.1 and earlier; it is
189 needed for older printers which don't understand PostScript
190 LanguageLevel\~2.
191 .
192 It is also necessary if the output is further processed to get an
193 encapsulated PS (EPS) file \[en] see below.
194 .
195 .IP
196 The default value can be specified by a
197 .
198 .RS
199 .IP
200 .BI broken\  n
201 .
202 .LP
203 command in the
204 .I DESC
205 file.
206 .
207 Otherwise the default value is\~0.
208 .RE
209 .
210 .TP
211 .BI \-c n
212 Print
213 .I n
214 copies of each page.
215 .
216 .TP
217 .BI \-F dir
218 Prepend directory
219 .RI dir /dev name
220 to the search path for prologue, font, and device description files;
221 .I name
222 is the name of the device, usually
223 .BR ps .
224 .
225 .TP
226 .B \-g
227 Guess the page length.
228 .
229 This generates PostScript code that guesses the page length.
230 .
231 The guess is correct only if the imageable area is vertically
232 centered on the page.
233 .
234 This option allows you to generate documents that can be printed
235 both on letter (8.5\[mu]11) paper and on A4 paper without change.
236 .
237 .TP
238 .BI \-I dir
239 This option may be used to add a directory to the search path for
240 files on the command line and files named in
241 .B \[rs]X'ps: import'
242 and
243 .B \[rs]X'ps: file'
244 escapes.
245 .
246 The search path is initialized with the current directory.
247 .
248 This option may be specified more than once; the directories are then
249 searched in the order specified (but before the current directory).
250 .
251 If you want to make the current directory be read before other directories,
252 add
253 .B \-I.\&
254 at the appropriate place.
255 .
256 .IP
257 No directory search is performed for files with an absolute file name.
258 .
259 .TP
260 .B \-l
261 Print the document in landscape format.
262 .
263 .TP
264 .B \-m
265 Turn manual feed on for the document.
266 .
267 .TP
268 .BI \-p paper-size
269 Set physical dimension of output medium.
270 .
271 This overrides the
272 .BR papersize ,
273 .BR paperlength ,
274 and
275 .B paperwidth
276 commands in the
277 .I DESC
278 file; it accepts the same arguments as the
279 .B papersize
280 command.
281 .
282 See
283 .B groff_font (@MAN5EXT@)
284 for details.
285 .
286 .TP
287 .BI \-P prologue-file
288 Use the file
289 .I prologue-file
290 (in the font path) as the prologue instead of the default prologue file
291 .BR prologue .
292 .
293 This option overrides the environment variable
294 .I GROPS_PROLOGUE.
295 .
296 .TP
297 .BI \-w n
298 Lines should be drawn using a thickness of
299 .IR n \~\c
300 thousandths of an em.
301 .
302 If this option is not given, the line thickness defaults to 0.04\~em.
303 .
304 .TP
305 .B \-v
306 Print the version number.
307 .
308 .
309 .\" ====================================================================
310 .SH USAGE
311 .\" ====================================================================
312 .
313 The input to
314 .B grops
315 must be in the format output by
316 .BR @g@troff (@MAN1EXT@).
317 .
318 This is described in
319 .BR groff_out (@MAN5EXT@).
320 .
321 .LP
322 In addition, the device and font description files for the device used
323 must meet certain requirements:
324 .
325 The resolution must be an integer multiple of\~72 times the
326 .BR sizescale .
327 .
328 The
329 .B ps
330 device uses a resolution of 72000 and a sizescale of 1000.
331 .
332 .
333 .LP
334 The device description file must contain a valid paper size; see
335 .BR groff_font (@MAN5EXT@)
336 for more information.
337 .
338 .
339 .LP
340 Each font description file must contain a command
341 .IP
342 .BI internalname\  psname
343 .LP
344 which says that the PostScript name of the font is
345 .IR psname .
346 .
347 It may also contain a command
348 .IP
349 .BI encoding\  enc_file
350 .LP
351 which says that
352 the PostScript font should be reencoded using the encoding described in
353 .IR enc_file ;
354 this file should consist of a sequence of lines of the form:
355 .IP
356 .I
357 pschar code
358 .LP
359 where
360 .I pschar
361 is the PostScript name of the character,
362 and
363 .I code
364 is its position in the encoding expressed as a decimal integer; valid
365 values are in the range 0 to\~255.
366 .
367 Lines starting with
368 .B #
369 and blank lines are ignored.
370 .
371 The code for each character given in the font file must correspond
372 to the code for the character in encoding file, or to the code in the default
373 encoding for the font if the PostScript font is not to be reencoded.
374 .
375 This code can be used with the
376 .B \[rs]N
377 escape sequence in
378 .B troff
379 to select the character,
380 even if the character does not have a groff name.
381 .
382 Every character in the font file must exist in the PostScript font, and
383 the widths given in the font file must match the widths used
384 in the PostScript font.
385 .
386 .B grops
387 assumes that a character with a groff name of
388 .B space
389 is blank (makes no marks on the page);
390 it can make use of such a character to generate more efficient and
391 compact PostScript output.
392 .
393 .
394 .LP
395 Note that
396 .B grops
397 is able to display all glyphs in a PostScript font, not only 256.
398 .I enc_file
399 (or the default encoding if no encoding file specified) just defines the
400 order of glyphs for the first 256 characters; all other glyphs are
401 accessed with additional encoding vectors which
402 .B grops
403 produces on the fly.
404 .
405 .
406 .LP
407 .B grops
408 can automatically include the downloadable fonts necessary
409 to print the document.
410 .
411 Such fonts must be in PFA format.
412 .
413 Use
414 .BR \%pfbtops (@MAN1EXT@)
415 to convert a Type\~1 font in PFB format.
416 .
417 Any downloadable fonts which should, when required, be included by
418 .B grops
419 must be listed in the file
420 .IR @FONTDIR@/devps/download ;
421 this should consist of lines of the form
422 .
423 .IP
424 .I
425 font filename
426 .
427 .
428 .LP
429 where
430 .I font
431 is the PostScript name of the font,
432 and
433 .I filename
434 is the name of the file containing the font;
435 lines beginning with
436 .B #
437 and blank lines are ignored;
438 fields may be separated by tabs or spaces;
439 .I filename
440 is searched for using the same mechanism that is used
441 for groff font metric files.
442 .
443 The
444 .I download
445 file itself is also searched for using this mechanism;
446 currently, only the first found file in the font path is used.
447 .
448 .
449 .LP
450 If the file containing a downloadable font or imported document
451 conforms to the Adobe Document Structuring Conventions,
452 then
453 .B grops
454 interprets any comments in the files sufficiently to ensure that its
455 own output is conforming.
456 .
457 It also supplies any needed font resources that are listed in the
458 .I download
459 file
460 as well as any needed file resources.
461 .
462 It is also able to handle inter-resource dependencies.
463 .
464 For example, suppose that you have a downloadable font called
465 Garamond, and also a downloadable font called Garamond-Outline which
466 depends on Garamond (typically it would be defined to copy
467 Garamond's font dictionary, and change the PaintType), then it is
468 necessary for Garamond to appear before Garamond-Outline in the
469 PostScript document.
470 .
471 .B grops
472 handles this automatically provided that the downloadable font file
473 for Garamond-Outline indicates its dependence on Garamond by means of
474 the Document Structuring Conventions, for example by beginning with
475 the following lines
476 .
477 .IP
478 .B
479 %!PS-Adobe-3.0 Resource-Font
480 .br
481 .B
482 %%DocumentNeededResources: font Garamond
483 .br
484 .B
485 %%EndComments
486 .br
487 .B
488 %%IncludeResource: font Garamond
489 .
490 .
491 .LP
492 In this case both Garamond and Garamond-Outline would need to be listed
493 in the
494 .I download
495 file.
496 .
497 A downloadable font should not include its own name in a
498 .B %%Document\%Supplied\%Resources
499 comment.
500 .
501 .
502 .LP
503 .B grops
504 does not interpret
505 .B %%Document\%Fonts
506 comments.
507 .
508 The
509 .BR %%Document\%Needed\%Resources ,
510 .BR %%Document\%Supplied\%Resources ,
511 .BR %%Include\%Resource ,
512 .BR %%Begin\%Resource ,
513 and
514 .B %%End\%Resource
515 comments
516 (or possibly the old
517 .BR %%Document\%Needed\%Fonts ,
518 .BR %%Document\%Supplied\%Fonts ,
519 .BR %%Include\%Font ,
520 .BR %%Begin\%Font ,
521 and
522 .B %%End\%Font
523 comments)
524 should be used.
525 .
526 .
527 .LP
528 In the default setup
529 there are styles called
530 .BR R ,
531 .BR I ,
532 .BR B ,
533 and
534 .B BI
535 mounted at font positions 1 to\~4.
536 .
537 The fonts are grouped into families
538 .BR A ,
539 .BR BM ,
540 .BR C ,
541 .BR H ,
542 .BR HN ,
543 .BR N ,
544 .BR P ,
545 and\~\c
546 .B T
547 having members in each of these styles:
548 .
549 .RS
550 .TP
551 .B AR
552 .FT AR
553 AvantGarde-Book
554 .FT
555 .
556 .TQ
557 .B AI
558 .FT AI
559 AvantGarde-BookOblique
560 .FT
561 .
562 .TQ
563 .B AB
564 .FT AB
565 AvantGarde-Demi
566 .FT
567 .
568 .TQ
569 .B ABI
570 .FT ABI
571 AvantGarde-DemiOblique
572 .FT
573 .
574 .TQ
575 .B BMR
576 .FT BMR
577 Bookman-Light
578 .FT
579 .
580 .TQ
581 .B BMI
582 .FT BMI
583 Bookman-LightItalic
584 .FT
585 .
586 .TQ
587 .B BMB
588 .FT BMB
589 Bookman-Demi
590 .FT
591 .
592 .TQ
593 .B BMBI
594 .FT BMBI
595 Bookman-DemiItalic
596 .FT
597 .
598 .TQ
599 .B CR
600 .FT CR
601 Courier
602 .FT
603 .
604 .TQ
605 .B CI
606 .FT CI
607 Courier-Oblique
608 .FT
609 .
610 .TQ
611 .B CB
612 .FT CB
613 Courier-Bold
614 .FT
615 .
616 .TQ
617 .B CBI
618 .FT CBI
619 Courier-BoldOblique
620 .FT
621 .
622 .TQ
623 .B HR
624 .FT HR
625 Helvetica
626 .FT
627 .
628 .TQ
629 .B HI
630 .FT HI
631 Helvetica-Oblique
632 .FT
633 .
634 .TQ
635 .B HB
636 .FT HB
637 Helvetica-Bold
638 .FT
639 .
640 .TQ
641 .B HBI
642 .FT HBI
643 Helvetica-BoldOblique
644 .FT
645 .
646 .TQ
647 .B HNR
648 .FT HNR
649 Helvetica-Narrow
650 .FT
651 .
652 .TQ
653 .B HNI
654 .FT HNI
655 Helvetica-Narrow-Oblique
656 .FT
657 .
658 .TQ
659 .B HNB
660 .FT HNB
661 Helvetica-Narrow-Bold
662 .FT
663 .
664 .TQ
665 .B HNBI
666 .FT HNBI
667 Helvetica-Narrow-BoldOblique
668 .FT
669 .
670 .TQ
671 .B NR
672 .FT NR
673 NewCenturySchlbk-Roman
674 .FT
675 .
676 .TQ
677 .B NI
678 .FT NI
679 NewCenturySchlbk-Italic
680 .FT
681 .
682 .TQ
683 .B NB
684 .FT NB
685 NewCenturySchlbk-Bold
686 .FT
687 .
688 .TQ
689 .B NBI
690 .FT NBI
691 NewCenturySchlbk-BoldItalic
692 .FT
693 .
694 .TQ
695 .B PR
696 .FT PR
697 Palatino-Roman
698 .FT
699 .
700 .TQ
701 .B PI
702 .FT PI
703 Palatino-Italic
704 .FT
705 .
706 .TQ
707 .B PB
708 .FT PB
709 Palatino-Bold
710 .FT
711 .
712 .TQ
713 .B PBI
714 .FT PBI
715 Palatino-BoldItalic
716 .FT
717 .
718 .TQ
719 .B TR
720 .FT TR
721 Times-Roman
722 .FT
723 .
724 .TQ
725 .B TI
726 .FT TI
727 Times-Italic
728 .FT
729 .
730 .TQ
731 .B TB
732 .FT TB
733 Times-Bold
734 .FT
735 .
736 .TQ
737 .B TBI
738 .FT TBI
739 Times-BoldItalic
740 .FT
741 .RE
742 .
743 .
744 .LP
745 There is also the following font which is not a member of a family:
746 .
747 .RS
748 .TP
749 .B ZCMI
750 .FT ZCMI
751 ZapfChancery-MediumItalic
752 .FT
753 .RE
754 .
755 .
756 .LP
757 There are also some special fonts called
758 .B S
759 for the PS Symbol font, and
760 .BR SS ,
761 containing slanted lowercase Greek letters taken from PS Symbol.
762 .
763 Zapf Dingbats is available as
764 .BR ZD ,
765 and a reversed version of ZapfDingbats (with symbols pointing in the opposite
766 direction) is available as
767 .BR ZDR ;
768 most characters in these fonts are unnamed and must be accessed using
769 .BR \[rs]N .
770 .
771 .
772 .LP
773 The default color for
774 .B \[rs]m
775 and
776 .B \[rs]M
777 is black; for colors defined in the \[oq]rgb\[cq] color space
778 .B setrgbcolor
779 is used, for \[oq]cmy\[cq] and \[oq]cmyk\[cq]
780 .BR setcmykcolor ,
781 and for \[oq]gray\[cq]
782 .BR setgray .
783 .
784 Note that
785 .B setcmykcolor
786 is a PostScript LanguageLevel\~2 command and thus not available on some
787 older printers.
788 .
789 .
790 .LP
791 .B grops
792 understands various X\~commands produced using the
793 .B \[rs]X
794 escape sequence;
795 .B grops
796 only interprets commands that begin with a
797 .B ps:
798 tag.
799 .
800 .TP
801 .BI \[rs]X'ps:\ exec\  code '
802 This executes the arbitrary PostScript commands in
803 .IR code .
804 .
805 The PostScript currentpoint is set to the position of the
806 .B \[rs]X
807 command before executing
808 .IR code .
809 .
810 The origin is at the top left corner of the page,
811 and y\~coordinates increase down the page.
812 .
813 A procedure\~\c
814 .B u
815 is defined that converts groff units to the coordinate system in
816 effect (provided the user doesn't change the scale).
817 .
818 For example,
819 .
820 .RS
821 .IP
822 .B
823 \&.nr x 1i
824 .br
825 .B
826 \[rs]X'ps: exec \[rs]nx u 0 rlineto stroke'
827 .br
828 .RE
829 .
830 .IP
831 draws a horizontal line one inch long.
832 .
833 .I code
834 may make changes to the graphics state,
835 but any changes persist only to the end of the page.
836 .
837 A dictionary containing the definitions specified by the
838 .B def
839 and
840 .B mdef
841 is on top of the dictionary stack.
842 .
843 If your code adds definitions to this dictionary,
844 you should allocate space for them using
845 .BI \[rs]X'ps\ mdef \ n '\fR.
846 .
847 Any definitions persist only until the end of the page.
848 .
849 If you use the
850 .B \[rs]Y
851 escape sequence with an argument that names a macro,
852 .I code
853 can extend over multiple lines.
854 .
855 For example,
856 .
857 .RS
858 .IP
859 .nf
860 .ft B
861 \&.nr x 1i
862 \&.de y
863 \&ps: exec
864 \&\[rs]nx u 0 rlineto
865 \&stroke
866 \&..
867 \&\[rs]Yy
868 .ft R
869 .fi
870 .
871 .LP
872 is another way to draw a horizontal line one inch long.
873 .
874 Note the single backslash before \[oq]nx\[cq] \[en] the only reason to
875 use a number register while defining the macro \[oq]y\[cq] is to
876 convert a user-specified dimension \[oq]1i\[cq] to internal groff
877 units which are in turn converted to PS units with the
878 .B u
879 procedure.
880 .
881 .
882 .LP
883 .B grops
884 wraps user-specified PostScript code into a dictionary, nothing more.
885 .
886 In particular, it doesn't start and end the inserted code with
887 .B save
888 and
889 .BR restore ,
890 respectively.
891 .
892 This must be supplied by the user, if necessary.
893 .
894 .RE
895 .
896 .TP
897 .BI \[rs]X'ps:\ file\  name '
898 This is the same as the
899 .B exec
900 command except that the PostScript code is read from file
901 .IR name .
902 .
903 .TP
904 .BI \[rs]X'ps:\ def\  code '
905 Place a PostScript definition contained in
906 .I code
907 in the prologue.
908 .
909 There should be at most one definition per
910 .B \[rs]X
911 command.
912 .
913 Long definitions can be split over several
914 .B \[rs]X
915 commands;
916 all the
917 .I code
918 arguments are simply joined together separated by newlines.
919 .
920 The definitions are placed in a dictionary which is automatically
921 pushed on the dictionary stack when an
922 .B exec
923 command is executed.
924 .
925 If you use the
926 .B \[rs]Y
927 escape sequence with an argument that names a macro,
928 .I code
929 can extend over multiple lines.
930 .
931 .TP
932 .BI \[rs]X'ps:\ mdef\  n\ code  '
933 Like
934 .BR def ,
935 except that
936 .I code
937 may contain up to
938 .IR n \~\c
939 definitions.
940 .
941 .B grops
942 needs to know how many definitions
943 .I code
944 contains
945 so that it can create an appropriately sized PostScript dictionary
946 to contain them.
947 .
948 .TP
949 .BI \[rs]X'ps:\ import\  file\ llx\ lly\ urx\ ury\ width\ \fR[\fP\ height\ \fR]\fP '
950 Import a PostScript graphic from
951 .IR file .
952 .
953 The arguments
954 .IR llx ,
955 .IR lly ,
956 .IR urx ,
957 and
958 .I ury
959 give the bounding box of the graphic in the default PostScript
960 coordinate system; they should all be integers;
961 .I llx
962 and
963 .I lly
964 are the x and y\~coordinates of the lower left
965 corner of the graphic;
966 .I urx
967 and
968 .I ury
969 are the x and y\~coordinates of the upper right corner of the graphic;
970 .I width
971 and
972 .I height
973 are integers that give the desired width and height in groff
974 units of the graphic.
975 .
976 .IP
977 The graphic is scaled so that it has this width and height
978 and translated so that the lower left corner of the graphic is
979 located at the position associated with
980 .B \[rs]X
981 command.
982 .
983 If the height argument is omitted it is scaled uniformly in the
984 x and y\~directions so that it has the specified width.
985 .
986 .IP
987 Note that the contents of the
988 .B \[rs]X
989 command are not interpreted by
990 .BR troff ;
991 so vertical space for the graphic is not automatically added,
992 and the
993 .I width
994 and
995 .I height
996 arguments are not allowed to have attached scaling indicators.
997 .
998 .IP
999 If the PostScript file complies with the Adobe Document Structuring
1000 Conventions and contains a
1001 .B %%Bounding\%Box
1002 comment, then the bounding box can be automatically
1003 extracted from within groff by using the
1004 .B psbb
1005 request.
1006 .
1007 .IP
1008 See
1009 .BR groff_tmac (@MAN5EXT@)
1010 for a description of the
1011 .B PSPIC
1012 macro which provides a convenient high-level interface for inclusion of
1013 PostScript graphics.
1014 .
1015 .TP
1016 .B \[rs]X'ps:\ invis'
1017 .TQ
1018 .B \[rs]X'ps:\ endinvis'
1019 No output is generated for text and drawing commands
1020 that are bracketed with these
1021 .B \[rs]X
1022 commands.
1023 .
1024 These commands are intended for use when output from
1025 .B troff
1026 is previewed before being processed with
1027 .BR grops ;
1028 if the previewer is unable to display certain characters
1029 or other constructs, then other substitute characters or constructs
1030 can be used for previewing by bracketing them with these
1031 .B \[rs]X
1032 commands.
1033 .
1034 .
1035 .RS
1036 .LP
1037 For example,
1038 .B \%gxditview
1039 is not able to display a proper
1040 .B \[rs](em
1041 character because the standard X11 fonts do not provide it;
1042 this problem can be overcome by executing the following
1043 request
1044 .
1045 .IP
1046 .ft B
1047 .nf
1048 \&.char \[rs](em \[rs]X'ps: invis'\[rs]
1049 \[rs]Z'\[rs]v'-.25m'\[rs]h'.05m'\[rs]D'l .9m 0'\[rs]h'.05m''\[rs]
1050 \[rs]X'ps: endinvis'\[rs](em
1051 .ft
1052 .fi
1053 .
1054 .
1055 .LP
1056 In this case,
1057 .B \%gxditview
1058 is unable to display the
1059 .B \[rs](em
1060 character and draws the line,
1061 whereas
1062 .B grops
1063 prints the
1064 .B \[rs](em
1065 character
1066 and ignores the line (this code is already in file
1067 .B Xps.tmac
1068 which is loaded if a document intended for
1069 .B grops
1070 is previewed with
1071 .BR \%gxditview ).
1072 .RE
1073 .
1074 .
1075 .LP
1076 If a PostScript procedure
1077 .B BPhook
1078 has been defined via a
1079 .RB \[oq] ps:\ def \[cq]
1080 or
1081 .RB \[oq] ps:\ mdef \[cq]
1082 device command, it is executed at the beginning of every page (before
1083 anything is drawn or written by groff).
1084 .
1085 For example, to underlay the page contents with the word
1086 \[oq]DRAFT\[cq] in light gray, you might use
1087 .RS
1088 .LP
1089 .nf
1090 .ft B
1091 \&.de XX
1092 ps: def
1093 /BPhook
1094 { gsave .9 setgray clippath pathbbox exch 2 copy
1095   .5 mul exch .5 mul translate atan rotate pop pop
1096   /NewCenturySchlbk-Roman findfont 200 scalefont setfont
1097   (DRAFT) dup stringwidth pop \-.5 mul \-70 moveto show
1098   grestore }
1099 def
1100 \&..
1101 \&.devicem XX
1102 .ft R
1103 .fi
1104 .RE
1105 .LP
1106 Or, to cause lines and polygons to be drawn with square linecaps
1107 and mitered linejoins instead of the round linecaps and linejoins
1108 normally used by
1109 .BR grops ,
1110 use
1111 .RS
1112 .LP
1113 .nf
1114 .ft B
1115 \&.de XX
1116 ps: def
1117 /BPhook { 2 setlinecap 0 setlinejoin } def
1118 \&..
1119 \&.devicem XX
1120 .ft R
1121 .fi
1122 .RE
1123 .LP
1124 (square linecaps, as opposed to butt linecaps (0 setlinecap),
1125 give true corners in boxed tables even though the lines are
1126 drawn unconnected).
1127 .
1128 .
1129 .\" ====================================================================
1130 .SS Encapsulated PostScript
1131 .\" ====================================================================
1132 .
1133 .B grops
1134 itself doesn't emit bounding box information.
1135 .
1136 With the help of Ghostscript the following simple script,
1137 .BR groff2eps ,
1138 produces an encapsulated PS file.
1139 .
1140 .
1141 .RS
1142 .LP
1143 .nf
1144 .ft B
1145 #! /bin/sh
1146 groff \-P\-b16 $1 > $1.ps
1147 gs \-dNOPAUSE \-sDEVICE=bbox \-\- $1.ps 2> $1.bbox
1148 sed \-e "/\[ha]%%Orientation/r $1.bbox" \[rs]
1149     \-e "/\[ha]%!PS-Adobe-3.0/s/$/ EPSF-3.0/" $1.ps > $1.eps
1150 rm $1.ps $1.bbox
1151 .ft R
1152 .fi
1153 .RE
1154 .
1155 .
1156 .LP
1157 Just say
1158 .
1159 .IP
1160 .B
1161 groff2eps foo
1162 .
1163 .LP
1164 to convert file
1165 .B foo
1166 to
1167 .BR foo.eps .
1168 .
1169 .
1170 .\" ====================================================================
1171 .SS TrueType and other font formats
1172 .\" ====================================================================
1173 .
1174 TrueType fonts can be used with
1175 .B grops
1176 if converted first to
1177 .B "Type\~42"
1178 format, a special PostScript wrapper equivalent to the PFA format
1179 mentioned in
1180 .BR \%pfbtops (@MAN1EXT@).
1181 .
1182 There are several different methods to generate a type42 wrapper and
1183 most of them involve the use of a PostScript interpreter such as
1184 Ghostscript \[en] see
1185 .BR gs (1).
1186 .
1187 .
1188 .LP
1189 Yet, the easiest method involves the use of the application
1190 .BR ttftot42 (1).
1191 .
1192 This program uses
1193 .BR freetype (3)
1194 (version 1.3.1) to generate type42
1195 font wrappers and well-formed AFM files that can be fed to
1196 the
1197 .BR \%afmtodit (@MAN1EXT@)
1198 script to create appropriate metric files.
1199 .
1200 The resulting font wrappers should be added to the
1201 .I download
1202 file.
1203 .B ttftot42
1204 source code can be downloaded from
1205 .UR ftp://\:www.giga.or.at/\:pub/\:nih/\:ttftot42/
1206 ftp://\:www.giga.or.at/\:pub/\:nih/\:ttftot42/
1207 .UE .
1208 .
1209 .
1210 .LP
1211 Another solution for creating type42 wrappers is to use FontForge,
1212 available from
1213 .UR http://\:fontforge.sf.net
1214 http://\:fontforge.sf.net
1215 .UE .
1216 This font editor can convert most outline font formats.
1217 .
1218 .
1219 .\" ====================================================================
1220 .SH "FONT INSTALLATION"
1221 .\" ====================================================================
1222 .
1223 This section gives a summary of the above explanations; it can serve
1224 as a step-by-step font installation guide for
1225 .BR grops .
1226 .
1227 .ds BU \[bu]\ \ \"
1228 .de LI
1229 .IP "" 4
1230 \h'-\w'\*[BU]'u'\*[BU]\c
1231 ..
1232 .LI
1233 Convert your font to something groff understands.
1234 .
1235 This is either a PostScript Type\~1 font in PFA format or a PostScript
1236 Type\~42 font, together with an AFM file.
1237 .
1238 .IP
1239 The very first characters in a PFA file look like this:
1240 .
1241 .RS
1242 .IP
1243 .B %!PS-AdobeFont-1.0:
1244 .RE
1245 .
1246 .IP
1247 A PFB file has this also in the first line, but the string is
1248 preceded with some binary bytes.
1249 .
1250 .IP
1251 The very first characters in a Type\~42 font file look like this:
1252 .
1253 .RS
1254 .IP
1255 .B %!PS-TrueTypeFont
1256 .RE
1257 .
1258 .IP
1259 This is a wrapper format for TrueType fonts.
1260 .
1261 Old PS printers might not support it (this is, they don't have a
1262 built-in TrueType font interpreter).
1263 .
1264 .IP
1265 If your font is in PFB format (such fonts normally have
1266 .I .pfb
1267 as the file extension), you might use groff's
1268 .BR \%pfbtops (@MAN1EXT@)
1269 program to convert it to PFA.
1270 .
1271 For TrueType fonts, try
1272 .B ttftot42
1273 or
1274 .BR fontforge .
1275 For all other font formats use
1276 .B fontforge
1277 which can convert most outline font formats.
1278 .
1279 .LI
1280 Convert the AFM file to a groff font description file with the
1281 .BR \%afmtodit (@MAN1EXT@)
1282 program.
1283 .
1284 An example call is
1285 .
1286 .RS
1287 .IP
1288 afmtodit Foo-Bar-Bold.afm textmap FBB
1289 .RE
1290 .
1291 .IP
1292 which converts the metric file
1293 .I Foo-Bar-Bold.afm
1294 to the groff
1295 font
1296 .IR FBB .
1297 .
1298 If you have a font family which comes with normal, bold, italic,
1299 and bold italic faces, it is recommended to use the letters
1300 .BR R ,
1301 .BR B ,
1302 .BR I ,
1303 and
1304 .BR BI ,
1305 respectively, as postfixes in the groff font names to make groff's
1306 \[oq].fam\[cq] request work.
1307 .
1308 An example is groff's built-in Times-Roman font: The font family
1309 name is
1310 .BR T ,
1311 and the groff font names are
1312 .BR TR ,
1313 .BR TB ,
1314 .BR TI ,
1315 and
1316 .BR TBI .
1317 .
1318 .LI
1319 Install both the groff font description files and the fonts in a
1320 .I devps
1321 subdirectory of the font path which groff finds.
1322 .
1323 See section \[lq]Environment\[rq] in
1324 .BR troff (@MAN1EXT@)
1325 for the actual value of the font path.
1326 .
1327 Note that groff doesn't use the AFM files (but it is a good idea
1328 to store them anyway).
1329 .
1330 .LI
1331 Register all fonts which must be downloaded to the printer in the
1332 .I devps/download
1333 file.
1334 .
1335 Only the first occurrence of this file in the font path is read.
1336 .
1337 This means that you should copy the default
1338 .I download
1339 file to the first directory in your font path and add your fonts there.
1340 .
1341 To continue the above example we assume that the PS font name for
1342 .I Foo-Bar-Bold.pfa
1343 is \[oq]XY-Foo-Bar-Bold\[cq] (the PS font name is stored in the
1344 .B internalname
1345 field in the
1346 .I FBB
1347 file),
1348 thus the following line should be added to
1349 .IR download .
1350 .
1351 .RS
1352 .IP
1353 .B XY-Foo-Bar-Bold Foo-Bar-Bold.pfa
1354 .
1355 .RE
1356 .
1357 .
1358 .\" ====================================================================
1359 .SH OLD FONTS
1360 .\" ====================================================================
1361 .
1362 groff versions 1.19.2 and earlier contain a slightly different set of
1363 the 35 Adobe core fonts; the difference is mainly the lack of the
1364 \[oq]Euro\[cq] glyph and a reduced set of kerning pairs.
1365 .
1366 For backwards compatibility, these old fonts are installed also in the
1367 .
1368 .IP
1369 .I @OLDFONTDIR@/devps
1370 .
1371 .LP
1372 directory.
1373 .
1374 .
1375 .LP
1376 To use them, make sure that
1377 .B grops
1378 finds the fonts before the default system fonts (with the same names):
1379 Either add command-line option
1380 .B \-F
1381 to
1382 .B grops
1383 .
1384 .IP
1385 .B groff \-Tps \-P\-F \-P@OLDFONTDIR@ .\|.\|.
1386 .
1387 .LP
1388 or add the directory to groff's font path environment variable
1389 .
1390 .IP
1391 .B GROFF_FONT_PATH=@OLDFONTDIR@
1392 .
1393 .
1394 .\" ====================================================================
1395 .SH ENVIRONMENT
1396 .\" ====================================================================
1397 .
1398 .TP
1399 .I GROPS_PROLOGUE
1400 If this is set to
1401 .IR foo ,
1402 then
1403 .B grops
1404 uses the file
1405 .I foo
1406 (in the font path) instead of the default prologue file
1407 .BR prologue .
1408 .
1409 The option
1410 .B \-P
1411 overrides this environment variable.
1412 .
1413 .
1414 .TP
1415 .I GROFF_FONT_PATH
1416 A list of directories in which to search for the
1417 .IR dev name
1418 directory in addition to the default ones.
1419 .
1420 See
1421 .BR @g@troff (@MAN1EXT@)
1422 and
1423 .BR \%groff_font (@MAN5EXT@)
1424 for more details.
1425 .
1426 .
1427 .TP
1428 .I SOURCE_DATE_EPOCH
1429 A timestamp (expressed as seconds since the Unix epoch) to use as the
1430 creation timestamp in place of the current time.
1431 .
1432 .
1433 .\" ====================================================================
1434 .SH FILES
1435 .\" ====================================================================
1436 .
1437 .TP
1438 .I @FONTDIR@/devps/DESC
1439 Device description file.
1440 .
1441 .TP
1442 .IR @FONTDIR@/devps/ F
1443 Font description file for font
1444 .IR F .
1445 .
1446 .TP
1447 .I @FONTDIR@/devps/download
1448 List of downloadable fonts.
1449 .
1450 .TP
1451 .I @FONTDIR@/devps/text.enc
1452 Encoding used for text fonts.
1453 .
1454 .TP
1455 .I @MACRODIR@/ps.tmac
1456 Macros for use with
1457 .BR grops ;
1458 automatically loaded by
1459 .B troffrc
1460 .
1461 .TP
1462 .I @MACRODIR@/pspic.tmac
1463 Definition of
1464 .B PSPIC
1465 macro,
1466 automatically loaded by
1467 .IR ps.tmac .
1468 .
1469 .TP
1470 .I @MACRODIR@/psold.tmac
1471 Macros to disable use of characters not present in older
1472 PostScript printers (e.g., \[oq]eth\[cq] or \[oq]thorn\[cq]).
1473 .
1474 .TP
1475 .IR /tmp/grops XXXXXX
1476 Temporary file.
1477 See
1478 .BR groff (@MAN1EXT@)
1479 for details on the location of temporary files.
1480 .
1481 .
1482 .\" ====================================================================
1483 .SH "SEE ALSO"
1484 .\" ====================================================================
1485 .
1486 .BR \%afmtodit (@MAN1EXT@),
1487 .BR groff (@MAN1EXT@),
1488 .BR @g@troff (@MAN1EXT@),
1489 .BR \%pfbtops (@MAN1EXT@),
1490 .BR \%groff_out (@MAN5EXT@),
1491 .BR \%groff_font (@MAN5EXT@),
1492 .BR \%groff_char (@MAN7EXT@),
1493 .BR \%groff_tmac (@MAN5EXT@)
1494 .
1495 .
1496 .LP
1497 .UR http://\:partners.adobe.com/\:public/\:developer/\:en/\:ps/\:5001.DSC_Spec.pdf
1498 PostScript Language Document Structuring Conventions Specification
1499 .UE
1500 .
1501 .
1502 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
1503 .cp \n[grops_C]
1504 .
1505 .
1506 .\" Local Variables:
1507 .\" mode: nroff
1508 .\" End:
1509 .\" vim: set filetype=groff: