Re: [css3-fonts] TrueType support for font-feature-settings

Reply inline.
> On Aug 13, 2015, at 7:38 PM, John Daggett <jdaggett@mozilla.com> wrote:
> 
> 
> Myles Maxfield wrote:
> 
> > > The distinction you're making here isn't really "TrueType" vs.
> > > "OpenType" but between fonts supporting font features via OpenType
> > > layout tables (GSUB/GPOS/GDEF) vs. AAT tables (morx, etc.).
> > 
> > I'm not actually describing "TrueType vs. OpenType" but instead about
> > "specific to one font technology" vs "generalizable to more than one
> > specific font technology."
> 
> The 'font-feature-settings' property explicitly defines how to
> enable/disable OpenType features. It's an escape hatch because we can't
> possibly support all features in the OpenType feature registry. The
> font-variant-* subproperties define features that can be mapped to
> future font technologies. The mapping to OpenType features is normative.
> 
> > > Rather than mapping feature tags in 'font-feature-settings' to Apple
> > > font feature constants [1], I think the best way forward for Apple would
> > > be to map the property values of 'font-variant' to associated AAT
> > > feature id's, where they exist. This would be fairly easy to support in
> > > existing Webkit code. We could incorporate this sort of mapping into a
> > > future version of the spec.
> > 
> > My proposal isn't anything quite so stringent. I am not advocating
> > that a specific mapping be supplied in the fonts spec (or even that
> > the term "TrueType" appear anywhere in it). Instead, I'm simply
> > proposing one sentence encouraging UAs to do their best to map
> > OpenType feature tags & values onto whichever underlying font
> > technology is used. WebKit currently does this for TrueType fonts [1].
> 
> The code you're pointing to uses CoreText which shapes text using
> *either* TrueType AAT or OpenType layout tables depending upon the font.
> The set of features defined in CoreText in SFNTLayoutTypes.h is a merged
> combination of common features in the OpenType layout registry and
> features originally defined in TrueType AAT (this merge was done in 10.8).
> Some features exist in one but not the other (e.g. both have a notion of
> common ligatures while AAT fonts allowed "Rebus Picture" ligatures and
> OpenType allowed historical ligatures). CoreText is basically papering
> over the differences between these two distinct underlying font types.
> 
> Mapping isn't going to work completely unless the underlying
> implementation exposes direct access to arbitrary features, which
> CoreText doesn't.
> 
> The only real alternatives to OpenType layout features are AAT and
> Graphite font features. I think based on Webkit's implementation
> experience we could add an informative appendix to suggest how to map
> OpenType features to underlying AAT features via CoreText under OSX/iOS.
> Something like this table in the Harfbuzz CoreText shaping code:
> 
> https://github.com/behdad/harfbuzz/blob/master/src/hb-coretext.cc#L346 <https://github.com/behdad/harfbuzz/blob/master/src/hb-coretext.cc#L346>
> 
> This would be better than a general statement about mapping features and
> would produce more interoperable browser support.

I think this would be a good idea in the form of an appendix. Would you like me to draft up a table?

