The FIG file format

The FIG file format was introduced by Xfig and is used by WinFIG too. It is a text based, human-readable file format. The # is used to mark comment lines, but also for some content lines and for the figure comment and object comments.

Structure

The structure of a FIG file is fairly simple and contains a sequence of the following blocks (curly braces indicate a variable number of occurences).

Header
{User colors}
{Objects}

Objects can be hierarchically nested using compound structures. A compound is itself an object and can be contained in other compounds.

Compound start
{Objects}
Compound end

A minimal FIG file

This is the contents of a minimal file with only one line made of 2 points:

#FIG 3.2
# Created by WinFIG version 4.5
Portrait
Flush left
Metric
A4
100.00
Single
-2
1200 2
0 32 #c85121
2 1 0 1 32 0 50 0 -1 4.000 0 0 0 0 0 2
	 963 1388 1988 688

The building blocks explained