Technologies XML / XSL-FO / Référence / Extensions XSL d’Antenna House Formatter / Propriétés / baseline-grid
(Extrait de «XSL-FO ― La Référence » de Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
Catégorie Extensions de blocs >> Grille de lignes de base
Définit ou supprime la grille de lignes de base. V6.3[no-LT]
Valeur : | normal | none | root | new |
Valeur initiale : | normal |
S’applique à : | objets de mise en forme de niveau bloc, fo:flow et fo:static-content / conteneurs de blocs |
Hérité : | no |
Pourcentages : | N/A |
Les valeurs ont les significations suivantes.
normal | Ne définit ni ne supprime la grille. |
none | Supprime la grille ; le contenu ne s’aligne plus sur elle. |
new | Définit une nouvelle grille avec les réglages font et line-height de cet élément. |
root | Utilise la grille définie par l’élément racine, à partir de ses réglages font et line-height. |
Dans l’aire où la grille est définie, les lignes s’alignent sur ses lignes de base. Aucun demi-interlignage n’est ajouté avant la première ni après la dernière ligne, afin d’aligner les bords de la boîte em sur les bords avant et après de la boîte de contenu.
La grille n’est pas disponible si la propriété display-align a une valeur autre que auto.
Exemple HTML+CSS avec grille de lignes de base :
:root { font-size: 10pt; line-height: 18pt; font-family: "Yu Mincho", serif; } @page { size: 128mm 188mm; margin: auto; width: 28rem; height: calc(24rlh - (1rlh - 1rem)); } body { -ah-baseline-grid: root; } h1 { -ah-baseline-grid: new; -ah-baseline-block-snap: center; font-size: 16pt; line-height: 20pt; margin-top: 16pt; margin-bottom: 16pt; } figure { -ah-baseline-grid: none; -ah-baseline-block-snap: auto; }
Exemple XSL-FO avec grille de lignes de base :
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions" font-size="10pt" line-height="18pt" font-family="Yu Mincho, serif"> ... <fo:page-sequence master-reference="master"> <fo:flow flow-name="xsl-region-body" axf:baseline-grid="root"> <fo:block axf:baseline-grid="new" axf:baseline-block-snap="center" font-size="16pt" line-height="20pt" space-before="16pt" space-after="16pt"> Heading ... </fo:block> <fo:block>The quick brown fox jumps....</fo:block> ... <fo:block axf:baseline-grid="none" axf:baseline-block-snap="auto"> Figure ... </fo:block> ... </fo:flow> </fo:page-sequence> </fo:root>
Cette propriété n’est pas disponible avec AH Formatter V6.3 Lite.
Exemple XSL-FO :
<fo:root xml:lang="ja" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<axf:document-info name="document-title" value="行グリッドの設定例"/>
<axf:document-info name="author" value="Antenna House, Inc."/>
<fo:layout-master-set>
<fo:simple-page-master page-height="297mm" page-width="210mm" margin-top="10mm" margin-left="20mm" margin-right="20mm" margin-bottom="10mm" master-name="PageMaster1">
<fo:region-after extent="7mm"/>
<fo:region-body margin-top="0mm" margin-left="0mm" margin-right="0mm" margin-bottom="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="PageMaster1">
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="0.8em" text-align="right" color="green">
<fo:basic-link external-destination="http://www.antenna.co.jp/AHF/">
Antenna House, Inc.
</fo:basic-link>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="serif" font-size="1em" line-height="1.6" axf:hyphenate-hyphenated-word="false" hyphenate="true">
<fo:block span="all" font-family="sans-serif" font-size="2em" font-weight="bold" line-height="2" space-before="1em" space-after="1em" space-before.conditionality="retain" space-after.conditionality="retain" background-color="#EEEEEE">
<fo:block start-indent="1em" end-indent="1em">
行グリッドの設定例
</fo:block>
</fo:block>
<fo:block span="all" space-before="1em" space-after="1em" space-after.conditionality="retain" text-indent="0em" border="1pt solid #9999FF" start-indent="0.5em" end-indent="0.5em" padding="0.5em" text-align="justify">
axf:baseline-grid 指定により、見出しや図があっても各段の行の位置がずれないように行グリッドを設定できます。axf:baseline-grid="new" により新しい行グリッドを設定します。この要素の font と line-height 設定が行グリッドの設定に利用されます。また、root 指定ではルート要素の font と line-height 設定が行グリッドに利用されます。none 指定で行グリッドを解除します。行以外のブロック(見出しや図表)をどのように行グリッドに配置するかは axf:baseline-block-snap で指定します。本サンプルでは既定値 auto border-box(段の先頭では before、最後では after、それ以外では center と同じ)で指定していますが、別々に before、after、center など指定できます。
</fo:block>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:baseline-grid 指定あり
</fo:block>
<fo:block-container height="18em" space-before="0.5em" start-indent="0.5em" end-indent="0.5em" border="solid gray thin" padding="4pt" column-count="2" column-gap="1em" axf:column-rule-style="solid" axf:column-rule-width="1.5pt" axf:column-rule-color="lightgray" axf:column-rule-length="100%" axf:column-rule-align="center">
<fo:block axf:baseline-grid="new" font-size="1em" line-height="14pt" text-align="justify">
<fo:block>
このブロックは axf:baseline-grid="new" で行グリッドを設定してます。
</fo:block>
<fo:block font-size="2.5em" line-height="2" text-align="center" background="lightgray">
見出し
</fo:block>
<fo:block>
いろはにほへとちりぬるをわかよたれそつねならむ
<fo:inline font-size="1.4em" font-weight="bold">
大きい字
</fo:inline>
うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを、
<fo:inline font-size="2.5em" font-weight="bold">
より大きい文字
</fo:inline>
わかよたれそつねならむ、うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるをわかよたれそ。ゐのおくやまけふこえて、あさきゆめみしゑひもせす。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em" axf:baseline-grid="none" axf:baseline-block-snap="auto border-box">
<fo:block font-size="0.9em">
図 axf:baseline-block-snap="auto border-box"(既定値)
</fo:block>
</fo:block-container>
<fo:block>
いろはにほへとちりぬるを、わかよたれそつねならむ。うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em" axf:baseline-grid="none" axf:baseline-block-snap="auto border-box">
<fo:block font-size="0.9em">
図 axf:baseline-block-snap="auto border-box"(既定値)
</fo:block>
</fo:block-container>
<fo:block>
いろはにほへとちりぬるをわかよたれそつねならむ。うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em" axf:baseline-grid="none" axf:baseline-block-snap="auto border-box">
<fo:block font-size="0.9em">
図 axf:baseline-block-snap="auto border-box"(既定値)
</fo:block>
</fo:block-container>
</fo:block>
</fo:block-container>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:baseline-grid 指定なし
</fo:block>
<fo:block-container height="18em" space-before="0.5em" start-indent="0.5em" end-indent="0.5em" border="solid gray thin" padding="4pt" column-count="2" column-gap="1em" axf:column-rule-style="solid" axf:column-rule-width="1.5pt" axf:column-rule-color="lightgray" axf:column-rule-length="100%" axf:column-rule-align="center">
<fo:block font-size="1em" line-height="14pt" text-align="justify">
<fo:block>
このブロックは axf:baseline-grid による行グリッドの指定を行っていません。
</fo:block>
<fo:block font-size="2.5em" line-height="2" text-align="center" background="lightgray">
見出し
</fo:block>
<fo:block>
いろはにほへとちりぬるをわかよたれそつねならむ
<fo:inline font-size="1.4em" font-weight="bold">
大きい字
</fo:inline>
うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを、
<fo:inline font-size="2.5em" font-weight="bold">
より大きい文字
</fo:inline>
わかよたれそつねならむ、うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるをわかよたれそ。ゐのおくやまけふこえて、あさきゆめみしゑひもせす。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em">
<fo:block>
図
</fo:block>
</fo:block-container>
<fo:block>
いろはにほへとちりぬるを、わかよたれそつねならむ。うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em">
<fo:block>
図
</fo:block>
</fo:block-container>
<fo:block>
いろはにほへとちりぬるをわかよたれそつねならむ。うゐのおくやまけふこえて、あさきゆめみしゑひもせす。いろはにほへとちりぬるを。
</fo:block>
<fo:block-container text-align="center" display-align="center" background="lightblue" padding="2pt" height="1.5em">
<fo:block>
図
</fo:block>
</fo:block-container>
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>Sortie :