> 
> Cheers,
> 
> John Daggett
> 
> Merge history for AAT and OpenType font features
> ================================================
> 
> MacOS 10.6 features, original AAT font features:
> https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.6.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Headers/SFNTLayoutTypes.h <https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.6.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Headers/SFNTLayoutTypes.h>
> 
> MacOS 10.8 font features, merged combination of AAT features with features defined in OpenType:
> https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.8.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Headers/SFNTLayoutTypes.h <https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.8.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Headers/SFNTLayoutTypes.h>
> 
> Diff:
> 
> 58c40
> <   kLetterCaseType               = 3,
> ---
> >   kLetterCaseType               = 3,    /* deprecated - use kLowerCaseType or kUpperCaseType instead */
> 85a68,73
> >   kCaseSensitiveLayoutType      = 33,
> >   kAlternateKanaType            = 34,
> >   kStylisticAlternativesType    = 35,
> >   kContextualAlternatesType     = 36,
> >   kLowerCaseType                = 37,
> >   kUpperCaseType                = 38,
> 124c112,116
> <   kSymbolLigaturesOffSelector   = 17
> ---
> >   kSymbolLigaturesOffSelector   = 17,
> >   kContextualLigaturesOnSelector = 18,
> >   kContextualLigaturesOffSelector = 19,
> >   kHistoricalLigaturesOnSelector = 20,
> >   kHistoricalLigaturesOffSelector = 21
> 144,149c136,141
> <   kUpperAndLowerCaseSelector    = 0,
> <   kAllCapsSelector              = 1,
> <   kAllLowerCaseSelector         = 2,
> <   kSmallCapsSelector            = 3,
> <   kInitialCapsSelector          = 4,
> <   kInitialCapsAndSmallCapsSelector = 5
> ---
> >   kUpperAndLowerCaseSelector    = 0,    /* deprecated */
> >   kAllCapsSelector              = 1,    /* deprecated */
> >   kAllLowerCaseSelector         = 2,    /* deprecated */
> >   kSmallCapsSelector            = 3,    /* deprecated */
> >   kInitialCapsSelector          = 4,    /* deprecated */
> >   kInitialCapsAndSmallCapsSelector = 5  /* deprecated */
> 222c214,215
> <   kOrdinalsSelector             = 3
> ---
> >   kOrdinalsSelector             = 3,
> >   kScientificInferiorsSelector  = 4
> 281c274,276
> <   kExponentsOffSelector         = 9
> ---
> >   kExponentsOffSelector         = 9,
> >   kMathematicalGreekOnSelector  = 10,
> >   kMathematicalGreekOffSelector = 11
> 351c346,350
> <   kExpertCharactersSelector     = 10
> ---
> >   kExpertCharactersSelector     = 10,
> >   kJIS2004CharactersSelector    = 11,
> >   kHojoCharactersSelector       = 12,
> >   kNLCCharactersSelector        = 13,
> >   kTraditionalNamesCharactersSelector = 14
> 372c371,375
> <   kHalfWidthTextSelector        = 2
> ---
> >   kHalfWidthTextSelector        = 2,
> >   kThirdWidthTextSelector       = 3,
> >   kQuarterWidthTextSelector     = 4,
> >   kAltProportionalTextSelector  = 5,
> >   kAltHalfWidthTextSelector     = 6
> 511a515,623
> >  *    Selectors for feature type kCaseSensitiveLayoutType
> >  */
> > enum {
> >   kCaseSensitiveLayoutOnSelector = 0,
> >   kCaseSensitiveLayoutOffSelector = 1,
> >   kCaseSensitiveSpacingOnSelector = 2,
> >   kCaseSensitiveSpacingOffSelector = 3
> > };
> > 
> > 
> > /*
> >  *  Summary:
> >  *    Selectors for feature type kAlternateKanaType
> >  */
> > enum {
> >   kAlternateHorizKanaOnSelector = 0,
> >   kAlternateHorizKanaOffSelector = 1,
> >   kAlternateVertKanaOnSelector  = 2,
> >   kAlternateVertKanaOffSelector = 3
> > };
> > 
> > 
> > /*
> >  *  Summary:
> >  *    Selectors for feature type kStylisticAlternativesType
> >  */
> > enum {
> >   kNoStylisticAlternatesSelector = 0,
> >   kStylisticAltOneOnSelector    = 2,
> >   kStylisticAltOneOffSelector   = 3,
> >   kStylisticAltTwoOnSelector    = 4,
> >   kStylisticAltTwoOffSelector   = 5,
> >   kStylisticAltThreeOnSelector  = 6,
> >   kStylisticAltThreeOffSelector = 7,
> >   kStylisticAltFourOnSelector   = 8,
> >   kStylisticAltFourOffSelector  = 9,
> >   kStylisticAltFiveOnSelector   = 10,
> >   kStylisticAltFiveOffSelector  = 11,
> >   kStylisticAltSixOnSelector    = 12,
> >   kStylisticAltSixOffSelector   = 13,
> >   kStylisticAltSevenOnSelector  = 14,
> >   kStylisticAltSevenOffSelector = 15,
> >   kStylisticAltEightOnSelector  = 16,
> >   kStylisticAltEightOffSelector = 17,
> >   kStylisticAltNineOnSelector   = 18,
> >   kStylisticAltNineOffSelector  = 19,
> >   kStylisticAltTenOnSelector    = 20,
> >   kStylisticAltTenOffSelector   = 21,
> >   kStylisticAltElevenOnSelector = 22,
> >   kStylisticAltElevenOffSelector = 23,
> >   kStylisticAltTwelveOnSelector = 24,
> >   kStylisticAltTwelveOffSelector = 25,
> >   kStylisticAltThirteenOnSelector = 26,
> >   kStylisticAltThirteenOffSelector = 27,
> >   kStylisticAltFourteenOnSelector = 28,
> >   kStylisticAltFourteenOffSelector = 29,
> >   kStylisticAltFifteenOnSelector = 30,
> >   kStylisticAltFifteenOffSelector = 31,
> >   kStylisticAltSixteenOnSelector = 32,
> >   kStylisticAltSixteenOffSelector = 33,
> >   kStylisticAltSeventeenOnSelector = 34,
> >   kStylisticAltSeventeenOffSelector = 35,
> >   kStylisticAltEighteenOnSelector = 36,
> >   kStylisticAltEighteenOffSelector = 37,
> >   kStylisticAltNineteenOnSelector = 38,
> >   kStylisticAltNineteenOffSelector = 39,
> >   kStylisticAltTwentyOnSelector = 40,
> >   kStylisticAltTwentyOffSelector = 41
> > };
> > 
> > 
> > /*
> >  *  Summary:
> >  *    Selectors for feature type kContextualAlternatesType
> >  */
> > enum {
> >   kContextualAlternatesOnSelector = 0,
> >   kContextualAlternatesOffSelector = 1,
> >   kSwashAlternatesOnSelector    = 2,
> >   kSwashAlternatesOffSelector   = 3,
> >   kContextualSwashAlternatesOnSelector = 4,
> >   kContextualSwashAlternatesOffSelector = 5
> > };
> > 
> > 
> > /*
> >  *  Summary:
> >  *    Selectors for feature type kLowerCaseType
> >  */
> > enum {
> >   kDefaultLowerCaseSelector     = 0,
> >   kLowerCaseSmallCapsSelector   = 1,
> >   kLowerCasePetiteCapsSelector  = 2
> > };
> > 
> > 
> > /*
> >  *  Summary:
> >  *    Selectors for feature type kUpperCaseType
> >  */
> > enum {
> >   kDefaultUpperCaseSelector     = 0,
> >   kUpperCaseSmallCapsSelector   = 1,
> >   kUpperCasePetiteCapsSelector  = 2
> > };
> 
> ​

Received on Tuesday, 18 August 2015 21:08:27 UTC