[whatwg] Whitespace handling in ruby
ian at hixie.ch
Tue Aug 4 18:33:52 PDT 2009
On Thu, 30 Jul 2009, Roland Steiner wrote:
> As I am currently writing an implementation for ruby rendering, I
> wondered about the exact way white-space is supposed to be handled
> between runs of ruby text.
> As far as I see it, <ruby> is fundamentally an inline element, and thus
> whitespace would normally be collapsed, but not entirely eliminated.
> However, for the examples given for the <ruby> element, this would
> result in a single whitespace between the ideographic characters:
> <ruby> *[ws]*
> ´Á<rp>(</rp><rt>¤«¤ó</rt><rp>)</rp> *[ws]*
> »ú<rp>(</rp><rt>¤¸</rt><rp>)</rp> *[ws]*
> rendered without ruby support would become (easier for e-mail):
> ´Á(¤«¤ó)* [ws]* »ú(¤¸)
> The whitespace would also be present with proper ruby rendering above the
> base characters.
> OTOH, removing those white-spaces may not be desirable if the bases are not
> ideographic scripts, e.g.:
> (This example has yet another drawback: the white-space before "Union" would
> become part of the base and thus shift the annotation "U" slightly left of
> the center of the word "Union".)
> For the time being I'm using a block-based rendering approach that
> automatically eliminates leading and trailing white-space in the base
> text, but I wondered what the correct approach would be within the scope
> of HTML5 (aside: an XHTML-like explicit <rb> container for the ruby base
> side-steps this problem, but is not a real option due to need for legacy
As far as I can tell the correct approach is for whitespace to be trimmed
as part of ideographic rendering, as required by the CSS ideographic
rendering models, no? I'm no expert on this subject. I recommend asking
for clarification in www-style at w3.org.
On Thu, 30 Jul 2009, Simon Pieters wrote:
> "For the purposes of the CSS ruby model, runs of descendants of ruby
> elements that are not rt or rp elements are expected to be wrapped in
> anonymous boxes whose 'display' property has the value 'ruby-base'."
> (That section also says rp should be display:block; shouldn't that be
> display:none instead?)
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg