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

On 10/05/13 9:15 PM, fantasai wrote:

> So, somehow, we need to have a concept of the synthesized text's
> size and baseline, and be keying the decorations off of that.

If a font maker has built the font carefully, it will contain 
recommendations for super- and subscript scaling and positioning for 
synthesised results that correspond as closely as possible to the 
designed super- and subscript glyphs in the font. However, I suspect the 
number of fonts with reliable data of this kind is quite small: font 
tools provide default settings that many developers don't change, and 
the accurate settings are difficult to calculate. Reliable information 
on how to correctly set these values is hard to come by. [I need to do 
some further checking to confirm where in the TT/OT font structure this 
data is stored; I have not looked at it for a while.]

There is a longstanding issue in text layout regarding interaction of 
real and synthesised styled text (not just super- and subscripts, but 
also smallcaps), and it seems to me that text decoration is simply 
another aspect of this. The general issue regards what should happen 
when an author wants to style text that includes characters that are not 
supported by the font's glyph substitution tables. So, for example, 
let's say that a font contains a full set of a-z superior letter glyphs, 
accessible via the {sups} feature, but an Icelandic author applies a 
superscript styling to text that includes the letter ð. What should be 
done? The options are:

A) Use synthetic styling for the whole stylised string and ignore the 
glyph substitution feature (implies analysing the string, registering 
inclusion that is not included in {sups} feature);

B) Use the substitution feature for all characters for which mappings 
are available, and use synthetic superscript for the ð character (best 
results if able to use font superscript scaling and positioning 
recommendation data and if that data is accurate; implies keeping track 
of which glyphs are substituted by feature and which are not);

C) Use the substitution feature for all characters for which mappings 
are available, and fail in styling of ð character;

D) Throw up hands in despair and use synthetic styling everywhere.


If one takes option B as providing the best chance of optimal results, 
even though actual results will vary, then it seems to me that one could 
approach the question of text decoration along similar lines. That is, 
one could approach styled text, regardless of how it is arrived at, as 
if it were synthesised and apply text decoration accordingly. So, you 
would have a string of superscript glyphs resulting from a substitution 
feature, and you would apply text decoration at the height of 
synthesised superscripts. My guess is that the results would be 
sub-optimal unless making use of accurate font recommendations for 
synthesis, but that more often than not they would be in an acceptable 
range. Given than decorating of superscript and subscript styled text is 
likely to be pretty rare, is this a Good Enough solution?


JH

Received on Saturday, 11 May 2013 19:52:52 UTC