Re: line-height: normal and multiple descendant font sizes

On Fri, Oct 18, 2013 at 3:47 PM, Gérard Talbot <www-style@gtalbot.org>wrote:

> Le 2013-10-17 12:52, Glenn Adams a écrit :
>
>> In CSS2.1, we have the following in Section 10.8.1:
>>
>>
>> "When an element contains text that is rendered in more than one font,
>> user
>> agents may determine the 'normal'
>> 'line-height'<http://www.w3.**org/TR/CSS2/visudet.html#**
>> propdef-line-height<http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height>
>> >
>>
>> value
>> according to the largest font size."
>>
>>
> I think the spec with regards to section 10.8.1 should have been
> rather/instead saying something like:
>
> "
> When a single line box contains text that uses more than one font-size,
> user agents may determine the 'normal' 'line-height'<http://www.w3.**
> org/TR/CSS2/visudet.html#**propdef-line-height<http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height>>
> value according to the largest font size.
>
> "
>

IMO, the problem is whether there is a single meaning, i.e., a single *used
value*, for the property line-height when its computed value is 'normal',
that applies to the entire block element that generates line boxes, or is
there multiple meanings, where the *used value* effectively changes on a
per line basis.

I am assuming that there is a single *used value* that applies to the block
element as a whole, so that, when I see language like

"When an element contains text that is rendered in more than one font, user
agents may determine the 'normal'
'line-height'<http://www.w3.org/TR/CSS2/visudet.html#propdef-line-height>
value
according to the largest font size."

I read it as meaning: according to the largest computed font size of all
inline child elements of the block element. I do not interpret as meaning:
for every line box generated by the block element, compute a (possibly
distinct) *used value* for line-height 'normal' based on the sizes of fonts
whose glyphs appear in the line box.

So, when I suggest that UA implementations don't follow the "largest font
size" rule for interpreting 'normal', I base this conclusion on the fact
that in the original example I gave, I would expect the *used value* for
line-height 'normal' to be from 100% to 120% of the largest descendant font
size, i.e., 36pt. So, lets say 120% were used, then I would expect each of
the three line boxes to have the same minimum line height of 36pt * 120% =
43.2pt.

But all of the UAs I have tested use different heights for the three
generated line boxes, which leads me to conclude that they all ignore this
interpretation, and simply interpret normal as being 100% to 120% of the
computed font size of the block element (ignoring font sizes of descendant
inline elements).

This is what prompts me to question the optional "largest font size"
interpretation of 'normal'.


>
>  I'm curious if any UA actually implements this. I have tested Chrome,
>> Opera, and Safari UAs, and none of these UAs seems to use the largest font
>> size (of descendant fonts).
>>
>> My test consisted of the following fragment:
>>
>> <p style="line-height: normal">
>> <span style="font-size: 12pt; border: 1px solid #C0C0C0">X</span></br>
>> <span style="font-size: 36pt; border: 1px solid #C0C0C0">X</span></br>
>> <span style="font-size: 18pt; border: 1px solid #C0C0C0">X</span></br>
>> </p>
>>
>
> [snipped]
>
> Here's a slightly modified version of your code fragment:
>
> http://www.gtalbot.org/**BrowserBugsSection/**
> CSS3LineBox/multiple-line-box-**various-font-sizes.html<http://www.gtalbot.org/BrowserBugsSection/CSS3LineBox/multiple-line-box-various-font-sizes.html>
>
> The spans Z1, Z2, Z3 at the bottom is just to see what happens when there
> is only 1 single line box.
>
> I think your test (expected rendered layout) is determined by section
> 9.4.2 of CSS 2.1 and not by 10.8.1:
>
> "
> A line box is always tall enough for all of the boxes it contains.
> However, it may be taller than the tallest box it contains (if, for
> example, boxes are aligned so that baselines line up). When the height of a
> box B is less than the height of the line box containing it, the vertical
> alignment of B within the line box is determined by the 'vertical-align'
> property. When several inline-level boxes cannot fit horizontally within a
> single line box, they are distributed among two or more vertically-stacked
> line boxes. Thus, a paragraph is a vertical stack of line boxes. Line boxes
> are stacked with no vertical separation (except as specified elsewhere) and
> they never overlap.
> "
>
> 9.4.2 Inline formatting contexts
> http://www.w3.org/TR/CSS21/**visuren.html#inline-formatting<http://www.w3.org/TR/CSS21/visuren.html#inline-formatting>
>

Received on Friday, 18 October 2013 22:59:00 UTC