Ruby Extension
AH Formatter V6.0 is capable of expressing ruby. AH Formatter V5 or earlier could not express ruby directly, there was no other choice to use fo:inline-container etc. and follow an example. Therefore, there were a lot of restrictions for arranging ruby and the line break. The ruby extension removed such restrictions and the original ruby is expressible. V6.0
See also the followings for more details of ruby.
Ruby is expressed by the following three elements.
| XSL-FO | HTML | CSS | Meanings |
|---|---|---|---|
| <axf:ruby> | <ruby> | display: ruby | Shows the ruby structure. |
| <axf:ruby-base> | <rb> | display: ruby-base | Shows the base character of ruby. |
| <axf:ruby-text> | <rt> | display: ruby-text | Shows ruby. |
One <axf:ruby-base> maps to one <axf:ruby-text>. A pair of one <axf:ruby-base> and <axf:ruby-text> is called the ruby container. The line can break between a ruby containter and another ruby container though the line cannot break within a ruby container.
Ruby has three types and it is classified as follows. (<ruby> <rb> <rt> are used in the following example.)
Mono-ruby is expressed as follows.
<ruby><rb>京</rb><rt>きよう</rt></ruby><ruby><rb>都</rb><rt>と</rt></ruby><ruby><rb>府</rb><rt>ふ</rt></ruby>
Mono-ruby can be considered as a group ruby whose base character consists of one character. The ruby container of mono-ruby is independent and ruby characters never overhang the base character of the adjacent ruby.
Group-ruby is expressed as follows.
<ruby><rb>京都府</rb><rt>きようとふ</rt></ruby>
Group-ruby can be considered as a jyukugo (idiom) ruby whose base character consists of one character. Group-ruby is evenly arranged to the entire base characters.
Jukugo-ruby is expressed as follows.
<ruby><rb>京</rb><rt>きよう</rt><rb>都</rb><rt>と</rt><rb>府</rb><rt>ふ</rt></ruby>
Jyukugo-ruby consists of one or more ruby containers. The line can break between ruby containters. The method of arranging Jyukogo-ruby is complex. As a general rule, the ruby container arranges ruby as group-ruby. However when the ruby text is wider than the ruby base characeters, ruby text is allowed to partially overhang any adjacent text in addition to its own base to adjust its position.
鬼門の方角を<ruby><rb>凝</rb><rt>ぎよう</rt><rb>視</rb><rt>し</rt></ruby>する。
When ruby is wider than its own base characters, ruby will overhang the adjacent character. In the following cases, ruby cannot overhang the character.
Ruby and emphasis marks can be used together. When the ruby and emphasis marks are put on the same side, emphasis marks will be put outside of ruby. When you want to align emphasis marks to the text without ruby and emphasis marks to ruby, please specify axf:text-emphasis-offset.
... text-emphasis-offset="0.5em">ルビと<ruby><rb>圏点</rb><rt>けんてん</rt></ruby>
With group-ruby, ruby can overhang both side of text or it can be nested several times. At this time, only ruby specified on the outside can overhang the adjacent character.
<ruby ruby-position="after"><rb><ruby ruby-position="before"><rb>東南</rb><rt>とうなん</rt></ruby></rb><rt>たつみ</rt></ruby>の方向
In AH Formatter V6.0, ruby has the following restrictions.
Specifies the ruby structure.
Generates and returns the ruby area.
<!ELEMENT axf:ruby (axf:ruby-base, axf:ruby-text)+> <!ATTLIST axf:ruby axf:ruby-align CDATA "auto"> <!ATTLIST axf:ruby axf:ruby-position CDATA "before"> <!ATTLIST axf:ruby axf:ruby-offset CDATA "0pt"> <!ATTLIST axf:ruby axf:ruby-overhang CDATA "auto"> <!ATTLIST axf:ruby axf:ruby-limit-overhang CDATA "1.0"> <!ATTLIST axf:ruby axf:ruby-limit-space CDATA "1.0"> <!ATTLIST axf:ruby axf:ruby-small-kana CDATA "auto"> <!ATTLIST axf:ruby axf:ruby-font-family CDATA #IMPLIED> <!ATTLIST axf:ruby axf:ruby-font-size CDATA "0.5"> <!ATTLIST axf:ruby axf:ruby-minimum-font-size CDATA #IMPLIED> <!ATTLIST axf:ruby axf:ruby-font-style CDATA #IMPLIED> <!ATTLIST axf:ruby axf:ruby-font-weight CDATA #IMPLIED> <!ATTLIST axf:ruby axf:ruby-font-stretch CDATA #IMPLIED> <!ATTLIST axf:ruby axf:ruby-condense CDATA "none"> <!ATTLIST axf:ruby axf:ruby-color CDATA #IMPLIED>
Specifies the base character of ruby.
Generates and returns the text area.
<!ELEMENT axf:ruby-base (#PCDATA | axf:ruby)>
Specifies ruby.
Generates and returns the text area. This text area does not impact upon the block progression dimension in the line area.
<!ELEMENT axf:ruby-text #PCDATA>
Within the axf:ruby extension elements, the Nth axf:ruby-text extension element addresses to the Nth axf:ruby-base extension element. The Nth axf:ruby-text extension element must be placed after the Nth axf:ruby-base extension element.
Specifies the alignment of ruby. V6.0
| 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.
The value specified by ruby-align in the Option Setting File is adopted.
Same as distribute-space center.
Spaces before and after ruby are made and ruby is evenly distributed. If ruby consists of one character, then it's center aligned.
Spaces before and after ruby are made and ruby is evenly distributed. If ruby consists of one character, then it is start aligned.
Same as distribute-letter center.
Spaces before and after ruby are not made and ruby is evenly distributed. If ruby consists of one character, then it is center aligned.
Spaces before and after ruby are not made and ruby is evenly distributed. If ruby consists of one character, then it is start aligned.
Ruby is positioned at the center with solid setting.
Ruby is positioned on the start side with solid setting.
Ruby is positioned on the end side with solid setting.
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 more than 2 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 before and after group-ruby. The amount of space before and after the ruby is harf the size of a character.
<ruby ruby-align="distribute-space"><rb>紫陽花</rb><rt>あじさい</rt></ruby>
The following shows the example of not giving spaces before and after group-ruby.
<ruby ruby-align="distribute-letter"><rb>紫陽花</rb><rt>あじさい</rt></ruby>
Specifies on which side of base characters ruby overhangs. V6.0
| Value: | before | after |
| Initial: | before |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
Values have the following meanings.
Ruby overhangs on the before side.
Ruby overhangs on the after side.
Specifies the spacing between ruby and its base character. V6.0
| Value: | <number> | <length> | <percentage> |
| Initial: | 0pt |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the font size |
Values have the following meanings.
It's a value created by crossing the font size of ruby (axf:ruby-font-size) in the axf:ruby-text element.
Specifies the length.
It's a value created by crossing the font size (not the font size of ruby).
Specifies how ruby overhangs the adjacent base character. V6.0
| Value: | none | auto | [start || end || except-kanji || except-katakana || except-start-open-parenthesis || except-end-close-parenthesis] |
| Initial: | auto |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
Values have the following meanings.
Does not overhang the adjacent base character.
Same as start end except-kanji
Overhangs on the start side of the adjacent base character (if available).
Overhangs on the end side of the adjacent base character (if available).
Does not overhang when the adjacent base character is kanji.
Does not overhang when the adjacent base character is katakana.
Does not overhang when the open parenthesis is on the start side.
Does not overhang when the close parenthesis is on the end side.
When only except-* is specified and neither start nor end are specified, it is considered as start and end are specified.
Specifies the limit of the amount that ruby overhangs the adjacent base character when ruby is longer than its own base character. V6.0
| Value: | <number> | <length> | <percentage> |
| Initial: | 1.0 |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the font size |
Values have the following meanings.
It's a value created by crossing the font size of ruby (axf:ruby-font-size) in the axf:ruby-text element. The value should be non-negative.
Specifies the length. The value should be non-negative.
It's a value created by crossing the font size (not the font size of ruby). The value should be non-negative.
This value shows the amount that ruby overhangs the adjacent base character (It is not a protruding amount).
Specifies the limit of the amount of the space before and after the ruby when ruby is shorter than its base characters. V6.0
| Value: | <number> | <length> | <percentage> | none |
| Initial: | 1.0 |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the font size |
Values have the following meanings.
It's a value created by crossing the font size of ruby (axf:ruby-font-size) in the axf:ruby-text element. The value should be non-negative.
Specifies the length. The value should be non-negative.
It's a value created by crossing the font size (not the font size of ruby). The value should be non-negative.
Does not limit the amount of the space.
Possible to avoid generating too much spaces before and after the ruby because ruby is too shorter than its base characters when axf:ruby-align="distribute-space" is specified. The amount of the space will be limitted to the specified value.
<ruby ruby-limit-space="none"><rb>なげきの聖母像</rb><rt>ピエタ</rt></ruby>
<ruby ruby-limit-space="1.0"><rb>なげきの聖母像</rb><rt>ピエタ</rt></ruby>
Specifies whether to allow using small kana for ruby. V6.0
| Value: | auto | convert |
| Initial: | auto |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
Values have the following meanings.
Does nothing.
Small kana of only full width is converted into the general kana. Half width characters will not be converted.
It's made available not to use small kana for ruby. Even if small kana is specified to ruby in FO, it will be transformed into the original kana.
<ruby ruby-small-kana="convert"><rb>一寸</rb><rt>ちょっと</rt></ruby>
When ruby-small-kana="auto" is specified, there is nothing special. Small kana will be applied for ruby as is unless text-transform="fullsize-kana" is specified.
<ruby ruby-small-kana="auto"><rb>一寸</rb><rt>ちょっと</rt></ruby>
Specifies the font family of ruby. V6.0
| Value: | [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>] |
| Initial: | empty string |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
If nothing is specified, it's considered the same as font-family.
Specifies the font size of ruby. V6.0
| Value: | <number> | <absolute-size> | <relative-size> | <length> | <percentage> |
| Initial: | 0.5 |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the font size |
It's a value created by crossing the font size with the setting of <number>
Specifies the minimum font size of ruby. V6.0
| Value: | none | <absolute-size> | <relative-size> | <length> | <percentage> |
| Initial: | none |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the font size |
Specifies whether ruby is made Italic. V6.0
| Value: | normal | italic |
| Initial: | empty |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
If nothing is specified, it's considered the same as font-style.
Specifies the font weight of ruby. V6.0
| Value: | normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
| Initial: | empty |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
If nothing is specified, it's considered the same as font-weight.
Specifies the font stretching of ruby. V6.0
| Value: | normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> | <number> |
| Initial: | empty |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the ruby-font-size |
If nothing is specified, it's considered the same as font-stretch.
Specifies the font condense when ruby is longer than its base. V6.0
| Value: | none | <percentage> | <number> |
| Initial: | none |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | refer to the ruby-font-size |
Condenses ruby by "stretch" so that length of ruby becomes the same as its base characters when ruby is longer than its base characters. The numerical value shows the limit to be shorten at that time. If none is specified, ruby is not condensed.
Specifies the color of ruby. V6.0
| Value: | <color> |
| Initial: | empty |
| Applies to: | axf:ruby |
| Inherited: | yes |
| Percentages: | N/A |
If nothing is specified, it's considered the same as color.