Re: [css3-fonts] OpenType subscript/superscript support

On Thu, Feb 25, 2010 at 3:46 AM, John Daggett <jdaggett@mozilla.com> wrote:
> One of the things that I did *not* add to the CSS3 Fonts spec was support for OpenType subscript/superscript/inferior features.  The reason for this is somewhat complicated but it was highlighted during the November F2F.
>
> In CSS 2.1 subscripts and superscripts are styled using a combination of properties.  The default stylesheet in Firefox uses the property settings below for the sub and sup tags.  The vertical-align property shifts the baseline and font-size is reduced to produce the subscript/superscript effect:
>
> sub {
>  vertical-align: sub;
>  font-size: smaller;
>  line-height: normal;
> }
>
> sup {
>  vertical-align: super;
>  font-size: smaller;
>  line-height: normal;
> }
>
> Ideally, subscripts and superscripts should fit on the line and not cause changes in line height.  This is what OpenType subscript/superscript support enables, these use a variant glyph designed for subscript/superscript use that sits within the em-box so that no baseline adjustments are necessary.  The glyph is typically slightly bolder than a resized version of the default glyph, this allows it to match the surrounding text and remain readable.
>
> For fonts that have subscript/superscript support enabled, simply enabling those features without any change to font-size or line-height makes sense.  But if the font doesn't support subscript/superscript features then the existing resizing/baseline swizzling still needs to happen.  Those two capabilities are hard to combine.
>
> I'm still struggling to come up with a reasonable solution here. Some sort of property that somehow either uses the variant subscript/superscript glyph or simulates an equivalent for fonts that lack the right glyphs possibly.

character-transform: super | sub ?  Should just do as you said -
either choose the variant if it exists, or simulate it by
automatically playing with size and placement.  It shouldn't actually
adjust the vertical-align or font-size, just "simulate" doing so for
the character.

~TJ

Received on Thursday, 25 February 2010 14:14:57 UTC