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

Le 2013-10-18 01:34, Glenn Adams a écrit :
> On Thu, Oct 17, 2013 at 7:49 PM, Alan Gresley <alan@css-class.com> 
> wrote:
> 
>> On 18/10/2013 3:52 AM, Glenn Adams wrote:
>> 
>>> 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'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>
>>> 
>> 
>> Where the spec says "When an element contains text that is rendered in
>> more than one font," it is referring to types of font style like 
>> 'Times New
>> Roman', Georgia, 'Lucida Bright', etc.
>> 
> 
> Actually, the spec means font size not font [family] when it says 
> rendered
> in more than one font.

I think you're right (the spec seems to mean font size and not font 
[family]). I think it would be best for everyone to rewrite that 
sentence in a way that eliminates sources of interpretation or possible 
confusion.


> Otherwise, it wouldn't say the largest font* size*.
> Font family is not related to line height computation.

Font faces affect the computed value of 'line-height: normal'. I 
remember Alan Gresley made several tests on this. 'line-height: normal' 
with various commonly-used font faces varies from 1.12 to 1.20. But 
anyway... your test is really about various font sizes used on multiple 
line boxes.

> So that's one spec
> problem (if one wants to make reference to this language).
> 
> The other spec problem is that it isn't clear about what is meant by 
> "font
> size". Does it mean the computed font size of all descendant elements 
> or
> the computed font size of all descendent elements and itself.
> 
> The third problem is that the spec allows for implementation dependent
> behavior, which makes the results ambiguous. It does this by suggesting
> more than one interpretation.
> 
> The fourth problem is that if a UA does *not* adopt the "use largest 
> font
> size" interpretation, then it isn't quite clear what the definition of 
> line
> height 'normal' means when there are different font sizes as 
> descendants.
> I'm assuming that what is intended in this case is the language "Tells 
> user
> agents to set the used value to a "reasonable" value based on the font 
> of
> the element. The value has the same meaning as
> <number><http://www.w3.org/TR/CSS2/syndata.html#value-def-number>.
> We recommend a used value for 'normal' between 1.0 to 1.2."
> 
> If no UA actually implements the "use largest font size" 
> interpretation,
> then the spec should adopt the common implemented behavior and define 
> (that
> behavior) by using a more concrete definition of 'normal'.

[snipped]

I think - and I could be wrong here - that section 9.4.2 applies to your 
example and code fragment involving multiple line boxes. And not section 
10.8.1.

Gérard

Received on Friday, 18 October 2013 22:25:23 UTC