Bug 254146 - Can't activate feature with all caps tag via font-feature-settings
Summary: Can't activate feature with all caps tag via font-feature-settings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-03-19 22:56 PDT by elaine
Modified: 2023-03-31 21:09 PDT (History)
3 users (show)

See Also:


Attachments
Test case (132.21 KB, application/zip)
2023-03-19 22:56 PDT, elaine
no flags Details
Test case (132.24 KB, application/zip)
2023-03-19 23:01 PDT, elaine
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description elaine 2023-03-19 22:56:07 PDT
Created attachment 465513 [details]
Test case

The attached test case contains a version of the Ahem font with two new layout features, `cv01` and `XPOS`, identical except for their tags. The features contain a single rule (in afdko feature syntax):

    pos x <500 0 1000 0>;

That is, modify the x glyph by increasing the xPosition by 500 font units and the advance by 1000 font units, effectively adding a half em of space on both sides of the glyph.

In the attached index.html, the two lines of text are identical, except in the first the middle character is wrapped with a span that activates the cv01 feature, and in the second the middle character is wrapped with a span that activates the XPOS feature. The glyph's position is modified only in the first line.

STEPS TO REPRODUCE
Open the index.html in the attached archive.

You do not need to run the Makefile; it and the UFO sources are attached for reference. The features can be found in Ahem-Regular.ufo/features.fea.

EXPECTED RESULTS
The two lines of text are identical.

Observed in STP 165 and Safari 16.3 (18614.4.6.1.6) running on macOS 13.2.1 (22D68). Does not reproduce in Firefox 111 and Chrome 111.

COMMENTARY
I ran into this issue while implementing a feature that modified spacing for some punctuation characters, similar to the "PKRN" example Microsoft gives on https://learn.microsoft.com/en-us/typography/opentype/spec/featuretags.

WORKAROUND
Use one of the stylistic variant tags, like cv01–cv99 or ss01–ss20.
Comment 1 elaine 2023-03-19 23:01:04 PDT
Created attachment 465514 [details]
Test case
Comment 2 Antoine Quint 2023-03-20 08:37:20 PDT
I can reproduce with ToT.
Comment 3 Myles C. Maxfield 2023-03-20 15:26:43 PDT
Looks like the font we're creating doesn't actually have the XPOS feature set 🤔
Comment 4 Myles C. Maxfield 2023-03-20 15:41:33 PDT
Looks like we're lowercasing XPOS -> xpos
Comment 5 Myles C. Maxfield 2023-03-20 15:46:40 PDT
auto tag = consumeFontTag<FontTagCaseManipulation::ToASCIILower>(range);

🤔
Comment 6 Myles C. Maxfield 2023-03-20 15:48:30 PDT
http://w3c.github.io/csswg-drafts/css-fonts-4/#font-feature-settings-prop

> The <string> is a case-sensitive OpenType feature tag.
Comment 7 Myles C. Maxfield 2023-03-20 15:50:28 PDT
The included font claims to be in the public domain, so I can just make a layout test with it.
Comment 8 Radar WebKit Bug Importer 2023-03-20 15:55:38 PDT
<rdar://problem/106966601>
Comment 9 Myles C. Maxfield 2023-03-20 15:57:57 PDT
Pull request: https://github.com/WebKit/WebKit/pull/11739
Comment 10 EWS 2023-03-31 21:09:00 PDT
Committed 262463@main (6e7c8de0a165): <https://commits.webkit.org/262463@main>

Reviewed commits have been landed. Closing PR #11739 and removing active labels.