Skip to content

feat(googlefonts): add no_oblique_bit check#667

Open
felipesanches wants to merge 4 commits intofonttools:mainfrom
felipesanches:feat/238-no-oblique-bit
Open

feat(googlefonts): add no_oblique_bit check#667
felipesanches wants to merge 4 commits intofonttools:mainfrom
felipesanches:feat/238-no-oblique-bit

Conversation

@felipesanches
Copy link
Copy Markdown
Contributor

Summary

  • Adds new check googlefonts/no_oblique_bit that FAILs when OS/2 fsSelection OBLIQUE bit is set
  • Google Fonts explicitly does not want this bit enabled (Red Hat fonts had both Italic and Oblique set)
  • Google Fonts profile, includes Rust test

Closes #238

Test plan

  • cargo test --workspace passes (0 failures)
  • cargo clippy --all -- -D warnings clean
  • cargo fmt --all -- --check clean

Note: This PR was generated by an AI agent (Claude) working under the guidance of @felipesanches, but submitted without human review. @felipesanches himself would still need to participate in the PR thread if he wants to contribute to the review.

🤖 Generated with Claude Code

felipesanches and others added 3 commits March 6, 2026 13:07
Adds a check that FAILs when the OS/2 fsSelection OBLIQUE bit (bit 9)
is set. Google Fonts does not want this bit enabled.

Closes fonttools#238

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add test that verifies the check fails when the OBLIQUE bit (bit 9)
is set in OS/2 fsSelection. The test loads Mada-Regular, sets the
OBLIQUE bit via raw OS/2 table byte manipulation, and asserts the
"oblique-bit-set" failure is produced.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@simoncozens
Copy link
Copy Markdown
Collaborator

Please add a hotfix function which turns off this bit.

…check

Add a hotfix function that clears the OBLIQUE bit (bit 9) from OS/2
fsSelection, following the same pattern as the use_typo_metrics hotfix.
Also add a test verifying the hotfix works correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@felipesanches
Copy link
Copy Markdown
Contributor Author

Note: This post was generated by an AI agent (Claude) working under the guidance of @felipesanches, but submitted without human review. @felipesanches himself would still need to participate in the PR thread if he wants to contribute to the review.

Done! Added a hotfix function fix_no_oblique_bit that clears the OBLIQUE bit (bit 9) from OS/2.fsSelection. It follows the same pattern as the use_typo_metrics hotfix — reads the OS/2 table, removes the SelectionFlags::OBLIQUE flag, and rebuilds the font.

Also added a test (test_hotfix_clears_oblique_bit) that creates a font with the OBLIQUE bit set, applies the hotfix, and verifies the check passes afterward.

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.

profiles/googlefonts: Ensure that Oblique bit is not enabled

2 participants