* Makefile.comm (install_dev, uninstall_dev): Protect `for' loops
[s-roff.git] / src / devices / grops / grops.man
blobd430b07c47b31a4291957dfae7e8c05b83ecbf4c
1 .ig
2 Copyright (C) 1989-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4 Permission is granted to make and distribute verbatim copies of
5 this manual provided the copyright notice and this permission notice
6 are preserved on all copies.
8 Permission is granted to copy and distribute modified versions of this
9 manual under the conditions for verbatim copying, provided that the
10 entire resulting derived work is distributed under the terms of a
11 permission notice identical to this one.
13 Permission is granted to copy and distribute translations of this
14 manual into another language, under the above conditions for modified
15 versions, except that this permission notice may be included in
16 translations approved by the Free Software Foundation instead of in
17 the original English.
20 .do nr grops_C \n[.C]
21 .cp 0
23 .mso www.tmac
26 .\" Like TP, but if specified indent is more than half
27 .\" the current line-length - indent, use the default indent.
28 .de Tp
29 .  ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
30 .  el .TP "\\$1"
33 .de TQ
34 .  br
35 .  ns
36 .  TP \$1
39 .de FT
40 .  if '\\*(.T'ps' .ft \\$1
44 .TH GROPS @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
47 .SH NAME
48 grops \- PostScript driver for groff
51 .SH SYNOPSIS
52 .nr a \n(.j
53 .ad l
54 .nr i \n(.i
55 .in +\w'\fBgrops 'u
56 .ti \niu
57 .B grops
59 .de OP
60 .ie \\n(.$-1 .RI "[\ \fB\\$1\fP" "\%\\$2" "\ ]"
61 .el .RB "[\ " "\\$1" "\ ]"
64 .OP \-glmv
65 .OP \-b n
66 .OP \-c n
67 .OP \-F dir
68 .OP \-I dir
69 .OP \-p papersize
70 .OP \-P prologue
71 .OP \-w n
72 .RI "[\ " files\|.\|.\|. "\ ]"
73 .br
74 .ad \na
76 .PP
77 It is possible to have whitespace between a command line option and its
78 parameter.
81 .SH DESCRIPTION
82 .B grops
83 translates the output of GNU
84 .B troff
85 to PostScript.
87 Normally
88 .B grops
89 should be invoked by using the groff command
90 with a
91 .B \-Tps
92 option.
94 .if '@DEVICE@'ps' (Actually, this is the default for groff.)
96 If no files are given,
97 .B grops
98 will read the standard input.
100 A filename of
101 .B \-
102 will also cause
103 .B grops
104 to read the standard input.
106 PostScript output is written to the standard output.
108 When
109 .B grops
110 is run by
111 .B groff
112 options can be passed to
113 .B grops
114 using the
115 .B groff
116 .B \-P
117 option.
120 .SH OPTIONS
122 .BI \-b n
123 Provide workarounds for older printers, broken spoolers, and previewers.
125 Normally
126 .B grops
127 produces output at PostScript LanguageLevel\~2 that conforms to the
128 Document Structuring Conventions version 3.0.
130 Some older printers, spoolers, and previewers can't handle such output.
132 The value of\~\c
133 .I n
134 controls what
135 .B grops
136 does to make its output acceptable to such programs.
138 A value of\~0 will cause grops not to employ any workarounds.
141 Add\~1 if no
142 .B %%Begin\%Document\%Setup
144 .B %%End\%Document\%Setup
145 comments should be generated;
146 this is needed for early versions of TranScript that get confused by
147 anything between the
148 .B %%End\%Prolog
149 comment and the first
150 .B %%Page
151 comment.
154 Add\~2 if lines in included files beginning with
155 .B %!
156 should be stripped out; this is needed for Sun's pageview previewer.
159 Add\~4 if
160 .BR %%Page ,
161 .BR %%Trailer
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
169 .B %%End\%Document
170 comments.
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 requires
178 page reversal.
181 Add\~16 if no media size information should be included in the document
182 (this is, neither use
183 .B %%Document\%Media
184 nor the
185 .B setpagedevice
186 PostScript command).
188 This was the behaviour of groff version 1.18.1 and earlier; it is needed
189 for older printers which don't understand PostScript LanguageLevel\~2.
191 It is also necessary if the output is further processed to get an
192 encapsulated PS (EPS) file -- see below.
195 The default value can be specified by a
199 .BI broken\  n
202 command in the DESC file.
204 Otherwise the default value is\~0.
208 .BI \-c n
209 Print
210 .I n
211 copies of each page.
214 .BI \-F dir
215 Prepend directory
216 .IB dir /dev name
217 to the search path for prologue, font, and device description files;
218 .I name
219 is the name of the device, usually
220 .BR ps .
223 .BI \-g
224 Guess the page length.
226 This generates PostScript code that guesses the page length.
228 The guess will be correct only if the imageable area is vertically
229 centered on the page.
231 This option allows you to generate documents that can be printed
232 both on letter (8.5\(mu11) paper and on A4 paper without change.
235 .BI \-I dir
236 This option may be used to specify a directory to search for
237 files on the command line and files named in 
238 .B \eX'ps: import'
240 .B \eX'ps: file'
241 escapes.
242 The current directory is always searched first.
243 This option may be specified more than once;
244 the directories will be searched in the order specified.
245 No directory search is performed for files specified using an absolute path.
248 .B \-l
249 Print the document in landscape format.
252 .B \-m
253 Turn manual feed on for the document.
256 .BI \-p paper-size
257 Set physical dimension of output medium.
259 This overrides the
260 .BR papersize ,
261 .BR paperlength ,
263 .B paperwidth
264 commands in the
265 .B DESC
266 file; it accepts the same arguments as the
267 .B papersize
268 command.
271 .B groff_font (@MAN5EXT@)
272 for details.
275 .BI \-P prologue-file
276 Use the file
277 .I prologue-file
278 (in the font path) as the prologue instead of the default prologue file
279 .BR prologue .
281 This option overrides the environment variable
282 .SM GROPS_PROLOGUE.
285 .BI \-w n
286 Lines should be drawn using a thickness of
287 .IR n \~\c
288 thousandths of an em.
289 If this option is not given, the line thickness defaults to 0.04\~em.
292 .B \-v
293 Print the version number.
296 .SH USAGE
297 There are styles called
298 .BR R ,
299 .BR I ,
300 .BR B ,
302 .B BI
303 mounted at font positions 1 to\~4.
305 The fonts are grouped into families
306 .BR A ,
307 .BR BM ,
308 .BR C ,
309 .BR H ,
310 .BR HN ,
311 .BR N ,
312 .BR P ,
313 and\~\c
314 .B T
315 having members in each of these styles:
319 .B AR
320 .FT AR
321 AvantGarde-Book
325 .B AI
326 .FT AI
327 AvantGarde-BookOblique
331 .B AB
332 .FT AB
333 AvantGarde-Demi
337 .B ABI
338 .FT ABI
339 AvantGarde-DemiOblique
343 .B BMR
344 .FT BMR
345 Bookman-Light
349 .B BMI
350 .FT BMI
351 Bookman-LightItalic
355 .B BMB
356 .FT BMB
357 Bookman-Demi
361 .B BMBI
362 .FT BMBI
363 Bookman-DemiItalic
367 .B CR
368 .FT CR
369 Courier
373 .B CI
374 .FT CI
375 Courier-Oblique
379 .B CB
380 .FT CB
381 Courier-Bold
385 .B CBI
386 .FT CBI
387 Courier-BoldOblique
391 .B HR
392 .FT HR
393 Helvetica
397 .B HI
398 .FT HI
399 Helvetica-Oblique
403 .B HB
404 .FT HB
405 Helvetica-Bold
409 .B HBI
410 .FT HBI
411 Helvetica-BoldOblique
415 .B HNR
416 .FT HNR
417 Helvetica-Narrow
421 .B HNI
422 .FT HNI
423 Helvetica-Narrow-Oblique
427 .B HNB
428 .FT HNB
429 Helvetica-Narrow-Bold
433 .B HNBI
434 .FT HNBI
435 Helvetica-Narrow-BoldOblique
439 .B NR
440 .FT NR
441 NewCenturySchlbk-Roman
445 .B NI
446 .FT NI
447 NewCenturySchlbk-Italic
451 .B NB
452 .FT NB
453 NewCenturySchlbk-Bold
457 .B NBI
458 .FT NBI
459 NewCenturySchlbk-BoldItalic
463 .B PR
464 .FT PR
465 Palatino-Roman
469 .B PI
470 .FT PI
471 Palatino-Italic
475 .B PB
476 .FT PB
477 Palatino-Bold
481 .B PBI
482 .FT PBI
483 Palatino-BoldItalic
487 .B TR
488 .FT TR
489 Times-Roman
493 .B TI
494 .FT TI
495 Times-Italic
499 .B TB
500 .FT TB
501 Times-Bold
505 .B TBI
506 .FT TBI
507 Times-BoldItalic
512 There is also the following font which is not a member of a family:
516 .B ZCMI
517 .FT ZCMI
518 ZapfChancery-MediumItalic
523 There are also some special fonts called
524 .B S
525 for the PS Symbol font, and
526 .BR SS ,
527 containing slanted lowercase Greek letters taken from PS Symbol.
529 Zapf Dingbats is available as
530 .BR ZD
531 and a reversed version of ZapfDingbats (with symbols pointing in the opposite
532 direction) is available as
533 .BR ZDR ;
534 most characters in these fonts are unnamed and must be accessed using
535 .BR \[rs]N .
538 The default color for
539 .B \[rs]m
541 .B \[rs]M
542 is black; for colors defined in the `rgb' color space,
543 .B setrgbcolor
544 is used, for `cmy' and `cmyk'
545 .BR setcmykcolor ,
546 and for `gray'
547 .BR setgray .
548 Note that
549 .B setcmykcolor
550 is a PostScript LanguageLevel\~2 command and thus not available on some
551 older printers.
554 .B grops
555 understands various X\~commands produced using the
556 .B \[rs]X
557 escape sequence;
558 .B grops
559 will only interpret commands that begin with a
560 .B ps:
561 tag.
564 .BI \[rs]X'ps:\ exec\  code '
565 This executes the arbitrary PostScript commands in
566 .IR code .
568 The PostScript currentpoint will be set to the position of the
569 .B \[rs]X
570 command before executing
571 .IR code .
573 The origin will be at the top left corner of the page,
574 and y\~coordinates will increase down the page.
576 A procedure\~\c
577 .B u
578 will be defined that converts groff units
579 to the coordinate system in effect.
581 For example, 
586 \&.nr x 1i
589 \[rs]X'ps: exec \[rs]nx u 0 rlineto stroke'
594 will draw a horizontal line one inch long.
596 .I code
597 may make changes to the graphics state,
598 but any changes will persist only to the
599 end of the page.
601 A dictionary containing the definitions specified by the
602 .B def
604 .B mdef
605 will be on top of the dictionary stack.
607 If your code adds definitions to this dictionary,
608 you should allocate space for them using
609 .BI \[rs]X'ps\ mdef \ n '\fR.
611 Any definitions will persist only until the end of the page.
613 If you use the
614 .B \[rs]Y
615 escape sequence with an argument that names a macro,
616 .I code
617 can extend over multiple lines.
619 For example,
624 .ft B
625 \&.nr x 1i
626 \&.de y
627 \&ps: exec
628 \&\[rs]nx u 0 rlineto
629 \&stroke
630 \&..
631 \&\[rs]Yy
633 .ft R
636 is another way to draw a horizontal line one inch long.
640 .BI \[rs]X'ps:\ file\  name '
641 This is the same as the
642 .B exec
643 command except that the PostScript code is read from file
644 .IR name .
647 .BI \[rs]X'ps:\ def\  code '
648 Place a PostScript definition contained in
649 .I code
650 in the prologue.
652 There should be at most one definition per
653 .B \[rs]X
654 command.
656 Long definitions can be split over several
657 .B \[rs]X
658 commands;
659 all the
660 .I code
661 arguments are simply joined together separated by newlines.
663 The definitions are placed in a dictionary which is automatically
664 pushed on the dictionary stack when an
665 .B exec
666 command is executed.
668 If you use the
669 .B \[rs]Y
670 escape sequence with an argument that names a macro,
671 .I code
672 can extend over multiple lines.
675 .BI \[rs]X'ps:\ mdef\  n\ code  '
676 Like
677 .BR def ,
678 except that
679 .I code
680 may contain up to
681 .IR n \~\c
682 definitions.
684 .B grops
685 needs to know how many definitions
686 .I code
687 contains
688 so that it can create an appropriately sized PostScript dictionary
689 to contain them.
692 .BI \[rs]X'ps:\ import\  file\ llx\ lly\ urx\ ury\ width\ \fR[\fP\ height\ \fR]\fP '
693 Import a PostScript graphic from
694 .IR file .
696 The arguments
697 .IR llx ,
698 .IR lly ,
699 .IR urx ,
701 .I ury
702 give the bounding box of the graphic in the default PostScript
703 coordinate system; they should all be integers;
704 .I llx
706 .I lly
707 are the x and y\~coordinates of the lower left
708 corner of the graphic;
709 .I urx
711 .I ury
712 are the x and y\~coordinates of the upper right corner of the graphic;
713 .I width
715 .I height
716 are integers that give the desired width and height in groff
717 units of the graphic.
719 The graphic will be scaled so that it has this width and height
720 and translated so that the lower left corner of the graphic is
721 located at the position associated with
722 .B \[rs]X
723 command.
725 If the height argument is omitted it will be scaled uniformly in the
726 x and y\~directions so that it has the specified width.
728 Note that the contents of the
729 .B \[rs]X
730 command are not interpreted by
731 .BR troff ;
732 so vertical space for the graphic is not automatically added,
733 and the
734 .I width
736 .I height
737 arguments are not allowed to have attached scaling indicators.
739 If the PostScript file complies with the Adobe Document Structuring
740 Conventions and contains a
741 .B %%Bounding\%Box
742 comment, then the bounding box can be automatically
743 extracted from within groff by using the
744 .B psbb
745 request.
749 .BR groff_tmac (@MAN5EXT@)
750 for a description of the
751 .B PSPIC
752 macro which provides a convenient high-level interface for inclusion of
753 PostScript graphics.
756 .B \[rs]X'ps:\ invis'
758 .B \[rs]X'ps:\ endinvis'
759 No output will be generated for text and drawing commands
760 that are bracketed with these
761 .B \[rs]X
762 commands.
764 These commands are intended for use when output from
765 .B troff
766 will be previewed before being processed with
767 .BR grops ;
768 if the previewer is unable to display certain characters
769 or other constructs, then other substitute characters or constructs
770 can be used for previewing by bracketing them with these
771 .B \[rs]X
772 commands.
776 For example,
777 .B gxditview
778 is not able to display a proper
779 .B \[rs](em
780 character because the standard X11 fonts do not provide it;
781 this problem can be overcome by executing the following
782 request
785 .ft B
787 \&.char \[rs](em \[rs]X'ps: invis'\[rs]
788 \[rs]Z'\[rs]v'-.25m'\[rs]h'.05m'\[rs]D'l .9m 0'\[rs]h'.05m''\[rs]
789 \[rs]X'ps: endinvis'\[rs](em
794 In this case,
795 .B gxditview
796 will be unable to display the
797 .B \[rs](em
798 character and will draw the line,
799 whereas
800 .B grops
801 will print the
802 .B \[rs](em
803 character
804 and ignore the line (this code is already in file
805 .B Xps.tmac
806 which will be loaded if a documented intended for
807 .B grops
808 is previewed with
809 .BR gxditview ).
813 The input to
814 .B grops
815 must be in the format output by
816 .BR @g@troff (@MAN1EXT@).
818 This is described in
819 .BR groff_out (@MAN5EXT@).
822 In addition, the device and font description files for the device used
823 must meet certain requirements.
825 The device and font description files supplied for
826 .B ps
827 device meet all these requirements.
829 .BR afmtodit (@MAN1EXT@)
830 can be used to create font files from AFM files.
832 The resolution must be an integer multiple of\~72 times the
833 .BR sizescale .
836 .B ps
837 device uses a resolution of 72000 and a sizescale of 1000.
840 The device description file must contain a valid paper size; see
841 .BR groff_font (@MAN5EXT@)
842 for more information.
845 Each font description file must contain a command
847 .BI internalname\  psname
849 which says that the PostScript name of the font is
850 .IR psname .
852 It may also contain a command
854 .BI encoding\  enc_file
856 which says that
857 the PostScript font should be reencoded using the encoding described in
858 .IR enc_file ;
859 this file should consist of a sequence of lines of the form:
862 pschar code
864 where
865 .I pschar
866 is the PostScript name of the character,
868 .I code
869 is its position in the encoding expressed as a decimal integer; valid
870 values are in the range 0 to\~255.
872 Lines starting with
873 .B #
874 and blank lines are ignored.
876 The code for each character given in the font file must correspond
877 to the code for the character in encoding file, or to the code in the default
878 encoding for the font if the PostScript font is not to be reencoded.
880 This code can be used with the
881 .B \[rs]N
882 escape sequence in
883 .B troff
884 to select the character,
885 even if the character does not have a groff name.
887 Every character in the font file must exist in the PostScript font, and 
888 the widths given in the font file must match the widths used
889 in the PostScript font.
891 .B grops
892 will assume that a character with a groff name of
893 .B space
894 is blank (makes no marks on the page);
895 it can make use of such a character to generate more efficient and
896 compact PostScript output.
899 Note that
900 .B grops
901 is able to display all glyphs in a PostScript font, not only 256.
902 .I enc_file
903 (or the default encoding if no encoding file specified) just defines the
904 order of glyphs for the first 256 characters; all other glyphs are
905 accessed with additional encoding vectors which
906 .B grops
907 produces on the fly.
910 .B grops
911 can automatically include the downloadable fonts necessary
912 to print the document.
913 Such fonts must be in PFA format.
915 .BR pfbtops (@MAN1EXT@)
916 to convert a Type\~1 font in PFB format.
917 Any downloadable fonts which should, when required, be included by
918 .B grops
919 must be listed in the file
920 .BR @FONTDIR@/devps/download ;
921 this should consist of lines of the form
925 font filename
928 where
929 .I font
930 is the PostScript name of the font,
932 .I filename
933 is the name of the file containing the font;
934 lines beginning with
935 .B #
936 and blank lines are ignored;
937 fields may be separated by tabs or spaces;
938 .I filename
939 will be searched for using the same mechanism that is used
940 for groff font metric files.
943 .B download
944 file itself will also be searched for using this mechanism;
945 currently, only the first found file in the font path is used.
948 If the file containing a downloadable font or imported document
949 conforms to the Adobe Document Structuring Conventions,
950 then
951 .B grops
952 will interpret any comments in the files sufficiently to ensure that its
953 own output is conforming.
955 It will also supply any needed font resources that are listed in the
956 .B download
957 file
958 as well as any needed file resources.
960 It is also able to handle inter-resource dependencies.
962 For example, suppose that you have a downloadable font called Garamond,
963 and also a downloadable font called Garamond-Outline
964 which depends on Garamond
965 (typically it would be defined to copy Garamond's font dictionary,
966 and change the PaintType),
967 then it is necessary for Garamond to appear before Garamond-Outline
968 in the PostScript document.
970 .B grops
971 will handle this automatically
972 provided that the downloadable font file for Garamond-Outline
973 indicates its dependence on Garamond by means of
974 the Document Structuring Conventions,
975 for example by beginning with the following lines
979 %!PS-Adobe-3.0 Resource-Font
982 %%DocumentNeededResources: font Garamond
985 %%EndComments
988 %%IncludeResource: font Garamond
991 In this case both Garamond and Garamond-Outline would need to be listed
992 in the
993 .B download
994 file.
996 A downloadable font should not include its own name in a
997 .B %%Document\%Supplied\%Resources
998 comment.
1001 .B grops
1002 will not interpret 
1003 .B %%Document\%Fonts
1004 comments.
1007 .BR %%Document\%Needed\%Resources ,
1008 .BR %%Document\%Supplied\%Resources ,
1009 .BR %%Include\%Resource ,
1010 .BR %%Begin\%Resource ,
1012 .BR %%End\%Resource
1013 comments
1014 (or possibly the old
1015 .BR %%Document\%Needed\%Fonts ,
1016 .BR %%Document\%Supplied\%Fonts ,
1017 .BR %%Include\%Font ,
1018 .BR %%Begin\%Font ,
1020 .BR %%End\%Font
1021 comments)
1022 should be used.
1025 .SS Encapsulated PostScript
1026 .B grops
1027 itself doesn't emit bounding box information.
1029 With the help of GhostScript the following commands will produce an
1030 encapsulated PS file
1031 .B foo.eps
1032 from input file
1033 .BR foo :
1037 groff -P-b16 foo > foo.ps
1040 gs -dNOPAUSE -sDEVICE=bbox -- foo.ps 2> foo.bbox
1043 cat foo.ps | sed \-e '/%%Orientation/rfoo.bbx' > foo.eps
1046 rm foo.bbx
1051 .SS TrueType fonts
1052 TrueType fonts can be used with 
1053 .B grops 
1054 if converted first to 
1055 .B "Type 42"
1056 format, an especial PostScript wrapper equivalent to the
1057 PFA format mentioned in
1058 .BR pfbtops (@MAN1EXT@).
1059 There are several different methods to generate a type42 
1060 wrapper and most of them involve the use of a PostScript
1061 interpreter such as Ghostscript \(em see
1062 .BR gs (1).
1063 Yet, the easiest method involves the use of the application 
1064 .BR ttftot42 .
1065 This program uses
1066 .BR freetype (3)
1067 (version 1.3.1) to generate type42
1068 font wrappers and well-formed AFM files that can be fed to
1070 .BR afmtodit (@MAN1EXT@)
1071 script to create appropriate metric files.
1072 The resulting font wrappers should be added to the
1073 .B download
1074 file.
1075 .B ttftot42
1076 source code can be downloaded from
1077 .URL ftp://\:www.giga.or.at/\:pub/\:nih/\:ttftot42/ \
1078      ftp://\:www.giga.or.at/\:pub/\:nih/\:ttftot42/ .
1081 .SH ENVIRONMENT
1084 .B GROPS_PROLOGUE
1085 If this is set to
1086 .IR foo ,
1087 then
1088 .B grops
1089 will use the file
1090 .I foo
1091 (in the font path) instead of the default prologue file
1092 .BR prologue .
1094 The option
1095 .B \-P
1096 overrides this environment variable.
1099 .SH FILES
1100 .Tp \w'\fB@FONTDIR@/devps/download'u+2n
1101 .B @FONTDIR@/devps/DESC
1102 Device description file.
1105 .BI @FONTDIR@/devps/ F
1106 Font description file for font
1107 .IR F .
1110 .B @FONTDIR@/devps/download
1111 List of downloadable fonts.
1114 .B @FONTDIR@/devps/text.enc
1115 Encoding used for text fonts.
1118 .B @MACRODIR@/ps.tmac
1119 Macros for use with
1120 .BR grops ;
1121 automatically loaded by
1122 .BR troffrc
1125 .B @MACRODIR@/pspic.tmac
1126 Definition of
1127 .B PSPIC
1128 macro,
1129 automatically loaded by
1130 .BR ps.tmac .
1133 .B @MACRODIR@/psold.tmac
1134 Macros to disable use of characters not present in older
1135 PostScript printers (e.g. `eth' or `thorn').
1138 .BI /tmp/grops XXXXXX
1139 Temporary file.
1142 .SH "SEE ALSO"
1143 .BR afmtodit (@MAN1EXT@),
1144 .BR groff (@MAN1EXT@),
1145 .BR @g@troff (@MAN1EXT@),
1146 .BR pfbtops (@MAN1EXT@),
1147 .BR groff_out (@MAN5EXT@),
1148 .BR groff_font (@MAN5EXT@),
1149 .BR groff_char (@MAN7EXT@),
1150 .BR groff_tmac (@MAN5EXT@)
1152 .cp \n[grops_C]
1154 .\" Local Variables:
1155 .\" mode: nroff
1156 .\" End: