DiType User Guide/DiType Intermediate Output Format Specification

From Docs

Revision as of 09:57, 22 May 2008 by WikiAdmin (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

< DiType User Guide

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.xep
The following is an example of formatting a.xep file to PostScript:
ditype afile.xep
cat afile.xep | ditype -f ps > afile.ps
It 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:

Output Elements
Element Description Attributes
<document> The root element. At its beginning and at its end, initialization and finalization are usually performed.
  • creator - Information about the application that created the document.
  • initial-destination (optional) - The part of the document that is moved into focus when the document is first opened.
  • There are several other attributes (such as author or title ) that transfer unchanged from <rx:meta-field> extension formatting objects (if present) in the source document. Their use is implementation-dependent; for example, PDF generator uses them to fill the fields of the Info object.
<page> Wraps a single page of the document. There is one <page> element for each page in the document.
  • height - Height of the page
  • width - Width of the page.
  • page-id - Page number label.
  • page-number - Page number as an ordinal.
<rotate> Rotates the coordinate system.
  • phi - Rotation angle, in degrees. May take values in multiples of 90: 0, 90, 180, 270 degrees. @@@@Clockwise or counterclockwise?
<translate> Shifts the origin of the coordinate system.
  • x - Horizontal shift distance.
  • y - Vertical shift distance.
<word-spacing> Sets word spacing (additional spacing between words).
  • value - The value of word spacing.
<letter-spacing> Sets letter spacing (additional spacing between non-space characters).
  • value - The value of letter spacing.
<font-stretch> Sets font-stretch factor. @@@@What is a "font-stretch factor"?
  • value - The value of font-stretch factor. @@@@Values?
<font> Changes the current font.
  • family - Font family.
  • weight - Font weight (100 to 900). @@@@What is the "normal" font weight - 500?
  • style - Font style (normal, italic, oblique, or backslant).
  • variant - Font variant (normal or small-caps).
  • size - Font size.
<text> Prints a character string.
  • x - Horizontal position of the initial point on the baseline.
  • y - Vertical position of the initial point on the baseline.
  • value - The text string to print.
  • width - Text width.
<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.
  • value - The text string to print.
<line> Draws a line.
  • x-from - Horizontal position of initial point.
  • y-from - Vertical position of initial point.
  • x-till - Horizontal position of final point.
  • y-till - Vertical position of final point.
  • thickness - The thickness of the line.
  • style - The style of the line.
<image> Embeds an external image.
  • src - The source URL of the image.
  • base - The base directory to resolve hrefs in the image.
  • type - The image MIME type.
  • x-from - Horizontal position of the lower-left corner of the image.
  • y-from - Vertical position of the lower-left corner of the image.
  • scale-x - Horizontal scaling factor.
  • scale-y - Vertical scaling factor.
  • role - Alternate description for accessible PDFs.
<gray-color> Sets the current color for stroking and filling. The color is chosen in a grayscale color space.
  • gray - Gray color, value: 0 to 1
<rgb-color> Sets the current color for stroking and filling. The color is chosen in an RGB color space (additive).
  • red - Red color, value: 0 to 1
  • green - Green color, value: 0 to 1
  • blue - Blue color, value: 0 to 1
<cmyk-color> Sets the current color for stroking and filling. The color is chosen in CMYK color space (subtractive).
  • cyan - Cyan color, value: 0 to 1
  • magenta - Magenta color, value: 0 to 1
  • yellow - Yellow color, value: 0 to 1
  • black - Black color, value: 0 to 1
<spot-color> Sets the current color for stroking and filling. The color is chosen in a spot color space (subtractive).
  • colorant - Colorant name
  • tint - Color intensity, value: 0 to1
  • alt-gray - Alternate gray color, value: 0 to 1
  • alt-red - Alternate red color, value: 0 to 1
  • alt-green - Alternate green color, value: 0 to 1
  • alt-blue - Alternate blue color, value: 0 to 1
  • alt-cyan - Alternate cyan color, value: 0 to 1
  • alt-magenta - Alternate magenta color, value: 0 to 1
  • alt-yellow - Alternate yellow color, value: 0 to 1
  • alt-black - Alternate black color, value: 0 to 1

To describe an alternate color, one of the following attribute sets must be present:

  • alt-gray — The default color is grayscale.
  • alt-red , alt-green , alt-blue — The default color is RGB.
  • alt-cyan , alt-magenta , alt-yellow , alt-black — The default color is CMYK.
<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.
  • tint - Color intensity, value: 0 to 1
<rectangle> Draws a filled rectangle.
  • x-from - The horizontal position of the lower-left corner.
  • y-from - The vertical position of the lower-left corner.
  • x-till - The horizontal position of the upper-right corner.
  • y-till - The vertical position of the upper-right corner.
<clip> Sets the clipping area.
  • x-from - The horizontal position of the lower-left corner.
  • y-from - The vertical position of the lower-left corner.
  • x-till - The horizontal position of the upper-right corner.
  • y-till - The vertical position of the upper-right corner.
<polygon> Draws a filled polygon. All verticals but the first one are specified in the contained <point> elements.
  • x-from - The horizontal position of the first vertex.
  • y-from - The vertical position of the first vertex.
<point> Adds a vertex to a polygon.
  • x-till - The horizontal position.
  • y-till - The vertical position.
<target> Sets the endpoint for an internal destination.
  • name - Internal destination name ( id of the element that created the target).
  • x - Horizontal position.
  • y - Vertical position.
<internal-link> Specifies an internal link destination.
  • destination-id - Name of the target endpoint. It should match the name attribute of a <target> element somewhere in the document.
  • destination - The page number to point the link to.
  • x-destination - Horizontal position of the destination point.
  • y-destination - Vertical position of the destination point.
<external-link> Specifies an external link destination.
  • destination - a URL.
  • show-destination - Controls whether to create a new window when jumping to the link target.
<internal-bookmark> Specifies an internal bookmark destination.
  • label - Bookmark text.
  • id - Bookmark ID - a positive integer.
  • parent-id - ID of the parent bookmark, or 0 if the bookmark is a top-level element.
  • destination-id - Name of the target endpoint. It should match the name attribute of a <target> element somewhere in the document.
  • destination - Page number to point the link to.
  • x-destination - Horizontal position of the destination point.
  • y-destination - Vertical position of the destination point.
  • collapse-subtree - Initial state (collapsed or expanded).
<external-bookmark> Specifies an external bookmark destination.
  • label - Bookmark text.
  • id - Bookmark ID - a positive integer.
  • parent-id - ID of the parent bookmark, or 0 if the bookmark is a top-level element.
  • destination - A URL.
  • collapse-subtree - Initial state (collapsed or expanded).
  • show-destination - Controls whether to create a new window when jumping to the link target.

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.



Personal tools