32 Design of the System Layer

32.1 Driver Files

The PGF system layer mainly consists of a large number of commands starting with \pgfsys@. These commands will be called system commands in the following. The higher layers “interface” with the system layer by calling these commands. The higher layers should never use \special commands directly or even check whether \pdfoutput is defined. Instead, all drawing requests should be “channeled” through the system commands.

The system layer is loaded and setup by the following package:

\usepackage{pgfsys} % LATEX
\input pgfsys.tex % plain TEX
\input pgfsys.tex % ConTEXt

This file provides “default implementations” of all system commands, but most simply produce a warning that they are not implemented. The actual implementations of the system commands for a particular driver like, say, pdftex reside in files called pgfsys-xxxx.sty, where xxxx is the driver name. These will be called driver files in the following.

When pgfsys.sty is loaded, it will try to determine which driver is used by loading pgf.cfg. This file should setup the macro \pgfsysdriver appropriately. The, pgfsys.sty will input the appropriate pgfsys-<drivername>.sty.

\pgfsysdriver

This macro should expand to the name of the driver to be used by pgfsys. The default from pgf.cfg is pgfsys-\Gin@driver. This is very likely to be correct if you are using LATEX. For plain TEX, the macro will be set to pgfsys-pdftex.def if pdftex is used and to pgfsys-dvips.def otherwise.

File pgf.cfg

This file should setup the command \pgfsysdriver correctly. If \pgfsysdriver is already set to some value, the driver normally should not change it. Otherwise, it should make a “good guess” at which driver will be appropriate.

The currently supported backend drivers are discussed in Section 5.2.

32.2 Common Definition Files

Some drivers share many \pgfsys@ commands. For the reason, files defining these “common” commands are available. These files are not usable alone.

File pgfsys-common-postscript

This file defines some \pgfsys@ commands so that they produce appropriate PostScript code.

File pgfsys-common-pdf

This file defines some \pgfsys@ commands so that they produce appropriate PDF code.