Re: [css3-fonts][css-text-decor] Decorating superscripts/subscripts

Le Lun 13 mai 2013 22:04, John Daggett a écrit :
>
>
> fantasai wrote:
>
>> The CSS3 Fonts module offers a 'font-variant-position' property as
>> an improved substitute for superscripts and subscripts. The goal is,
>> I hope, that going forward, authors would use this mechanism to
>> produce "real" superscripts and subscripts, using correctly-adjusted
>> glyphs from the font rather than manually synthesizing them by means
>> of 'vertical-align' and 'font-size' adjustments.
>
> This 'font-variant-position' property [1] is not a replacement for the
> existing subscript/superscript mechanism in HTML which uses a
> combination of 'font-size'

Most browsers use in their user agent style sheet:

sub, sup {font-size: smaller;}
/* though Appendix D gives small, sub, sup {font-size: .83em} */

> and 'vertical-align' to render elements in
> superscripts and subscripts.
>
> We discussed this in great detail in the past and actually resolved on
> this at the Hamburg F2F [2]:
>
>> - RESOLVED: the 'font-variant-position' property is defined independent
>>             of the existing use of the font-size/vertical-align
>> properties
>>             to synthesize subscripts/superscripts
>
> The use of variant glyphs for superscripts and subscripts doesn't
> allow for nested superscripts and subscripts, nor does it allow for
> images or other elements included in the superscript or subscript
> content.  It's use is limited to simple, typographic superscripts and
> subscripts that match the surrounding text.
>
>> There's a problem with this however, which is that, since it's now
>> just done by glyph substitution, the text-decoration code doesn't
>> know about it, and can't draw underlines, strike-throughs, or
>> overlines correctly.
>
> I think you're misrepresenting "correct" behavior here.  If an author
> underlines a section of text containing a superscript or subscript and
> uses 'font-variant-position' to choose the appropriate variant glyphs,
> the text will display close to the way it does today (modulo Webkit
> text-decoration bugs):
>
> Testcase:
> http://people.mozilla.org/~jdaggett/tests/superscript-underline.html
>


In several places in that superscript-underline.html test page, the text
in that webpage uses/says "superscript" when in fact it should be
using/saying "subscript".

eg.

"
Below is a comparison of underlining of superscripts using the HTML <sup>
element
"

should be instead

"
Below is a comparison of underlining of subscripts using the HTML <sub>
element
"

and

"
if the text decoration is only applied to the superscript,
"

should be instead

"
if the text decoration is only applied to the subscript,
"


We created several tests in bugzilla bug report (starting from comment #7)
https://bugzilla.mozilla.org/show_bug.cgi?id=695442#c7


> Rendering in Firefox on OSX:
> http://lists.w3.org/Archives/Public/www-archive/2013May/att-0025/superscript-underline.png
>
> If an author wants to underline *just* the content in the superscript
> or subscript span, the baseline for the variant glyphs is the same as
> the surrounding text and the underline will appear at the same place
> it does for surrounding text.  The same is true Unicode
> superscript/subscript codepoints (U+2070:209C), they are treated as
> glyphs with the same baseline as surrounding text (see Wikipedia for a
> list of these [3]).  This is just a limitation of using variant
> glyphs.
>
>> So, somehow, we need to have a concept of the synthesized text's
>> size and baseline, and be keying the decorations off of that.
>
> We discussed why this isn't possible at the Hamburg F2F last year.  As
> John Hudson was gracious enough to point out again, there aren't
> really reliable metrics that can be used to infer the baseline of
> variant superscript/subscript glyphs.

John, I really have to ask you this: which software do you use for
gathering typography metrics of TTF fonts under Linux (debian
distributions like Kubuntu)?

This is something I've been looking for for months now..




Under Windows, I use ttfdump:

ttfdump filename -tOS/2 -nx -h

ttfdump AHEM____.TTF -tOS/2 -nx -h

; TrueType v1.0 Dump Program - v1.8, Oct 29 2002, rrt, dra, gch, ddb, lcp,
pml
; Copyright (C) 1991 ZSoft Corporation. All rights reserved.
; Portions Copyright (C) 1991-2001 Microsoft Corporation. All rights
reserved.

Gérard

> I posted a discussion of this
> with examples [4] and at the F2F meeting we discussed these:
>
> Comparing synthesized superscripts/subscripts to variants
> http://people.mozilla.org/~jdaggett/tests/subsupermetrics.png
>
> If an author wants to use subscripts and superscripts that best match
> the surrounding content, the use of variant glyphs is ideal.  However,
> if they want complicated presentation behavior then the existing model
> of using font-size/vertical-align is a better choice.  For example, in
> the Wikipedia case where superscripts are contained in square brackets
> (e.g. [2]) and hovering over the link shows an underline, the existing
> HTML model is a better choice, since most fonts don't provide
> superscript variant glyphs for the square brackets anyways.
>
> This feature addresses the needs of a specific, common set of use
> cases.  I don't think we need to try and unify it with the approach
> used in the past and the wording in the spec reflects that.
>
> Regards,
>
> John Daggett
>
> [1] font-variant-position
> http://dev.w3.org/csswg/css-fonts/#font-variant-position-prop
>
> [2] Hamburg F2F discussion of superscript/subscript feature
> http://lists.w3.org/Archives/Public/www-style/2012May/0530.html
>
> [3] Wikipedia page on superscript/subscript variant codepoints in Unicode
> http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts
>
> [4] discussion of differences between variant glyphs and HTML
> http://lists.w3.org/Archives/Public/www-style/2012May/0369.html
>
>
>


-- 
CSS 2.1 Test suite RC6, March 23rd 2011
http://test.csswg.org/suites/css2.1/20110323/html4/toc.html

Contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

Web authors' contributions to CSS 2.1 test suite
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html

Received on Tuesday, 14 May 2013 02:32:46 UTC