[csswg-drafts] [css-fonts-4] Support automatic optical size selection for static fonts

robmck-ms has just created a new issue for 
https://github.com/w3c/csswg-drafts:

== [css-fonts-4] Support automatic optical size selection for static 
fonts ==
The current draft of the Fonts module defines the 
`font-optical-sizing` property, which will automatically chooses a 
variable font instance along the optical size axis for the given text 
span/block. I propose that this be extended to support automatic 
optical style switching for static font families as well.

Option 1:
Add a `font-size-range` property to @font-face rules. This property 
defines the size range for which this @font-face rule is applicable. 
`
@font-face {
        src: url(http://example.com/fonts/chepman-text.ttf);
        font-family: Chepman;
        opticalfont-size-range: 0pt-18pt;
}
@font-face {
        src: url(http://example.com/fonts/chepman-heading.ttf);
        font-family: Chepman;
        opticalfont-size-range: 18pt-36pt;
}

article {
        font-family: Chepman;
        font-size: 12pt;
}
article h1 {
        font-family: Chepman;
        font-size: 20pt;
}
`

Option 2:
The above handles web fonts but not locally installed fonts. For local
 fonts, we can take advantage of the STAT table introduced in the 
OpenType 1.8 spec. In static fonts, the STAT table provides the same 
sort of information that an @font-face rule does for web fonts (except
 src, which is already known). One of the parameters in the STAT table
 defines a size range for which the given font is applicable (provides
 the functional equivalent to `font-size-range`, above). 

So, one could simply have the following in CSS:
'article {
        font-family: Chepman;
        font-size: 12pt;
}
article h1 {
        font-family: Chepman;
        font-size: 20pt;
}
`

Browsers that want to support this would have to extend their font 
selection algorithm to also include PreferredFamilyName (NameID 16 
from the name table) as the value for PreferredFamilyName will be 
exactly the same for all fonts in the font family. 


Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/806 using your GitHub 
account

Received on Thursday, 15 December 2016 00:19:56 UTC