Skip to content

feat(universal/fsselection_wws): check fsSelection bit for WWS is set correctly + unittest#578

Open
ollimeier wants to merge 2 commits intomainfrom
issue-577-fsSelection-bit-wws
Open

feat(universal/fsselection_wws): check fsSelection bit for WWS is set correctly + unittest#578
ollimeier wants to merge 2 commits intomainfrom
issue-577-fsSelection-bit-wws

Conversation

@ollimeier
Copy link
Copy Markdown
Collaborator

Description

Relates to issue #577

Checks if the fsSelection bit for WWS is set correctly, according to OpenType spec:
https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection

If no NID 21 and 22, WWS bit should be set.

I have set it to warning, because I think it's not critical.

Checklist

  • update CHANGELOG.md
  • wait for the tests to pass
  • request a review

@ollimeier ollimeier requested a review from simoncozens January 16, 2026 09:02
@simoncozens
Copy link
Copy Markdown
Collaborator

I'm not sure but I don't think this is the correct approach. The WWS bit should be set if the font only varies by weight, width and/or slope; it's not just a matter of checking for name IDs 21/22. A family with names:

  • Family Regular
  • Family Leaded
  • Family Unleaded

and without the WWS bit should pass this test - it is not "consistent with a weight/width/slope family", so the bit should not be set; in your implementation it will fail. I think we need to inspect the names themselves, and that gets complicated - possibly too complicated to implement. "Bold" would be OK but also so would "Fett".

@ollimeier
Copy link
Copy Markdown
Collaborator Author

You're right, but I would like to argue, that almost all fonts from today fit into the specifications and therefore should have set the WWS bit. Only the non-standard fonts (your example with 'Family Leaded') should not have set this bit. So, in most of the cases this test would help people. Even though it's not 100% precise, it handles most common cases.

Quote fom OT Spec:

For example, a family might include variations for “handwriting”, “caption”, “display”, “optical size”, etc. In such cases, a font could incorporate that attribute into a typographic subfamily name (ID 17 string), whereas applications that assume a WWS model would require that attribute to be incorporated into a family name (ID 1 or ID 16).

IF a face differs within its family only in terms of weight, width or slope attributes, then bit 8 should be set. This applies even if the face is part of a large family that includes other faces distinguished by other attributes. Setting bit 8 serves as an indicator to apps that assume the WWS model that name IDs 1 and 2 or IDs 16 and 17 are consistent with the WWS model and no further treatment is required, including checking to see whether name IDs 21 and 22 are present. Hence, when bit 8 is set, name IDs 21 and 22 are never required and should not be included.

@simoncozens
Copy link
Copy Markdown
Collaborator

OK, then we'll put it in the universal profile since it's not strictly following the OT spec.

@ollimeier
Copy link
Copy Markdown
Collaborator Author

OK, then we'll put it in the universal profile since it's not strictly following the OT spec.

Good idea. I'll take care if it.

@ollimeier ollimeier changed the title feat(opentype/fsselection): check fsSelection bit for WWS is set correctly + unittest feat(universal/fsselection_wws): check fsSelection bit for WWS is set correctly + unittest Jan 21, 2026
@ollimeier
Copy link
Copy Markdown
Collaborator Author

@simoncozens I made it a new check "universal/fsselection_wws".

@simoncozens simoncozens force-pushed the issue-577-fsSelection-bit-wws branch from 968f45b to 18a5295 Compare February 3, 2026 11:38
@simoncozens simoncozens force-pushed the issue-577-fsSelection-bit-wws branch from 18a5295 to 6517469 Compare February 5, 2026 11:54
@simoncozens simoncozens enabled auto-merge February 5, 2026 11:55
@ollimeier
Copy link
Copy Markdown
Collaborator Author

I guess I now understand the issue. There are a couple fontbakery tests failing, because they always expect only one specific bit to be set, but fsSelection can have multiple bits set. If this is the case the unittests do not work properly anymore, am I right? So, this WWS check requires a rework of multiple unittests :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants