Section: User Commands (1)
Updated: 4 November 2014
grn - groff preprocessor for gremlin files
is a preprocessor for including
writes to standard output, processing only input lines between two
that start with
Those lines must contain
commands (see below).
These commands request a
file, and the picture in that file is converted and placed in the
request may be followed by a C, L, or R to center, left, or right
justify the whole
picture (default justification is center).
is mentioned, the standard input is read.
At the end of the picture, the position on the page is the bottom of the
entry is ended with
the position is left at the top of the picture.
Please note that currently only the -me macro package has support for
The following command-line options are understood:
Prepare output for printer
The default device is
for acceptable devices.
to the default search path for
The default path is (in that order) the current directory, the home
is the name of the device) for the
file before the default font directories
even when followed by a character other than space or newline.
Print the version number.
It is possible to have whitespace between a command line option and its
Each input line between
may have one
Commands consist of one or two strings separated by white space, the first
string being the command and the second its operand.
Commands may be upper or lower case and abbreviated down to one character.
Commands that affect a picture's environment (those listed before
see below) are only in effect for the current picture:
The environment is reinitialized to the defaults at the start of the next
The commands are as follows:
- 1 N
text size number 1 (2, 3, or 4) to
The default is 12 (16, 24, and 36, respectively).
- roman f
- Set the roman (italics, bold, or special) font to
(either a name or number).
The default is R (I, B, and S, respectively).
- l f
- Set the stipple font to
(name or number).
may be abbreviated down as far as 'st' (to avoid confusion
default for stipples (unless one is set by the default command), and
it is invalid to include a
picture with polygons without specifying a
- x N
- Magnify the picture (in addition to any default magnification) by
a floating point number larger than zero.
may be abbreviated down to 'sc'.
- narrow N
- Set the thickness of
narrow (medium and thick, respectively) lines to
times 0.15pt (this value can be changed at compile time).
The default is 1.0 (3.0 and 5.0, respectively), which corresponds to 0.15pt
(0.45pt and 0.75pt, respectively).
A thickness value of zero selects the smallest available line thickness.
Negative values cause the line thickness to be proportional to the
current point size.
- pointscale <off/on>
Scale text to match the picture.
Gremlin text is usually printed in the point size specified with the
regardless of any scaling factors in the picture.
will cause the point sizes to scale with the picture (within
limitations, of course).
An operand of anything but
will turn text scaling on.
Reset the picture environment defaults to the settings in the current
This is meant to be used as a global parameter setting mechanism at
the beginning of the
input file, but can be used at any time to reset the
- width N
Forces the picture to be
This overrides any scaling factors present in the same picture.
- height N
Forces picture to be
inches high, overriding other scaling factors.
If both 'width' and 'height' are specified the tighter
constraint will determine the scale of the picture.
commands are not saved with a
They will, however, affect point size scaling if that option is set.
- file name
Get picture from
located the current directory (or in the library directory; see the
commands are given, the second one overrides the first.
doesn't exist, an error message is reported and processing
continues from the
NOTES ABOUT GROFF
is a preprocessor, it doesn't know about current indents, point
sizes, margins, number registers, etc. Consequently, no
input can be placed between the
text is now processed by
so anything valid in a single line of
input is valid in a line of
text (barring '.' directives at the beginning of a line).
Thus, it is possible to have equations within a
figure by including in the
expressions enclosed by previously defined delimiters (e.g.
along with other preprocessors, it is best to run
to avoid overworking
should always be run last.
A picture is considered an entity, but that doesn't stop
from trying to break it up if it falls off the end of a page.
Placing the picture between 'keeps' in -me macros will ensure
and sets registers
to the width and height of the
figure (in device units) before entering the
request (this is for those who want to rewrite these macros).
GREMLIN FILE FORMAT
There exist two distinct
file formats, the original format from the
graphic terminal version, and the
An extension to the
version allowing reference points with negative coordinates is
compatible with the
As long as a
file does not contain negative coordinates, either format will be read
correctly by either version of
The other difference to the
format is the use of names for picture objects (e.g., POLYGON, CURVE)
instead of numbers.
Files representing the same picture are shown in Table 1 in each format.
|0 240.00 128.00||0 240.00 128.00|
|240.00 128.00||240.00 128.00|
|185.00 120.00||185.00 120.00|
|240.00 120.00||240.00 120.00|
|296.00 120.00||296.00 120.00|
|2 3||2 3|
|10 A Triangle||10 A Triangle|
|224.00 416.00||224.00 416.00|
|96.00 160.00||96.00 160.00|
|384.00 160.00||384.00 160.00|
|5 1||5 1|
|Table 1. File examples|
The first line of each
file contains either the string
The second line of the file contains an orientation, and
values for a positioning point, separated by spaces.
The orientation, either
is ignored by the
will display things in horizontal format (drawing area wider than it is
tall, with menu across top).
will display things in vertical format (drawing area taller than it is
wide, with menu on left side).
are floating point values giving a positioning point to be used when
this file is read into another file.
The stuff on this line really isn't all that important; a value of
"1 0.00 0.00" is suggested.
The rest of the file consists of zero or more element specifications.
After the last element specification is a line containing the string
Lines longer than 127 characters are chopped to this limit.
The first line of each element contains a single decimal number giving
the type of the element
version) or its ASCII name
See Table 2.
|gremlin File Format - Object Type Specification|
|AED Number||SUN//,X11 Name||Description|
|0 ||BOTLEFT||bottom-left-justified text|
|1 ||BOTRIGHT||bottom-right-justified text|
|2 ||CENTCENT||center-justified text|
|10 ||TOPLEFT||top-left-justified text|
|11 ||TOPCENT||top-center-justified text|
|12 ||TOPRIGHT||top-right-justified text|
|13 ||CENTLEFT||left-center-justified text|
|14 ||CENTRIGHT||right-center-justified text|
|15 ||BOTCENT||bottom-center-justified text|
|Type Specifications in gremlin Files|
After the object type comes a variable number of lines, each specifying a
point used to display the element.
Each line contains an x-coordinate and a y-coordinate in floating point
format, separated by spaces.
The list of points is terminated by a line containing the string "-1.0
version) or a single asterisk, "*"
After the points comes a line containing two decimal values, giving the
brush and size for the element.
The brush determines the style in which things are drawn.
For vectors, arcs, and curves there are six valid brush values:
|1 - ||thin dotted lines|
|2 - ||thin dot-dashed lines|
|3 - ||thick solid lines|
|4 - ||thin dashed lines|
|5 - ||thin solid lines|
|6 - ||medium solid lines|
For polygons, one more value, 0, is valid.
It specifies a polygon with an invisible border.
For text, the brush selects a font as follows:
|1 - ||roman (R font in groff)|
|2 - ||italics (I font in groff)|
|3 - ||bold (B font in groff)|
|4 - ||special (S font in groff)|
If you're using
to run your pictures through
the font is really just a starting font:
The text string can contain formatting sequences like
which may change the font (as well as do many other things).
For text, the size field is a decimal value between 1 and 4.
It selects the size of the font in which the text will be drawn.
For polygons, this size field is interpreted as a stipple number to
fill the polygon with.
The number is used to index into a stipple font at print time.
The last line of each element contains a decimal number and a string of
characters, separated by a single space.
The number is a count of the number of characters in the string.
This information is only used for text elements, and contains the text
There can be spaces inside the text.
For arcs, curves, and vectors, this line of the element contains the
NOTES ON COORDINATES
was designed for
and its coordinates reflect the
For vertical pictures, x-values range 116 to 511, and y-values from 0
For horizontal pictures, x-values range from 0 to 511 and y-values
range from 0 to 367.
Although you needn't absolutely stick to this range, you'
ts if you at least stay in this vicinity.
Also, point lists are terminated by a point of (-1, -1), so you
shouldn't ever use negative coordinates.
writes out coordinates using format "%f1.2"; it's probably
a good idea to use the same format if you want to modify the
NOTES ON SUN/X11 COORDINATES
There is no longer a restriction on the range of coordinates used to
create objects in the
However, files with negative coordinates
cause problems if displayed on the
Device description file for device
Copyright © 2000-2014 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
David Slattengren and Barry Roitblat wrote the original Berkeley
Daniel Senderowicz and Werner Lemberg modified it for