Шрифт:
Создание содержимого уровня блока: <fo:block>
Блоки играют важную роль в XSL-FO: они применяются для создания прямоугольных областей вывода, отделенных от других областей вывода в документе. Форматирующий объект
<fo:block>
применяется для форматирования таких элементов, как абзацы, заголовки, подписи к рисункам и таблицам и т.д. Вот пример из начала главы, где я создаю элемент блока и задаю различные свойства и текст в блоке: <fo:block font-family="Times" line-height="48pt" font-size="36pt">
Welcome to XSL formatting.
</fo:block>
С объектом
<fo:block>
можно применять следующие свойства: • общие свойства доступа:
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
; • общие свойства переноса:
country
, language
, script
, hyphenate
, hyphenation-character
, hyphenation-push-character-count
, hyphenation-remain-character-count
; • общие свойства полей для блоков:
margin-top
, margin-bottom
, margin-left
, margin-right
, space-before
, space-after
, start-indent
, end-indent
; •
break-after
; •
break-before
; •
color
; •
font-height-override-after
; •
font-height-override-before
; •
hyphenation-keep
; •
hyphenation-ladder-count
; •
id
; •
keep-together
; •
keep-with-next
; •
keep-with-previous
; •
last-line-end-indent
; •
linefeed-treatment
; •
line-height
; •
line-height-shift-adjustment
; •
line-stacking-strategy
; •
orphans
; •
relative-position
; •
space-treatment
; •
span
; •
text-align
; •
text-align-last
; •
text-indent
; •
visibility
; •
white-space-collapse
; •
widows
; •
wrap-option
; •
z-index
. Например, я могу добавить в документ заголовок «The Planets Table» (Таблица планет), задав шрифт
Times
(в данный момент fop поставляется с встроенными шрифтами Times
, Helvetica
, Courier
, Symbol
, sans-serif
, serif
и ZapfDingbats
) в свойстве font-family
, размер шрифта 36 пунктов в свойстве font-size
и полужирный стиль, установив свойство font-weight
в «bold
». Высоту блока я задам при помощи свойства line-height
и покажу заголовок голубым при помощи свойства color
: <?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:template match="PLANETS">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
.
.