W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [css-ruby] how to specify offset of ruby annotation box from ruby base box?

From: fantasai <fantasai.lists@inkedblade.net>
Date: Sat, 07 Feb 2015 16:39:39 -0500
Message-ID: <54D6861B.7030506@inkedblade.net>
To: www-style@w3.org
On 02/07/2015 07:44 AM, Xidorn Quan wrote:
>
> Option A is always available. The option C I guess we don't actually need any "specialized" property. We can directly use
> "position: relative" with an offset. The only difference is that relative-positioning won't add the additional leadings. But
> it seems to me that the spec doesn't want authors to rely a lot on that auto-added leadings, so I assume this would not be a
> problem.

I wouldn't use position: relative as a solution here. It's mostly
intended as a transform, and doesn't affect layout. In the line
layout module we'll probably have different options for handling
ruby, and we'll want to know the exact size of the ruby after layout.

> For the option B, currently Gecko suppresses all padding (as well as border) on rbc and rtc. And since we treat all ruby boxes
> mostly as inline elements, the margins in block direction are ignored as well. If you want, though, I don't think it would be
> a big issue to require the UA to support block direction margins on ruby text containers. But how this would affect the
> calculation of leadings, and whether the margins can collapse, should be clearly described in the spec.

Agreed.

I'm currently leaning towards making margins count, i.e. having
the rtc size to contain the margin boxes of all the rt inside it,
and then positioning that on top of the rbc. I think that would
make the most sense. Then if you do style the rt boxes, they
won't overlap adjacent rts or rbs. Otherwise you'd have to try
to calculate appropriate offsets yourself based on information
the UA could have calculated for you.

Wrt margin collapsing, I think there's a definite advantage in
collapsing the block-axis margins: you don't have to worry so
much about where exactly you place the margins vs. where you've
positioned the rts, and it's easy to get consistent spacing.
e.g.
   rt { margin: 0.2em; }
   rb { margin: 0.4em; }

gets you .4em margins between the base text and the annotation,
and .2em space between annotation levels if you have multiple
on the same side.

However, inlines don't usually collapse their margins. :/ I think
it'd have been smarter if they did, e.g. you could easily get
even spacing around each item here:

   xxx <span>foo</span> <span>bar</span> xxx

But they don't.

~fantasai
Received on Sunday, 8 February 2015 00:35:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC