6. Typographical means
XSL-FO is used for the automated layout in a typesetting and break system. Therefore, XSL-FO offers typographical means which are usually used in other typesetting sytems and which partially exceed these in the form of various attributes and elements. They are outlined in the following sections.
Here, an example for some typographical details:
... <fo:block> <fo:inline text-decoration="underline"> Unterstrichen, <!-- en: Underlined, --> </fo:inline> <fo:inline text-decoration="line-through"> durchgestrichen <!-- lined through --> </fo:inline> </fo:block> <fo:block letter-spacing="3mm"> Sehr weit gesperrt. <!-- Very wide spacing. --> </fo:block> <fo:block word-spacing="15mm"> Sehr große Wortabstände. <!-- Very large word spacings. --> </fo:block> <fo:block text-transform="uppercase"> Transformation in Grossbuchstaben. <!-- Transformation into upper case letters. --> </fo:block> <fo:block > Diese Zeichenfolge ist <!-- This character string is --> <fo:inline baseline-shift="30%"> hoch <!-- superscripted --> </fo:inline> und diese <!-- and this one is --> <fo:inline baseline-shift="-30%"> tief gestellt. <!-- subscripted. --> </fo:inline> </fo:block> <fo:block text-align="left"> linksbündig <!-- left-aligned --> </fo:block> <fo:block text-align="right"> rechtsbündig <!-- right-aligned --> </fo:block> <fo:block text-align="center"> mittig zentriert. <!-- centered. --> </fo:block> <fo:block text-align="justify" text-align-last="right"> Dies ist ein Beispiel eines Blocksatzes. Dies ist ein Beispiel eines Blocksatzes. Dies ist ein Beispiel eines Blocksatzes. Dies ist ein Beispiel eines Blocksatzes. Dies ist ein Beispiel eines Blocksatzes. Dies ist ein Beispiel eines Blocksatzes. <!-- This is an example of a justified text. --> Dies ist ein Beispiel eines Blocksatzes mit einer letzten rechtsbündigen Zeile. <!-- This is an example of a justified text with a last right-aligned line. --> </fo:block> ...
6.1. Text alignment
The attributes text-align and text-align-last determine in which way the textual content shall be aligned in a block. The text-align-last attribute allows a separate treatment for the last line of a block. The possible values for the text alignment are:
left (left-aligned, ragged right)
right (right-aligned, ragged left)
justify (justification, text is aligned to both the left and right margins, adding extra space between words as necessary)
inside (centered to the gutter; left side right-aligned – right side left-aligned)
outside (centered to the outer bleed margin; left side left-aligned – right side right-aligned)
start (alignment with the start region; important for languages with another writing direction as lr-tb)
end (alignmemt with the end region; important for languages with another writing direction as lr-tb)
The two attributes for indenting paragraphs, start-indent and end-indent, have already been introduced. In addition to these two attributes, there are text-indent and last-line-end-indent.
Whereas an entire block, which means all lines of this block, is indented in the start and end region by start-indent and end-indent, the text-indent attribute accesses only the first line in the start region. With the help of the last-line-end-indent attribute, the paragraph is indented in the start region when using a positive number and in the end region when using a negative number.
<fo:block text-align="justify" start-indent="10mm" end-indent="10mm" text-indent="-10mm"> Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug, Hängender Einzug <!-- en: Hanging Indent, Hanging Indent, ... --> </fo:block> <fo:block space-before="5mm" text-align="justify" text-indent="10mm"> Einzug der ersten Zeile, Einzug der ersten Zeile, Einzug der ersten Zeile, Einzug der ersten Zeile, Einzug der ersten Zeile, Einzug der ersten Zeile <!-- Indentation of the first line, Indentation of the first line, ... --> </fo:block>
6.3. The typeface / the font
With the font-family attribute a typeface or a font is selected. The attribute value is passed on the substructures in the document to be processed.
At this point, it is worth mentioning possible sources of errors which may occur in practice.
If you use the Antenna House Formatter, you can find under the formatter options all typefaces/fonts being supported by the system with their exact names.
In these options fonts can be determined as default values which can be used as an alternative to undefined fonts in the stylesheet.
However, it is recommended to define all fonts and font sizes used in the stylesheet by oneself. In this way, a possible error source is eliminated if the data is processed on another computer or with another formatter.
6.4. The font size
The font size is determined with the font-size attribute. All XSL-FO units of measurement are allowed, for example the common points with their abbreviation pt., in order to indicate the font size. Also possible but not very common is the indication of a percentage in relation to the unit to be inherited, meaning the font size being valid in the given environment.
According to the German standards all typographical measurements have to be indicated in millimetres. With regard to the application of measurements in XSL-FO when using the common formatters it must be pointed out that only one position after the decimal point is realised. Therefore, when indicating in millimetres, the smallest measured value is one tenth of a millimetre. For this reason, points can be significantly more precise since a tenth of a point is only one third of the tenth of a millimetre.
The attribute value for the font size is passed on the substructures in the document to be processed.
6.5. The line height and the line spacing
With the line-height attribute the line height and accordingly the line spacing is determined. Here, also the XSL-FO units of measurement as well as the indication of a percentage is acceptable.
In practice it is advisible to always indicate this information. If the line height and the font size are not specified in the stylesheet, there is a risk that they are added by the default value of the formatter.
The attribute value for the line height is passed on the substructures in the document to be processed.
6.6. The typeface and the font style
The typeface can be controlled with the attributes font-style and font-weight. The attribute values for the typefaces are passed on the substructures of the document to be processed.
The font-style attribute makes it possible to display different italics. With the attribute value italic a font style is indicated which contains in its name the word italic or the like. With the attribute values oblique and backslant a font style is indicated in which the normal typeface is slanted to the right or to the left. With the attribute value normal the normal typeface is indicated. In most environments only the typefaces normal and italic are available. If the appropriate typeface is missing, the formattter ignores the not supported ones.
With font-weight the weight of the font can be determined. Allowed values are: bold, bolder, lighter, 100, 200 etc. up to 900. In common practice only one typeface for bold will be available.
6.7. Underline, overline and line-through
The text-decoration attribute effects that a text is underlined, overlined or lined through. If the attribute is used for a block element, the attribute value applies for all subordinated elements. If it is used for an inline element, it only applies for the content of the given element.
The attribute may have the following values:
underline (simple underlining)
overline (simple overlining)
line-through (simple lining through)
none (no underlining, overlining or lining through)
text-decoration is not a font attribute but a performance feature of the formatter.
Although the hyphenation is not a direct typographical feature, it strongly affects the quality of the typeface by narrow word spaces, a good line break and an uniformly dense greyscale image of the text blocks. XSL-FO offers a differentiated specification equipment for the line break. But the quality of the typesetting result is a criterion of the used formatter because it implements the specification for the line break according to its own rules.
The possible settings for the hyphenation attributes of XSL-FO are:
hyphenate (hyphenation wanted or unwanted; therefore possible attribute values are true and false; the default value is false)
hyphenation-character (separator; the default value is the normal hyphen)
hyphenation-keep (hyphenation at the end of a column or page; attribute values column and page prevent hyphenation at the end of a column or page; the default value is auto which means no special feature for the hyphenation)
hyphenation-ladder-count (indication of the maximal number of successive lines for which the hyphenation shall be allowed; the default value does not limit the number of lines)
hyphenation-push-character-count (specifies the minimum number of letters for a word which have to be displayed after the separator in the next line; the default value is 2)
hyphenation-remain-character-count (specifies the minimum number of letters for a word which have to be displayed before the separator; the default value is 2)
country (the attribute value is a standardised abbreviation for a country; no default value)
language (the attribute value is a standardised abbreviation for a language; no default value; for English en)
All attributes pass their attribute values on the substructures.
<fo:block hyphenate="true" hyphenation-character="!" hyphenation-push-character-count="2" hyphenation-remain-character-count="3" language="de"> Long words such as Pseudoantidisestablishmentarianism must be hyphenated. <fo:block>
For the Antenna House Formatter the specification hyphenate="true" xml:lang="en" is common for the hyphenation in English. For the other hyphenation attributes cited above, the corresponding default values of XSL-FO apply. For the entry of a separator which is only set if the word is separated at the end of a line, the "soft" hyphen is used (Unicode character �AD;).
6.9. Horizontal lines in blocks
With the <fo:leader> element horizontal lines in blocks and lines can be generated. In practice those lines are often used as leader lines in tables of contents between the text and the page number outdented to the right. The lines as well as the borders can be dashed, dotted or solid or they can also consist of self-defined characters.
For an exact determination, a number of attributes is available:
leader-length (length of the line; default values are minimal 0pt, optimal 12pt, maximal 100%, which means that normally the line completely fills out the space in a row where is no text)
leader-pattern (pattern of a filling character; possible values are: space (space character), dots (dotted), rule (ruled) or use-content (any character pattern which is included in the <fo:leader> element as content)
rule-style (pattern of the line; possible values are: dotted, dashed, solid, double, groove (see code example, picture below) and ridge (see code example, picture below)
rule-thickness (thickness of the line; the default value is 1pt)
color (colour; the default value is determined by the formatter, usually black)
Furthermore, a number of other attributes is defined which have no real significance in practice or which are not yet supported by any formatter.
<fo:block> <fo:leader leader-pattern="use-content" leader-length="90%"> (1) Trennlinie Trennlinie Trennlinie Trennlinie <!-- en: separation line ... --> </fo:leader> <fo:leader leader-pattern="rule" leader-length="70%" (2) rule-style="dotted" rule-thickness="5pt"/>DOTTED <fo:leader leader-pattern="rule" leader-length="70%" (2) rule-style="dashed" rule-thickness="1pt"/>DASHED <fo:leader leader-pattern="rule" leader-length="70%" (2) rule-style="double" rule-thickness="1pt"/>DOUBLE <fo:leader leader-pattern="rule" leader-length="70%" (2) rule-style="ridge" rule-thickness="10pt"/>RIDGE <fo:leader leader-pattern="rule" leader-length="70%" (2) rule-style="groove" rule-thickness="10pt"/>GROOVE </fo:block>
(1) By setting the leader-pattern attribute to the value use-content, the content of the <fo:leader> element is used for generating a leader line.
(2) Here, various patterns with different line widths are listed.
Typically, the <fo:leader> element is used as a leader line in tables of contents.
<fo:block text-align-last="justify"> Kapitel: Horizontale Linien <!-- en: Chapter: Horizontal lines --> <fo:leader leader-pattern="rule" rule-style="dotted" rule-thickness="1pt"/> Seite 18 <!-- Page 18 --> </fo:block>
6.10. Upper and lower case letters
The text-transform attribute is used for transforming upper and lower case letters. It offers four possibilities:
capitalize transforms the first letter of a word into a capital letter.
uppercase transforms all lower case letters into upper case letters.
lowercase transforms all upper case letters into lower case letters.
none maintains the upper and lower case letters. This value is the default value.
6.11. Character spacing
The spacing of characters can be controlled with the help of the letter-spacing attribute. It defines the white space between two letters of a word beyond the normal character spaces. The value is indicated in absolute measures and can be negative as well as positive. The default value is normal. Negative values for the white space are treated differently by the formatters, usually they are ignored.
6.12. Word spacing
The word-spacing attribute regulates the space between two words beyond the normal word spacing. Here too, absolute measures have to be indicated which can also be positive as well as negative. The default value is normal. Negative values for the word spacing are treated differently by the formatters, usually they are ignored.
6.13. Superscript and subscript
The baseline-shift attribute shifts the baseline of this text passage in relation to the environment. This shift can be indicated in percent or absolutely with a positive or negative value or by the use of the values super (superscript) and sub (subscript). The default value baseline generates no shift.
The vertical-align attribute, for a vertical alignment, can alternatively be used in inline elements and in table cells. Its possible values are: baseline (baseline, no shift; default value), middle (in the middle of a table cell), sub (subscript), super (superscript), text-top (placed at the top of a table cell), text-bottom (placed at the bottom of a table cell), a percentage value (positive values shift to the top, negative values shift to the bottom), an absolute value (positive values shift to the top, negative values shift to the bottom), top (in the given line placed at the top) or bottom (in the given line placed at the bottom).
6.14. Control of the line, column and page break
For the directed control of breaks the attributes which are common in other typesetting systems are available. They can be divided into four groups:
attributes to prevent so-called orphans and widows
attributes to prevent breaks, they are keep-together, keep-with-next and keep-with-previous
attributes to enforce breaks, they are break-after and break-before
attributes to enforce or to prevent breaks, can be used alternatively, they are page-break-after, page-break-before and page-break-inside
The application of these attributes and the effects of their attribute values:
The orphans attribute specifies how many lines of a block at least have to be kept together at the foot of a column or page. The default value is 2.
The widows attribute specifies how many lines of a block at least have to be kept together at the head of a column or page. The default value is 2.
The attributes to prevent breaks which are keep-together (keeping together of the given block or inline element), keep-with-next (keeping together of the given block with the next block or of the given inline element with the next text) and keep-with-previous (keeping together of the given block with the previous block or of the given inline element with the previous text) have the same application logic. Their default values are .within-line=auto, .within-column=auto and .within-page=auto, which means no condition for the keeping together is set. In order to enforce the keeping together under all circumstances, the attribute is set to the value always. Integers as attribute value, for example 3, are implemented by the formatter depending on the context and they weaken the necessity of keeping together.
The attributes to enforce breaks, break-after and break-before, are set for blocks and effect by their attribute values a break after or before the block. The default value is auto, which means no condition is set for the break. With the attribute values column, page, even-page (left or even-numbered page) and odd-page (right or odd-numbered page) an appropriate break is effected. Where appropriate, a blank page is inserted.
The attributes which can be used alternatively to enforce or prevent breaks page-break-after (break after the given block), page-break-before (break before the given block) and page-break-inside (break inside the given block) only concern the page break. They are short notations for the attributes described above. The default value auto for all of these attributes does neither prevent nor enforce a break.
The page-break-inside attribute only has one alternative attribute value, avoid, which keeps the given block together.
In page-break-after and page-break-before, avoid has the same effect with regard to the next and the previous block. Further possible attribute values are always (page break under all conditions), left (page break so that the next or the previous page is a left, even-numbered page) and right (page break so that the next or the previous page is a right, odd-numbered page). Where appropriate, a blank page is inserted.
|<< back||next >>|
Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399, email@example.com