DiType User Guide/DiType Intermediate Output Format Specification
From Docs
DiType Intermediate Output Format Specification
This section describes the DiType intermediate output format — an XML based representation of the layout that is passed from the renderer to the final output generators (PDF, PostScript, etc). All elements reside in a separate namespace, http://www.renderx.com/DITYPE/xep. All lengths are measured in units of 0.001 pt (1/72,000 inch), and expressed as integers.
The specification for DiType Intermediate Output Format is a RelaxNG grammar stored in a file named "xepout.rnc". This file is available within each distribution of DiType in "lib/schema" directory. The file "xepout.rnc" is used in DiType for validation of input files that pretend to be the DiType Intermediate Format.
The DiType Intermediate Format may serve both as input and as output format for DiType. The following commands will process an input file "afile.xml" to the Intermediate Format, resulting in a file named "afile.xep":ditype -f xep afile.xml
cat afile.xml | ditype -f xep > afile.xepThe following is an example of formatting a.xep file to PostScript:
ditype afile.xep
cat afile.xep | ditype -f ps > afile.psIt is also possible to create pipes like this:
cat afile.xml | ditype -f xep | ditype -f pdf > afile.pdf
cat afile.xml | ditype -f xep | 4xslt - postprocess.xsl | \ ditype -f pdf > afile.pdf
The following table provides a detailed description of the output elements of the Intermediate Format:
| Element | Description | Attributes |
|---|---|---|
<document>
| The root element. At its beginning and at its end, initialization and finalization are usually performed. |
|
<page>
| Wraps a single page of the document. There is one <page> element for each page in the document.
|
|
<rotate>
| Rotates the coordinate system. |
|
<translate>
| Shifts the origin of the coordinate system. |
|
<word-spacing>
| Sets word spacing (additional spacing between words). |
|
<letter-spacing>
| Sets letter spacing (additional spacing between non-space characters). |
|
<font-stretch>
| Sets font-stretch factor. @@@@What is a "font-stretch factor"? |
|
<font>
| Changes the current font. |
|
<text>
| Prints a character string. |
|
<more-text>
| Prints a character string adjacent to the string generated by the parent text and preceding more-text elements. The element is used for output of text fragments consisting of glyphs from multiple fonts.
|
|
<line>
| Draws a line. |
|
<image>
| Embeds an external image. |
|
<gray-color>
| Sets the current color for stroking and filling. The color is chosen in a grayscale color space. |
|
<rgb-color>
| Sets the current color for stroking and filling. The color is chosen in an RGB color space (additive). |
|
<cmyk-color>
| Sets the current color for stroking and filling. The color is chosen in CMYK color space (subtractive). |
|
<spot-color>
| Sets the current color for stroking and filling. The color is chosen in a spot color space (subtractive). |
To describe an alternate color, one of the following attribute sets must be present:
|
<registration-color>
| Sets the current color for stroking and filling. The color is chosen in registration color space (subtractive): it appears on all separations in the document. |
|
<rectangle>
| Draws a filled rectangle. |
|
<clip>
| Sets the clipping area. |
|
<polygon>
| Draws a filled polygon. All verticals but the first one are specified in the contained <point> elements.
|
|
<point>
| Adds a vertex to a polygon. |
|
<target>
| Sets the endpoint for an internal destination. |
|
<internal-link>
| Specifies an internal link destination. |
|
<external-link>
| Specifies an external link destination. |
|
<internal-bookmark>
| Specifies an internal bookmark destination. |
|
<external-bookmark>
| Specifies an external bookmark destination. |
|
Processing InstructionsProcessing instructions may appear in the output. They are taken from the source file and passed straight to the generator with no modification. The placement of processing instructions meets the following conditions:
- Instructions placed before
<fo:root>element in the source file are reproduced at the very top, before the root<document>element.
- Instructions placed inside an
<fo:simple-page-master>element are reproduced on each page generated using that master, immediately after the opening tag of the<page>element.
All other processing instructions may vanish during formatting. Except for those specified above, ordering of instructions is not preserved.
TODO: describe differences between XEPOUT of XEP4 and of DiType; make the description table match the schema; check the PIs.
