1grn(1) General Commands Manual grn(1)
2
3
4
6 grn - embed Gremlin images in groff documents
7
9 grn [-C] [-T dev] [-M dir] [-F dir] [file ...]
10
11 grn -?
12 grn --help
13
14 grn -v
15 grn --version
16
18 grn is a preprocessor for including gremlin pictures in troff(1) input.
19 grn writes to standard output, processing only input lines between two
20 that start with .GS and .GE. Those lines must contain grn commands
21 (see below). These macros request a gremlin file; the picture in that
22 file is converted and placed in the troff input stream. .GS may be
23 called with a C, L, or R argument to center, left-, or right-justify
24 the whole gremlin picture (the default is to center). If no file is
25 mentioned, the standard input is read. At the end of the picture, the
26 position on the page is the bottom of the gremlin picture. If the grn
27 entry is ended with .GF instead of .GE, the position is left at the top
28 of the picture.
29
30 Currently only the me macro package has support for .GS, .GE, and .GF.
31
32 grn produces drawing escape sequences that use groff's color scheme ex‐
33 tension (\D'F ...'), and thus may not work with other troffs.
34
35 grn commands
36 Each input line between .GS and .GE may have one grn command. Commands
37 consist of one or two strings separated by white space, the first
38 string being the command and the second its operand. Commands may be
39 upper- or lowercase and abbreviated down to one character.
40
41 Commands that affect a picture's environment (those listed before
42 “default”, see below) are only in effect for the current picture: the
43 environment is reinitialized to the defaults at the start of the next
44 picture. The commands are as follows.
45
46 1 N
47 2 N
48 3 N
49 4 N Set gremlin's text size number 1 (2, 3, or 4) to N points. The
50 default is 12 (16, 24, and 36, respectively).
51
52 roman f
53 italics f
54 bold f
55 special f
56 Set the roman (italics, bold, or special) font to troff's font f
57 (either a name or number). The default is R (I, B, and S, re‐
58 spectively).
59
60 l f
61 stipple f
62 Set the stipple font to troff's stipple font f (name or number).
63 The command stipple may be abbreviated down as far as “st” (to
64 avoid confusion with “special”). There is no default for stip‐
65 ples (unless one is set by the “default” command), and it is in‐
66 valid to include a gremlin picture with polygons without speci‐
67 fying a stipple font.
68
69 x N
70 scale N
71 Magnify the picture (in addition to any default magnification)
72 by N, a floating-point number larger than zero. The command
73 scale may be abbreviated down to “sc”.
74
75 narrow N
76 medium N
77 thick N
78 Set the thickness of gremlin's narrow (medium and thick, respec‐
79 tively) lines to N times 0.15pt (this value can be changed at
80 compile time). The default is 1.0 (3.0 and 5.0, respectively),
81 which corresponds to 0.15pt (0.45pt and 0.75pt, respectively).
82 A thickness value of zero selects the smallest available line
83 thickness. Negative values cause the line thickness to be pro‐
84 portional to the current point size.
85
86 pointscale [off|on]
87 Scale text to match the picture. Gremlin text is usually
88 printed in the point size specified with the commands 1, 2, 3,
89 or 4, regardless of any scaling factors in the picture. Setting
90 pointscale will cause the point sizes to scale with the picture
91 (within troff's limitations, of course). An operand of anything
92 but off will turn text scaling on.
93
94 default
95 Reset the picture environment defaults to the settings in the
96 current picture. This is meant to be used as a global parameter
97 setting mechanism at the beginning of the troff input file, but
98 can be used at any time to reset the default settings.
99
100 width N
101 Force the picture to be N inches wide. This overrides any scal‐
102 ing factors present in the same picture. “width 0” is ignored.
103
104 height N
105 Force the picture to be N inches high, overriding other scaling
106 factors. If both width and height are specified, the tighter
107 constraint will determine the scale of the picture. height and
108 width commands are not saved with a “default” command. They
109 will, however, affect point size scaling if that option is set.
110
111 file name
112 Get picture from gremlin file name located the current directory
113 (or in the library directory; see the -M option above). If mul‐
114 tiple file commands are given, the last one controls. If name
115 doesn't exist, an error message is reported and processing con‐
116 tinues from the .GE line.
117
118 Usage with groff
119 Since grn is a preprocessor, it has no access to elements of formatter
120 state, such as indentation, line length, type size, or register values.
121 Consequently, no troff input can be placed between the .GS and .GE
122 macros. However, gremlin text elements are subsequently processed by
123 troff, so anything valid in a single line of troff input is valid in a
124 line of gremlin text (barring the dot control character “.” at the be‐
125 ginning of a line). Thus, it is possible to have equations within a
126 gremlin figure by including in the gremlin file eqn expressions en‐
127 closed by previously defined delimiters (e.g., “$$”).
128
129 When using grn along with other preprocessors, it is best to run tbl(1)
130 before grn, pic(1), and/or ideal to avoid overworking tbl. eqn(1)
131 should always be run last. groff(1) will automatically run preproces‐
132 sors in the correct order.
133
134 A picture is considered an entity, but that doesn't stop troff from
135 trying to break it up if it falls off the end of a page. Placing the
136 picture between “keeps” in the me macros will ensure proper placement.
137
138 grn uses troff's registers g1 through g9 and sets registers g1 and g2
139 to the width and height of the gremlin figure (in device units) before
140 entering the .GS macro (this is for those who want to rewrite these
141 macros).
142
143 Gremlin file format
144 There exist two distinct gremlin file formats: the original format for
145 AED graphic terminals, and the Sun or X11 version. An extension used
146 by the Sun/X11 version allowing reference points with negative coordi‐
147 nates is not compatible with the AED version. As long as a gremlin
148 file does not contain negative coordinates, either format will be read
149 correctly by either version of gremlin or grn. The other difference in
150 Sun/X11 format is the use of names for picture objects (e.g., POLYGON,
151 CURVE) instead of numbers. Files representing the same picture are
152 shown below.
153
154 sungremlinfile gremlinfile
155 0 240.00 128.00 0 240.00 128.00
156 CENTCENT 2
157 240.00 128.00 240.00 128.00
158 185.00 120.00 185.00 120.00
159 240.00 120.00 240.00 120.00
160 296.00 120.00 296.00 120.00
161 * -1.00 -1.00
162 2 3 2 3
163 10 A Triangle 10 A Triangle
164 POLYGON 6
165 224.00 416.00 224.00 416.00
166 96.00 160.00 96.00 160.00
167 384.00 160.00 384.00 160.00
168 * -1.00 -1.00
169 5 1 5 1
170 0 0
171 -1 -1
172
173 • The first line of each gremlin file contains either the string “grem‐
174 linfile” (AED) or “sungremlinfile” (Sun/X11).
175
176 • The second line of the file contains an orientation and x and y val‐
177 ues for a positioning point, separated by spaces. The orientation,
178 either 0 or 1, is ignored by the Sun/X11 version. 0 means that grem‐
179 lin will display things in horizontal format (a drawing area wider
180 than it is tall, with a menu across the top). 1 means that gremlin
181 will display things in vertical format (a drawing area taller than it
182 is wide, with a menu on the left side). x and y are floating-point
183 values giving a positioning point to be used when this file is read
184 into another file. The stuff on this line really isn't all that im‐
185 portant; a value of “1 0.00 0.00” is suggested.
186
187 • The rest of the file consists of zero or more element specifications.
188 After the last element specification is a line containing the string
189 “-1”.
190
191 • Lines longer than 127 characters are truncated to that length.
192
193 Element specifications
194 • The first line of each element contains a single decimal number giv‐
195 ing the type of the element (AED) or its name (Sun/X11).
196
197 gremlin File Format: Object Type Specification
198 ─────────────────────────────────────────────────────────
199 AED Number Sun/X11 Name Description
200 0 BOTLEFT bottom-left-justified text
201 1 BOTRIGHT bottom-right-justified text
202 2 CENTCENT center-justified text
203 3 VECTOR vector
204 4 ARC arc
205 5 CURVE curve
206 6 POLYGON polygon
207 7 BSPLINE b-spline
208 8 BEZIER Bézier
209 10 TOPLEFT top-left-justified text
210 11 TOPCENT top-center-justified text
211 12 TOPRIGHT top-right-justified text
212 13 CENTLEFT left-center-justified text
213 14 CENTRIGHT right-center-justified text
214 15 BOTCENT bottom-center-justified text
215
216 • After the object type comes a variable number of lines, each specify‐
217 ing a point used to display the element. Each line contains an x-co‐
218 ordinate and a y-coordinate in floating-point format, separated by
219 spaces. The list of points is terminated by a line containing the
220 string “-1.0 -1.0” (AED) or a single asterisk, “*” (Sun/X11).
221
222 • After the points comes a line containing two decimal values, giving
223 the brush and size for the element. The brush determines the style
224 in which things are drawn. For vectors, arcs, and curves there are
225 six valid brush values.
226
227 1 thin dotted lines
228 2 thin dot-dashed lines
229 3 thick solid lines
230 4 thin dashed lines
231 5 thin solid lines
232 6 medium solid lines
233
234 For polygons, one more value, 0, is valid. It specifies a polygon
235 with an invisible border. For text, the brush selects a font as fol‐
236 lows.
237
238 1 roman (R font in troff)
239 2 italics (I font in troff)
240 3 bold (B font in troff)
241 4 special (S font in troff)
242
243 If you're using grn to run your pictures through groff, the font is
244 really just a starting font. The text string can contain formatting
245 sequences like “\fI” or “\d” which may change the font (as well as do
246 many other things). For text, the size field is a decimal value be‐
247 tween 1 and 4. It selects the size of the font in which the text
248 will be drawn. For polygons, this size field is interpreted as a
249 stipple number to fill the polygon with. The number is used to index
250 into a stipple font at print time.
251
252 • The last line of each element contains a decimal number and a string
253 of characters, separated by a single space. The number is a count of
254 the number of characters in the string. This information is used
255 only for text elements, and contains the text string. There can be
256 spaces inside the text. For arcs, curves, and vectors, the character
257 count is zero (0), followed by exactly one space before the newline.
258
259 Coordinates
260 gremlin was designed for AED terminals, and its coordinates reflect the
261 AED coordinate space. For vertical pictures, x values range 116 to
262 511, and y values from 0 to 483. For horizontal pictures, x values
263 range from 0 to 511, and y values from 0 to 367. Although you needn't
264 absolutely stick to this range, you'll get better results if you at
265 least stay in this vicinity. Also, point lists are terminated by a
266 point of (-1, -1), so you shouldn't ever use negative coordinates.
267 gremlin writes out coordinates using the printf(3) format “%f1.2”; it's
268 probably a good idea to use the same format if you want to modify the
269 grn code.
270
271 Sun/X11 coordinates
272 There is no restriction on the range of coordinates used to create ob‐
273 jects in the Sun/X11 version of gremlin. However, files with negative
274 coordinates will cause problems if displayed on the AED.
275
277 -? and --help display a usage message, while -v and --version show ver‐
278 sion information; all exit afterward.
279
280 -C Recognize .GS and .GE (and .GF) even when followed by a charac‐
281 ter other than space or newline.
282
283 -F dir Search dir for subdirectories devname (name is the name of the
284 output driver) for the DESC file before the default font direc‐
285 tories /etc/groff/site-font, /usr/share/groff/1.23.0/font, and
286 /usr/lib/font.
287
288 -M dir Prepend dir to the search path for gremlin files. The default
289 search path is the current directory, the home directory, /etc/
290 groff/site-tmac, and /usr/share/groff/1.23.0/tmac, in that or‐
291 der.
292
293 -T dev Prepare device output using output driver dev. The default is
294 ps. See groff(1) for a list of valid devices.
295
297 /usr/share/groff/1.23.0/font/devname/DESC
298 describes the output device name.
299
301 David Slattengren and Barry Roitblat wrote the original Berkeley grn.
302 Daniel Senderowicz and Werner Lemberg modified it for groff.
303
305 gremlin(1), groff(1), pic(1), ideal(1)
306
307
308
309groff 1.23.0 2 November 2023 grn(1)