W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [css3-fonts] font-size-adjust and em/ex values

From: fantasai <fantasai.lists@inkedblade.net>
Date: Tue, 25 Jun 2013 13:14:51 -0700
Message-ID: <51C9FA3B.40701@inkedblade.net>
To: www-style@w3.org
On 05/21/2013 09:56 PM, fantasai wrote:
> On 05/17/2013 06:42 AM, fantasai wrote:
>> We need a sentence in CSS3 Fonts that says whether font-relative lengths
>> are calculated against the [computed? used? something else?] font-size.
>>
>> I'm pretty sure 'em' should always calculate against the specified
>> font-size. however I'm less sure of the other values; it seems like
>> taking font-size-adjust into account would be better for measurements
>> against the ex-height or font pitch.
>
> I just noticed this bit:
> http://dev.w3.org/csswg/css-fonts/#font-style-matching
>    # Further computations, e.g., by ‘em’ values in other properties,
>    # are based on the ‘font-size’ value that is used, not the one
>    # that is specified.
>
> which contradicts with
> http://lists.w3.org/Archives/Public/www-style/2013May/0441.html
>    > My gut feeling is that it should be  based purely on computed
>    > value, so 1em == computed value of 'font-size' regardless of
>    > 'font-size-adjust'.
>
> So if even you are confused as to what we should do here, definitely
> there's a spec issue. :)

Here's my current thinking:

EX, CH compute against the used font size of the first available font.
Since we need to look up the font metrics for this anyway, it seems
best to be accurate about it. Also these units are really intended to
match glyph measurements, so they should do so. E.g. Bert's example
where a colored line matches the ex height of the text, or fitting
a 10-digit number into a 10ch form input.

EM, I could go either way:
   * take into account 'font-size-adjust'. Text in the first available
     font will match 1em measurements in the layout.
   * just use the computed 'font-size'. Text may end up taller than 1em,
     which may cause some amount of layout mismatch.
There are fonts that have ascenders and descenders that go beyond the
em box, so having the used font size not match the computed EM is maybe
not such a problem. (If the adjustment is large, though, and the font is
not designed for overlapping across lines, this could be a problem?)

~fantasai
Received on Tuesday, 25 June 2013 20:15:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 25 June 2013 20:15:23 UTC