Bug 149776

Summary: Test font-variant-* and font-feature-settings with TrueType fonts
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: TextAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: jonlee, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 149779    
Attachments:
Description Flags
WIP
none
Patch
none
WIP
none
Patch simon.fraser: review+

Description Myles C. Maxfield 2015-10-02 16:57:21 PDT
Currently, we only test with OpenType fonts.
Comment 1 Radar WebKit Bug Importer 2015-10-02 17:30:08 PDT
<rdar://problem/22960027>
Comment 2 Myles C. Maxfield 2015-10-04 23:28:00 PDT
Created attachment 262420 [details]
WIP
Comment 3 Myles C. Maxfield 2015-10-05 20:54:28 PDT
Created attachment 262491 [details]
Patch
Comment 4 Myles C. Maxfield 2015-10-05 20:55:40 PDT
Comment on attachment 262491 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262491&action=review

> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:564
> +        append16(257); // Index in the name table for the name of this feature

This might be wrong.
Comment 5 Myles C. Maxfield 2015-10-05 23:28:50 PDT
Comment on attachment 262491 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262491&action=review

> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:559
> +        append16(10); // Feature type: kVerticalPositionType

static const int kCharacterShapeType           = 20;
    static const int kContextualAlternatesType     = 36;
    static const int kFractionsType                = 11;
    static const int kLetterCaseType               = 3;
    static const int kLigaturesType                = 1;
    static const int kLowerCaseType                = 37;
    static const int kNumberCaseType               = 21;
    static const int kNumberSpacingType            = 6;
    static const int kRubyKanaType                 = 28;
    static const int kStyleOptionsType             = 19;
    static const int kTextSpacingType              = 22;
    static const int kTypographicExtrasType        = 14;
    static const int kUpperCaseType                = 38;
    static const int kVerticalPositionType         = 10;
    
    static const int kCommonLigaturesOffSelector      = 3;
    static const int kCommonLigaturesOnSelector       = 2;
    static const int kContextualAlternatesOffSelector = 1;
    static const int kContextualAlternatesOnSelector  = 0;
    static const int kContextualLigaturesOffSelector  = 19; 
    static const int kContextualLigaturesOnSelector   = 18; 
    static const int kDiagonalFractionsSelector       = 2;
    static const int kHistoricalLigaturesOffSelector  = 21;
    static const int kHistoricalLigaturesOnSelector   = 20; 
    static const int kInferiorsSelector               = 2;
    static const int kJIS1978CharactersSelector       = 2;
    static const int kJIS1983CharactersSelector       = 3;
    static const int kJIS1990CharactersSelector       = 4;
    static const int kJIS2004CharactersSelector       = 11; 
    static const int kLowerCaseNumbersSelector        = 0;
    static const int kLowerCasePetiteCapsSelector     = 2;
    static const int kLowerCaseSmallCapsSelector      = 1;
    static const int kMonospacedNumbersSelector       = 0;
    static const int kMonospacedTextSelector          = 1;
    static const int kOrdinalsSelector                = 3;
    static const int kProportionalNumbersSelector     = 1;
    static const int kProportionalTextSelector        = 0;
    static const int kRareLigaturesOffSelector        = 5;
    static const int kRareLigaturesOnSelector         = 4;
    static const int kRubyKanaOnSelector              = 2;
    static const int kRubyKanaSelector                = 1;
    static const int kSimplifiedCharactersSelector    = 1;
    static const int kSlashedZeroOnSelector           = 4;
    static const int kSuperiorsSelector               = 1;
    static const int kTitlingCapsSelector             = 4;
    static const int kTraditionalCharactersSelector   = 0;
    static const int kUpperCaseNumbersSelector        = 1;
    static const int kUpperCasePetiteCapsSelector     = 2;
    static const int kUpperCaseSmallCapsSelector      = 1;
    static const int kVerticalFractionsSelector       = 1;

>> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:564
>> +        append16(257); // Index in the name table for the name of this feature
> 
> This might be wrong.

This is not wrong.

> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:931
> +        std::vector<std::string> names {{ "MylesFont", "FeatureSelector", "FeatureOff", "FeatureOn" }};

std::vector<std::string> names {{ "MylesFont",
            "kLigaturesType", "kCommonLigaturesOnSelector",                  // 257, 258
            "kLigaturesType", "kContextualLigaturesOnSelector",              // 259, 260
            "kLigaturesType", "kCommonLigaturesOffSelector",                 // 261, 262
            "kLigaturesType", "kContextualLigaturesOffSelector",             // 263, 264
            "kLigaturesType", "kRareLigaturesOnSelector",                    // 265, 266
            "kLigaturesType", "kRareLigaturesOffSelector",                   // 267, 268
            "kLigaturesType", "kHistoricalLigaturesOnSelector",              // 269, 270
            "kLigaturesType", "kHistoricalLigaturesOffSelector",             // 272, 272
            "kContextualAlternatesType", "kContextualAlternatesOnSelector",  // 273, 274
            "kContextualAlternatesType", "kContextualAlternatesOffSelector", // 275, 276
            "kVerticalPositionType", "kInferiorsSelector",                   // 277, 278
            "kVerticalPositionType", "kSuperiorsSelector",                   // 279, 280
            "kLowerCaseType", "kLowerCaseSmallCapsSelector",                 // 281, 282
            "kUpperCaseType", "kUpperCaseSmallCapsSelector",                 // 283, 284
            "kLowerCaseType", "kLowerCasePetiteCapsSelector",                // 285, 286
            "kUpperCaseType", "kUpperCasePetiteCapsSelector",                // 287, 288
            "kLetterCaseType", "14",                                         // 289, 290
            "kStyleOptionsType", "kTitlingCapsSelector",                     // 291, 292
            "kNumberCaseType", "kUpperCaseNumbersSelector",                  // 293, 294
            "kNumberCaseType", "kLowerCaseNumbersSelector",                  // 295, 296
            "kNumberSpacingType", "kProportionalNumbersSelector",            // 297, 298
            "kNumberSpacingType", "kMonospacedNumbersSelector",              // 299, 300
            "kFractionsType", "kDiagonalFractionsSelector",                  // 301, 302
            "kFractionsType", "kVerticalFractionsSelector",                  // 303, 304
            "kVerticalPositionType", "kOrdinalsSelector",                    // 305, 306
            "kTypographicExtrasType", "kSlashedZeroOnSelector",              // 307, 308
            "kLigaturesType", "kHistoricalLigaturesOnSelector",              // 309, 310
            "kCharacterShapeType", "kJIS1978CharactersSelector",             // 311, 312
            "kCharacterShapeType", "kJIS1983CharactersSelector",             // 313, 314
            "kCharacterShapeType", "kJIS1990CharactersSelector",             // 315, 316
            "kCharacterShapeType", "kJIS2004CharactersSelector",             // 317, 318
            "kCharacterShapeType", "kSimplifiedCharactersSelector",          // 319, 320
            "kCharacterShapeType", "kTraditionalCharactersSelector",         // 321, 324
            "kTextSpacingType", "kMonospacedTextSelector",                   // 323, 326
            "kTextSpacingType", "kProportionalTextSelector",                 // 325, 328
            "kRubyKanaType", "kRubyKanaOnSelector"                           // 327, 330
        }};

> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:932
> +        std::vector<uint16_t> nameIdentifiers {{ 1, 257, 258, 259 }}; // 1: Font Family

Delete this.

> Tools/FontWithFeatures/FontWithFeatures/FontCreator.cpp:939
> +            appendNameSubtable(names[i], nameIdentifiers[i]);

Update.
Comment 6 Myles C. Maxfield 2015-10-06 18:16:14 PDT
Created attachment 262565 [details]
WIP
Comment 7 Myles C. Maxfield 2015-10-07 15:40:25 PDT
Created attachment 262648 [details]
Patch
Comment 8 Myles C. Maxfield 2015-10-07 16:50:09 PDT
Comment on attachment 262648 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262648&action=review

> Tools/ChangeLog:17
> +        Without any font features turned on, the rest of the letters are shown as X.

This is not true.
Comment 9 Myles C. Maxfield 2015-10-07 17:34:26 PDT
Committed r190697: <http://trac.webkit.org/changeset/190697>
Comment 10 Myles C. Maxfield 2015-10-07 17:34:51 PDT
Still need to test font-variant-*
Comment 11 Myles C. Maxfield 2015-10-07 17:55:38 PDT
Committed r190700: <http://trac.webkit.org/changeset/190700>