1.7. Creating New Looks and Document Styles
SDF implements looks and document styles as follows:
- Each look is actually a library (within the look directory).
- Each document style is actually a module (with an sds extension).
As a result, looks and document styles have all the flexibility and features of normal libraries and modules.
The easiest way to create a new look is to inherit details from an existing look. Typically, this involves 3 steps:
For example, the infomap look inherits most of its configuration details from the simple look.
Each library needs its own directory and a main module within it. The look/infomap/infomap.sdm file is simply:
# To remove the header/footer borders, uncomment the line below #!default OPT_BORDERS 0 # Inherit the simple look !inherit "look/simple"
If the page layout is different, you will also need to override the pages.sdm module. For example, the look/infomap/pages.sdm file is:
# Inherit what we can from the simple look !use "look/simple/pages" # Adjust the header/footer size and positioning !define PAGE_FIRST_FOOTER_HEIGHT '0.50in' !define PAGE_FIRST_FOOTER_GAP '0.25in' !define PAGE_RIGHT_HEADER_HEIGHT '0.50in' !define PAGE_RIGHT_HEADER_GAP '0.25in' !define PAGE_RIGHT_FOOTER_HEIGHT '0.50in' !define PAGE_RIGHT_FOOTER_GAP '0.25in' # Adjust the sidehead size !define OPT_SIDEHEAD_WIDTH "90pt" !define OPT_SIDEHEAD_GAP "10pt"
Each look can define a tuning module for each target format which supports looks. As tuning modules are simple modules named with an sdn extension, new tuning modules can easily reuse the configuration details in an existing tuning module.
See the look/infomap/mif.sdn file for an example.
To create a new document style, simply create a module file of the required name with an sds extension in the appropriate look library directory.
For example, to create a new document style called article which is available in all looks, create a module file called article.sds in the look/simple directory.
See the look/simple/*.sds files in the SDF distribution for examples.