XML technologies / XSL-FO / Reference / Antenna House Formatter XSL Extensions / Properties / ruby-align

(Excerpt from “XSL-FO ― The Reference” by 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

Category Ruby Extended Properties

Specifies the alignment of ruby. [CSS3-Ruby] Ruby alignment: the 'ruby-align' property

Value:

auto | [[distribute-space | distribute-letter] || [center | start | end | start-if-vertical]]

Initial:

auto

Applies to:

axf:ruby

Inherited:

yes

Percentages:

N/A

Values have the following meanings.

auto

The value specified by ruby-align in the Option Setting File is adopted.

distribute-space

Same as distribute-space center.

distribute-space center

Spaces leading and following the ruby text are made and the ruby text is evenly distributed. If the ruby text consists of one character, then it's center aligned.

distribute-space start

Spaces leading and following the ruby text are made and the ruby text is evenly distributed. If the ruby text consists of one character, then it is start aligned.

distribute-letter

Same as distribute-letter center.

distribute-letter center

Spaces leading and following the ruby text are not made and the ruby text is evenly distributed. If the ruby text consists of one character, then it is center aligned.

distribute-letter start

Spaces leading and following the ruby text are not made and the ruby text is evenly distributed. If the ruby text consists of one character, then it is start aligned.

center

Ruby is positioned at the center with solid setting.

start

Ruby is positioned on the start side with solid setting.

end

Ruby is positioned on the end side with solid setting.

start-if-vertical

Same as start if the writing-mode is vertical, same as center if the writing-mode is horizontal.

axf:ruby-align decides the alignment of ruby. Originally, center alignment and start alignment are the concept of mono-ruby, however, the same concept is also applied for group-ruby whose base text has 2 or more characters. When ruby is longer than its base characters, ruby will be positioned with solid setting.

Center alignment of mono-ruby can be specified as follows;

<ruby ruby-align="center"><rb>地</rb><rt>ち</rt></ruby>

Start alignment of mono-ruby can be specified as follows;

<ruby ruby-align="start"><rb>地</rb><rt>ち</rt></ruby>

The following shows the example of giving spaces leading and following the ruby text in group-ruby. The amount of spaces leading and following the ruby text is half the amount of inter-character space of the ruby text.

<ruby ruby-align="distribute-space"><rb>紫陽花</rb><rt>あじさい</rt></ruby>

The following shows the example of not giving spaces leading and following the ruby text in group-ruby.

<ruby ruby-align="distribute-letter"><rb>紫陽花</rb><rt>あじさい</rt></ruby>

XSL-FO sample:

<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:ruby-align によりルビの配置を指定できます。また、親文字に対しての配置を axf:ruby-position、ルビと親文字の間隔を axf:ruby-offset、ルビに小書きのかなを許すかどうかを axf:ruby-small-kana により指定できます。
</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:ruby-align(ルビの配置指定)
</fo:block>
<fo:block>
start側、center(中央)、end側 への配置指定
</fo:block>
<fo:block-container column-count="3" column-gap="8pt">
<fo:block>
ruby-align="start"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby ruby-align="start">
<axf:ruby-base>
地
</axf:ruby-base>
<axf:ruby-text>
ち
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block>
ruby-align="center"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby ruby-align="center">
<axf:ruby-base>
地
</axf:ruby-base>
<axf:ruby-text>
ち
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block>
ruby-align="end"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby ruby-align="end">
<axf:ruby-base>
地
</axf:ruby-base>
<axf:ruby-text>
ち
</axf:ruby-text>
</axf:ruby>
</fo:block>
</fo:block-container>
<fo:block space-before="1.5em">
均等割り付け distribute-space(ルビ前後を空ける)、distribute-letter(ルビ前後を空けない)の配置指定
</fo:block>
<fo:block-container column-count="3" column-gap="8pt">
<fo:block>
ruby-align="distribute-space"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby ruby-align="distribute-space">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block>
ruby-align="distribute-letter"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby ruby-align="distribute-letter">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</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:ruby-position(親文字に対する配置指定)
</fo:block>
<fo:block>
ルビを親文字の before側、after側 への配置指定
</fo:block>
<fo:block-container column-count="3" column-gap="8pt">
<fo:block font-size="0.9em">
axf:ruby-position="before"(既定値)
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-position="before">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block font-size="0.9em">
axf:ruby-position="after"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-position="after">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</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:ruby-offset(ルビと親文字の間隔の指定)
</fo:block>
<fo:block>
ルビと親文字の間隔の指定。間隔は number(ルビのフォントサイズと掛け合わせた値)、length(長さ指定)、percentage(フォントサイズと掛け合わせた値)で指定します。
</fo:block>
<fo:block-container column-count="3" column-gap="8pt">
<fo:block space-after="0.5em" font-size="0.9em">
axf:ruby axf:ruby-offset="0pt"(既定値)
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-offset="0pt">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block space-after="0.5em" font-size="0.9em">
axf:ruby axf:ruby-offset="5pt"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-offset="5pt">
<axf:ruby-base>
紫陽花
</axf:ruby-base>
<axf:ruby-text>
あじさい
</axf:ruby-text>
</axf:ruby>
</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:ruby-small-kana(ルビへの小文字の許可を指定)
</fo:block>
<fo:block space-after="0.5em">
auto(何もしません)、convert(小書きのかなは普通のかなに変換されます)
</fo:block>
<fo:block-container column-count="3" column-gap="8pt">
<fo:block font-size="0.9em">
axf:ruby-small-kana="auto"(既定値)
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-small-kana="auto">
<axf:ruby-base>
一寸
</axf:ruby-base>
<axf:ruby-text>
ちょっと
</axf:ruby-text>
</axf:ruby>
</fo:block>
<fo:block font-size="0.9em">
axf:ruby-small-kana="convert"
</fo:block>
<fo:block line-height="2" font-size="2.5em">
<axf:ruby axf:ruby-small-kana="convert">
<axf:ruby-base>
一寸
</axf:ruby-base>
<axf:ruby-text>
ちょっと
</axf:ruby-text>
</axf:ruby>
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>

Download examples

Output:

back to top