10.9 Paths

Postscript (or equivalently PDF) style paths are represented using the fz_path structure. A postscript path consists of a sequence of instructions describing the movement of a ‘pen’ around a given path.

The first instruction is always a ‘move’ to a specified location. Subsequent instructions move the pen position onwards to new positions on the page, either via straight lines, or via curves described by given control points. Such instructions can either be made with the pen up or down.

Once created paths can then be rendered by MuPDF either by being filled, or by being stroked. The path itself has no knowledge of how it will be used - the details of the fill or the stroke attributes are supplied externally to this structure. A description of the exact rules used for filling and stroking are beyond the scope of this document. For more information see “The PDF Reference Manual” or “The Postscript Language Reference Manual”.

Further discussion of paths is postponed to Part 2 in chapter 23 Path Internals. While is is entirely permissible for application callers to want to create their own paths (for passing to device functions) it’s far more typical for callers to simply treat them as ‘black boxes’ to be passed around.