CSS Ruby Annotation Layout Module Level 1
CSS Ruby Annotation Layout Module Level 1
W3C Working Draft
31 December 2022
More details about this document
This version:
Latest published version:
Editor's Draft:
Previous Versions:
History:
Test Suite:
Feedback:
CSSWG Issues Repository
Inline In Spec
Editors:
Elika J. Etemad / fantasai
Invited Expert
Koji Ishii
Google
Xidorn Quan
Mozilla
Florian Rivoal
Invited Expert
Suggest an Edit for this Spec:
GitHub Editor
W3C
MIT
ERCIM
Keio
Beihang
). W3C
liability
trademark
and
permissive document license
rules apply.
Abstract
“Ruby”, a form of interlinear annotation, are short runs of text alongside the base text.
They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation.
This module describes the rendering model and formatting controls related to displaying ruby annotations in CSS.
CSS
is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, etc.
Status of this document
This section describes the status of this document at the time of its publication.
A list of current W3C publications
and the latest revision of this technical report
can be found in the
W3C technical reports index at https://www.w3.org/TR/.
This document was published
by the
CSS Working Group
as a
Working Draft
using the
Recommendation
track
Publication as a Working Draft
does not imply endorsement by
W3C
and its Members.
This is a draft document
and may be updated, replaced
or obsoleted by other documents at any time.
It is inappropriate to cite this document as other than work in progress.
Please send feedback
by
filing issues in GitHub
(preferred),
including the spec code “css-ruby” in the title, like this:
“[css-ruby]
…summary of comment…
”.
All issues and comments are
archived
Alternately, feedback can be sent to the (
archived
) public mailing list
www-style@w3.org
This document is governed by the
2 November 2021 W3C Process Document
This document was produced by a group operating under the
W3C Patent Policy
W3C maintains a
public list of any patent disclosures
made in connection with the deliverables of the group;
that page also includes instructions for disclosing a patent.
An individual who has actual knowledge of a patent which the individual believes
contains
Essential Claim(s)
must disclose the information in accordance with
section 6 of the W3C Patent Policy
1.
Introduction
1.1.
What is ruby?
This subsection is not normative.
Ruby
is the commonly-used name for a run of text
that appears alongside another run of text (referred to as the “base”)
and serves as an annotation or a pronunciation guide associated with that run of text.
A run of Japanese text with phonetic ruby annotations indicating the pronunciation of each ideograph.
The following figures show two examples of Ruby,
a simple case and one with more complicated structure.
In this example, a single annotation is used to annotate a base text
consisting of multiple characters.
Example of ruby used in Japanese (simple case)
In Japanese typography, this case is sometimes called
taigo ruby (Japanese:
対語ルビ
, i.e. per-word ruby) or group-ruby,
because the annotation as a whole is associated
with multi-character word (as a whole).
In this second example,
two levels of annotations are attached to the base text:
the hiragana characters on top refer to the pronunciation of each of the base kanji characters,
while the words “Keio” and “University” on the bottom are give the English translation.
Complex ruby with annotation text over and under the base characters
Notice that to reflect the correct association
of hiragana characters and their corresponding Kanji base characters,
the spacing within the base-level text is adjusted.
(This happens around the fourth Kanji character in the figure above,
which has a three-character phonetic gloss.)
To avoid variable spacing of the base text in the example above,
the hiragana annotations can be styled as a
merged annotation
which will look more like the group-ruby example earlier.
However because the base-annotation
pairings
are recorded in the ruby structure,
if the text breaks across lines, the annotation characters will stay
correctly paired with their respective base characters.
In HTML, ruby structure and markup to represent it is described
in the Ruby Markup Extension specification.
This module describes the CSS rendering model
and formatting controls relevant to ruby layout of such markup.
A more in-depth introduction to
Ruby
and its formatting
can be found in the “What is Ruby“ article
[QA-RUBY]
Extensive information about the main ways
ruby
has traditionally been formatted in Japanese
can be found in JIS X-4051
[JIS4051]
(in Japanese)
and in
“Ruby and Emphasis Dots”
in
Requirements for Japanese Text Layout
[JLREQ]
(in English and Japanese);
Rules for Simple Placement of Japanese Ruby
[SIMPLE-RUBY]
also describes (in English) one possible approach for Japanese ruby formatting.
“Interlinear annotations”
in
Requirements for Chinese Text Layout
[CLREQ]
describes the related practices for Chinese typography (in Chinese and English).
1.2.
Module interactions
This module extends the inline box model of CSS Level 2
[CSS2]
to support ruby.
None of the properties in this module apply to the
::first-line
or
::first-letter
pseudo-elements;
however
ruby-position
can inherit through
::first-line
to affect
ruby annotations on the first line.
1.3.
Value Definitions
This specification follows the
CSS property definition conventions
from
[CSS2]
using the
value definition syntax
from
[CSS-VALUES-3]
Value types not defined in this specification are defined in CSS Values & Units
[CSS-VALUES-3]
Combination with other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the
CSS-wide keywords
keywords as their property value.
For readability they have not been repeated explicitly.
1.4.
Diagram conventions
This subsection is not normative.
Many typographical conventions in East Asian typography depend
on whether the character rendered is wide (CJK) or narrow (non-CJK).
There are a number of illustrations in this document
for which the following legend is used:
Wide-cell glyph (e.g. Han) that is the
th character in the text run.
They are typically sized to 50% when used as annotations.
Narrow-cell glyph (e.g. Roman) which is the
th glyph in the text run.
The orientation which the above symbols assume in the diagrams
corresponds to the orientation that the glyphs they represent
are intended to assume when rendered by the user agent.
Spacing between these characters in the diagrams is incidental,
unless intentionally changed to make a point.
2.
Ruby Box Model
The CSS ruby model is based on
the
W3C HTML5 Ruby Markup
model
and the
XHTML Ruby Annotation Recommendation
[RUBY]
In this model, a ruby structure consists of
one or more
ruby base
elements representing the base (annotated) text,
associated with one or more levels of
ruby annotation
elements representing the annotations.
The structure of ruby is similar to that of a table:
there are “rows” (the
base text level
, each
annotation level
and “
columns
” (each
ruby base
and its corresponding
ruby annotations
).
The Japanese compound word “上手” annotated with its pronunciation “じょうず”. Each syllable is associated individually with its base character.
Sets of consecutive bases and their consecutive annotations are grouped together into
ruby segments
Within a
ruby segment
, a
ruby annotation
may span multiple
ruby bases
The Chinese city name “旧金山” annotated with its pronunciation in Pinyin “jiùjīnshān” and its English name “San Francisco”. Each Pinyin syllable is associated individually with its base character, however the English name is associated with the name as a whole.
Note:
In HTML, a single
element may contain multiple
ruby segments
(In the XHTML Ruby model, a single
element can only contain one
ruby segment
.)
2.1.
Ruby-specific
display
Values
For document languages (such as XML applications) that do not have pre-defined ruby elements,
authors must map document language elements to ruby elements;
this is done with the
display
property.
Name:
display
New values:
ruby
ruby-base
ruby-text
ruby-base-container
ruby-text-container
The following new
display
values assign ruby layout roles to an arbitrary element:
ruby
Specifies that an element generates a
ruby container box
(Corresponds to HTML/XHTML
elements.)
ruby-base
Specifies that an element generates a
ruby base box
(Corresponds to HTML/XHTML
elements.)
ruby-text
Specifies that an element generates a
ruby annotation box
(Corresponds to HTML/XHTML