<fo:page-sequence master-name='page'>
<fo:flow flow-name='xsl-region-body'>
<fo:block space-after='12pt' font-weight='bold'
font-size='36pt' text-align='center'>
Using Graphics
</fo:block>
<fo:block text-align='center'>
<fo:external-graphic src='file:xslfo.jpg'/>
</fo:block>
<fo:block space-before='10pt' text-align='center' font-size='24pt'>
An image embedded in a document.
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Документ PDF, созданный из graphics.fo, показан на рис. 12.3.
Рис. 12.3. Отображение рисунка при помощи форматирующих объектов
Вставить рисунок в результирующий документ легко, если вставку поддерживает ваше программное обеспечение. Процессор fop теперь поддерживает рисунки (еще несколько версий назад он этого не делал), поэтому вы можете вставлять рисунки при помощи элемента <fo:external-graphic> следующим образом:
<fo:block text-align='center'>
<fo:external-graphic src='file:xslfo.jpg'/>
</fo:block>
Форматирование первых строк: <fo:initial-property-set>
При помощи элемента <fo:initial-property-set> вы можете задать свойства для первой строки в блоке и отформатировать ее. В следующем примере я форматирую первую строку блока капителью (small caps) при помощи свойства font-variant (которое, кстати, fop не поддерживает):
<fo:block>
<fo:initial-property-set font-variant='small-caps'/>
This text will be displayed in the result document.
The first line will be dis played using small caps.
</fo:block>
С элементом <fo:initial-property-set> можно применять следующие свойства:
• общие свойства доступа: source-document, role;
• общие звуковые свойства: azimuth, cue-after, cue- before, elevation, pause-after, pause-before, pitch, pitch-range, play-during, richness, speak, speak-header, speak-numeral, speak- punctuation, speech-rate, stress, voice-family, volume;
• общие свойства границ, заполнения и заднего фона: background-attachment, background-color, background-image, background-repeat, background-position-horizontal, background-position-vertical, border- before-color, border-before-style, border-before-width, border- after-color, border-after-style, border-after-width, border-start- color, border-start-style, border-start-width, border-end- color, border-end-style, border-end-width, border-top- color, border-top-style, border-top-width, border-bottom- color, border-bottom-style, border-bottom-width, border-left- color, border-left-style, border-left-width, border-right- color, border-right-style, border-right-width, padding- before, padding-after, padding-start, padding-end, padding-top, padding-bottom, padding-left, padding- right;
• общие свойства шрифтов: font-family, font-size, font- stretch, font-size-adjust, font-style, font-variant, font-weight;
• color;
• id;
• letter-spacing;
• line-height;
• line-height-shift-adjustment;
• relative-position;
• score-spaces;
• text-decoration;
• text-shadow;
• text-transform;
• word-spacing.
На этом мы заканчиваем обзор встроенных форматирующих объектов; в следующих разделах мы рассмотрим подстрочный форматирующий объект — сноски.
Создание сносок: <fo:footnote> и <fo:footnote-body>
Сноски называют «подстрочными» (out-of-line) форматирующими объектами, потому что они добавляют текст в нижнюю часть страницы. Сноска создается при помощи элемента <fo:footnote>, а текст тела сноски — при помощи элемента <fo:footnote-body>. В текущей спецификации XSL-FO эти элементы не поддерживают никаких свойств.
В следующем примере, footnotes.fo (листинг 12.5), я использую две сноски в теле документа и добавляю в них текст.
<?xml version='1.0' encoding='UTF-8'?>
<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>
<fo:layout-master-set>
<fo:simple-page-master margin-right='20mm' margin-left='20mm'
margin-bottom='10mm' margin-top='10mm' page-width='300mm'
page-height='400mm' master-name='page'>
<fo:region-body margin-right='0mm' margin-left='0mm'
