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