CFDG HOWTO v2

A CFDG file consists mostly of several rules for drawing shapes using other shapes. There are a few other optional components and one mandatory component:
 * A mandatory startshape directive that tells Context Free/CFDG what shape to start with. There must be at least one startshape. If there is more than one then the first one is the one that is used.
 * An optional background directive that tells Context Free/CFDG what color to make the background. If there is no background directive then the background is opaque white.
 * An optional tile directive that tells Context Free/CFDG to draw a tiled version of the design using the tiling grid specified by the tile directive.
 * An optional size directive that restricts the drawing canvas to a specific size and position. Shapes drawn outside this rectangle are cropped.
 * Optional include directives that direct Context Free/CFDG to insert another CFDG file at the current position. There can be more than one include directives and included files can include other files.
 * One or more shape rules that tell Context Free/CFDG how to draw a shape using other shape rules and primitive shapes. There is no limit to the number of rules. A given shape can also have many rules or just one rule.
 * Optional Paths that tell Context Free how to draw a primitive shape.
 * Optional comment lines that describe how the CFDG file works. Context Free/CFDG supports C-style block comments and C++ and shell-script style line comments.

Here is an example of all these CFDG file parts:


 * shape adjustments are used to pass graphical qualities like size, brightness, saturation, rotation angle, and other qualities (if you wondered what the { b -1 } and { s 3 4 } mean, that is it)

After getting familiar with the basics, you might want to proceed to the tutorials. If you have trouble remembering all of the details in the cfdg syntax then check out the reference card.

See also the Context Free cans and cannots.