1
This specification document was obtained from:
2
http://duke.usask.ca/~macphed/soft/fig/FORMAT3.2.txt
3
on 17 May 1999 by ellson@lucent.com
4
===========================================================================
7
* FIG : Facility for Interactive Generation of figures
8
* Copyright (c) 1985 by Supoj Sutanthavibul
9
* Parts Copyright (c) 1994 by Brian V. Smith
10
* Parts Copyright (c) 1991 by Paul King
11
* Parts Copyright (c) 1995 by C. Blanc and C. Schlick
13
* The X Consortium, and any party obtaining a copy of these files from
14
* the X Consortium, directly or indirectly, is granted, free of charge, a
15
* full and unrestricted irrevocable, world-wide, paid up, royalty-free,
16
* nonexclusive right and license to deal in this software and
17
* documentation files (the "Software"), including without limitation the
18
* rights to use, copy, modify, merge, publish, distribute, sublicense,
19
* and/or sell copies of the Software, and to permit persons who receive
20
* copies from any such party to do so, with the only requirement being
21
* that this copyright notice remain intact. This license includes without
22
* limitation a license to do the foregoing actions under any patents of
23
* the party supplying this software to the X Consortium.
26
The new components in protocol 3.2 are the paper size, magnification,
27
single/multiple page indicator and transparent color for GIF export in the
30
The other modification between version 3.1 and version 3.2 of the
31
protocol is the mathematical model used for splines. The new version
32
uses X-splines which allows the user to mix interpolation and approximation
33
points in a same curve. More precisely, it means that an X-spline curve
34
is neither an interpolated spline nor an approximated one, it is BOTH
35
(the behaviour of each point is controlled by one single parameter
36
called "shape factor"). For additional information about X-splines, see:
38
"X-Splines: A Spline Model Designed for the End User"
39
by C. Blanc and C. Schlick, Proceedings of SIGGRAPH'95
41
Caveat: Because spline models of previous versions (quadratic B-splines
42
and Bezier with hidden points) are no longer supported, curves that are
43
present in version 3.1 and older files are automatically converted to
44
X-splines. This translation is only an approximation process. It means
45
that the converted curves are not exactly the same as the original ones.
46
Though the translation usually provides almost identical curves, some
47
hand-fitting may be needed in some pathological cases.
49
-------------------------------------------------------------------------------
50
Description of the Fig Format Follows
51
-------------------------------------------------------------------------------
53
(1) The very first line is a comment line containing the name and version:
56
The character # at the first column of a line indicates that the line
57
is a comment line which will be ignored.
59
(2) The first non-comment line consists of the following:
61
int fig_resolution (Fig units/inch)
62
string orientation ("Landscape" or "Portrait")
63
string justification ("Center" or "Flush Left")
64
string units ("Metric" or "Inches")
65
string papersize ("Letter", "Legal", "Ledger", "Tabloid",
66
"A", "B", "C", "D", "E",
67
"A4", "A3", "A2", "A1", "A0" and "B5")
68
float magnification (export and print magnification, %)
69
string multiple-page ("Single" or "Multiple" pages)
70
int transparent color (color number for transparent color for GIF
71
export. -2=None, -1=background, 0-31 for
72
standard colors or 32- for user colors)
73
int coordinate_system (1: origin at lower left corner (NOT USED)
76
Fig_resolution is the resolution of the figure in the file.
77
Xfig will always write the file with a resolution of 1200ppi so it
78
will scale the figure upon reading it in if its resolution is different
79
from 1200ppi. Pixels are assumed to be square.
81
Xfig will read the orientation string and change the canvas to match
82
either the Landscape or Portrait mode of the figure file.
84
The units specification is self-explanatory.
86
The coordinate_system variable is ignored - the origin is ALWAYS the
89
** Coordinates are given in "fig_resolution" units.
90
** Line thicknesses are given in 80-ths of an inch ("display units").
91
** dash-lengths/dot-gaps are given in 80-ths of an inch.
94
(3) The rest of the file contains various objects. An object can be one
95
of six classes (or types).
97
0) Color pseudo-object.
99
2) Ellipse which is a generalization of circle.
100
3) Polyline which includes polygon and box.
101
4) Spline which includes
102
closed/open approximated/interpolated/x-spline spline.
104
6) Compound object which is composed of one or more objects.
106
In the following elaboration on object formats, every value of fig
107
output are separated by blank characters or new line ('\n'). The
108
value of the unused parameters will be -1.
110
Some fields are described as "enumeration type" or "bit vector"; the
111
values which these fields can take are defined in the header file object.h.
112
The pen_style field is unused.
113
These values may be defined in some future version of Fig.
115
The two color fields (pen and fill; pen only, for texts) are
127
8-11 = four shades of blue (dark to lighter)
128
12-14 = three shades of green (dark to lighter)
129
15-17 = three shades of cyan (dark to lighter)
130
18-20 = three shades of red (dark to lighter)
131
21-23 = three shades of magenta (dark to lighter)
132
24-26 = three shades of brown (dark to lighter)
133
27-30 = four shades of pink (dark to lighter)
136
values from 32 to 543 (512 total) are user colors and
137
are defined in color pseudo-objects (type 0)
139
For WHITE color, the area fill field is defined as follows:
143
... values from 1 to 19 are shades of grey, from darker to lighter
146
41-56 see patterns for colors, below
148
For BLACK or DEFAULT color, the area fill field is defined as follows:
152
... values from 1 to 19 are shades of grey, from lighter to darker
155
41-56 see patterns for colors, below
157
For all other colors, the area fill field is defined as follows:
161
... values from 1 to 19 are "shades" of the color, from darker to lighter.
162
A shade is defined as the color mixed with black
163
20 = full saturation of the color
164
... values from 21 to 39 are "tints" of the color from the color to white.
165
A tint is defined as the color mixed with white
167
41 = 30 degree left diagonal pattern
168
42 = 30 degree right diagonal pattern
169
43 = 30 degree crosshatch
170
44 = 45 degree left diagonal pattern
171
45 = 45 degree right diagonal pattern
172
46 = 45 degree crosshatch
175
49 = horizontal lines
179
53 = small fish scales
181
55 = horizontal "tire treads"
182
56 = vertical "tire treads"
184
The depth field is defined as follows:
186
0 ... 999 where larger value means object is deeper than (under)
187
objects with smaller depth
189
The line_style field is defined as follows:
196
4 = Dash-double-dotted
197
5 = Dash-triple-dotted
199
The style_val field is defined as the length, in 1/80 inches, of the on/off
200
dashes for dashed lines, and the distance between the dots, in 1/80 inches,
203
The join_style field is defined FOR LINES only as follows:
205
0 = Miter (the default in xfig 2.1 and earlier)
209
The cap_style field is defined FOR LINES, OPEN SPLINES and ARCS only as follows:
211
0 = Butt (the default in xfig 2.1 and earlier)
215
The arrow_type field is defined for LINES, ARCS and OPEN SPLINES
218
0 = Stick-type (the default in xfig 2.1 and earlier)
226
2 = Closed with "indented" butt:
235
3 = Closed with "pointed" butt:
245
The arrow_style field is defined for LINES, ARCS and OPEN SPLINES
248
0 = Hollow (actually filled with white)
249
1 = Filled with pen_color
251
(3.0) OBJECT DEFINITION:
253
(3.1) Color Pseudo-objects (user-defined colors)
254
This is used to define arbitrary colors beyond the 32 standard colors.
255
The color objects must be defined before any other Fig objects.
258
type name (brief description)
259
---- ---- -------------------
260
int object_code (always 0)
261
int color_number (color number, from 32-543 (512 total))
262
hex string rgb values (hexadecimal string describing red,
263
green and blue values (e.g. #330099) )
268
type name (brief description)
269
---- ---- -------------------
270
int object_code (always 5)
271
int sub_type (0: pie-wedge (closed)
273
int line_style (enumeration type)
274
int line_thickness (1/80 inch)
275
int pen_color (enumeration type, pen color)
276
int fill_color (enumeration type, fill color)
277
int depth (enumeration type)
278
int pen_style (pen style, not used)
279
int area_fill (enumeration type, -1 = no fill)
280
float style_val (1/80 inch)
281
int cap_style (enumeration type)
282
int direction (0: clockwise, 1: counterclockwise)
283
int forward_arrow (0: no forward arrow, 1: on)
284
int backward_arrow (0: no forward arrow, 1: on)
285
float center_x, center_y (center of the arc)
286
int x1, y1 (Fig units, the 1st point the user entered)
287
int x2, y2 (Fig units, the 2nd point)
288
int x3, y3 (Fig units, the last point)
290
Forward arrow line (Optional; absent if forward_arrow is 0):
291
type name (brief description)
292
---- ---- -------------------
293
int arrow_type (enumeration type)
294
int arrow_style (enumeration type)
295
float arrow_thickness (1/80 inch)
296
float arrow_width (Fig units)
297
float arrow_height (Fig units)
299
Backward arrow line (Optional; absent if backward_arrow is 0):
300
type name (brief description)
301
---- ---- -------------------
302
int arrow_type (enumeration type)
303
int arrow_style (enumeration type)
304
float arrow_thickness (1/80 inch)
305
float arrow_width (Fig units)
306
float arrow_height (Fig units)
310
A line with object code 6 signifies the start of a compound.
311
There are four more numbers on this line which indicate the
312
upper right corner and the lower left corner of the bounding
313
box of this compound. A line with object code -6 signifies
314
the end of the compound. Compound may be nested.
317
type name (brief description)
318
---- ---- -------------------
319
int object_code (always 6)
320
int upperright_corner_x (Fig units)
321
int upperright_corner_y (Fig units)
322
int lowerleft_corner_x (Fig units)
323
int lowerleft_corner_y (Fig units)
336
type name (brief description)
337
---- ---- -------------------
338
int object_code (always 1)
339
int sub_type (1: ellipse defined by radiuses
340
2: ellipse defined by diameters
341
3: circle defined by radius
342
4: circle defined by diameter)
343
int line_style (enumeration type)
344
int thickness (1/80 inch)
345
int pen_color (enumeration type, pen color)
346
int fill_color (enumeration type, fill color)
347
int depth (enumeration type)
348
int pen_style (pen style, not used)
349
int area_fill (enumeration type, -1 = no fill)
350
float style_val (1/80 inch)
351
int direction (always 1)
352
float angle (radians, the angle of the x-axis)
353
int center_x, center_y (Fig units)
354
int radius_x, radius_y (Fig units)
355
int start_x, start_y (Fig units; the 1st point entered)
356
int end_x, end_y (Fig units; the last point entered)
361
type name (brief description)
362
---- ---- -------------------
363
int object_code (always 2)
364
int sub_type (1: polyline
368
5: imported-picture bounding-box)
369
int line_style (enumeration type)
370
int thickness (1/80 inch)
371
int pen_color (enumeration type, pen color)
372
int fill_color (enumeration type, fill color)
373
int depth (enumeration type)
374
int pen_style (pen style, not used)
375
int area_fill (enumeration type, -1 = no fill)
376
float style_val (1/80 inch)
377
int join_style (enumeration type)
378
int cap_style (enumeration type, only used for POLYLINE)
379
int radius (1/80 inch, radius of arc-boxes)
380
int forward_arrow (0: off, 1: on)
381
int backward_arrow (0: off, 1: on)
382
int npoints (number of points in line)
384
Forward arrow line: same as ARC object
386
Backward arrow line: same as ARC object
389
type name (brief description)
390
---- ---- -------------------
391
int x1, y1 (Fig units)
392
int x2, y2 (Fig units)
395
int xnpoints ynpoints (this will be the same as the 1st
396
point for polygon and box)
399
type name (brief description)
400
---- ---- -------------------
401
boolean flipped orientation = normal (0) or flipped (1)
402
char file[] name of picture file to import
407
type name (brief description)
408
---- ---- -------------------
409
int object_code (always 3)
410
int sub_type (0: opened approximated spline
411
1: closed approximated spline
412
2: opened interpolated spline
413
3: closed interpolated spline
416
int line_style (See the end of this section)
417
int thickness (1/80 inch)
418
int pen_color (enumeration type, pen color)
419
int fill_color (enumeration type, fill color)
420
int depth (enumeration type)
421
int pen_style (pen style, not used)
422
int area_fill (enumeration type, -1 = no fill)
423
float style_val (1/80 inch)
424
int cap_style (enumeration type, only used for open splines)
425
int forward_arrow (0: off, 1: on)
426
int backward_arrow (0: off, 1: on)
427
int npoints (number of control points in spline)
429
Forward arrow line: same as ARC object
431
Backward arrow line: same as ARC object
433
Points line: same as POLYLINE object
435
Control points line :
437
There is one shape factor for each point. The value of this factor
438
must be between -1 (which means that the spline is interpolated at
439
this point) and 1 (which means that the spline is approximated at
440
this point). The spline is always smooth in the neighbourhood of a
441
control point, except when the value of the factor is 0 for which
442
there is a first-order discontinuity (i.e. angular point).
445
type name (brief description)
446
---- ---- -------------------
447
int object (always 4)
448
int sub_type (0: Left justified
451
int color (enumeration type)
452
int depth (enumeration type)
453
int pen_style (enumeration , not used)
454
int font (enumeration type)
455
float font_size (font size in points)
456
float angle (radians, the angle of the text)
457
int font_flags (bit vector)
458
float height (Fig units)
459
float length (Fig units)
460
int x, y (Fig units, coordinate of the origin
461
of the string. If sub_type = 0, it is
462
the lower left corner of the string.
463
If sub_type = 1, it is the lower
464
center. Otherwise it is the lower
465
right corner of the string.)
466
char string[] (ASCII characters; starts after a blank
467
character following the last number and
468
ends before the sequence '\001'. This
469
sequence is not part of the string.
470
Characters above octal 177 are
471
represented by \xxx where xxx is the
472
octal value. This permits fig files to
473
be edited with 7-bit editors and sent
474
by e-mail without data loss.
475
Note that the string may contain '\n'.)
477
The font_flags field is defined as follows:
481
0 Rigid text (text doesn't scale when scaling compound objects)
482
1 Special text (for LaTeX)
483
2 PostScript font (otherwise LaTeX font is used)
486
The font field is defined as follows:
488
For font_flags bit 2 = 0 (LaTeX fonts):
497
For font_flags bit 2 = 1 (PostScript fonts):
505
5 AvantGarde Book Oblique
507
7 AvantGarde Demi Oblique
509
9 Bookman Light Italic
511
11 Bookman Demi Italic
515
15 Courier Bold Oblique
519
19 Helvetica Bold Oblique
521
21 Helvetica Narrow Oblique
522
22 Helvetica Narrow Bold
523
23 Helvetica Narrow Bold Oblique
524
24 New Century Schoolbook Roman
525
25 New Century Schoolbook Italic
526
26 New Century Schoolbook Bold
527
27 New Century Schoolbook Bold Italic
531
31 Palatino Bold Italic
533
33 Zapf Chancery Medium Italic