Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve font weight parsing #918

Merged
merged 1 commit into from
Mar 25, 2022
Merged

Improve font weight parsing #918

merged 1 commit into from
Mar 25, 2022

Conversation

corranwebster
Copy link
Contributor

This makes the following changes:

  • corrects the font weight constants to match the OpenType values
  • where possible, gets the font weight, stetch and slope from OS/2 data table
  • adjusts the way FontEntry values are computed to account for these changes
  • allows font entry weights which are not multiples of 100, but restricts them to range of 100 to 1000
  • bumps the font database version number to force a recompute

This fixes #908.

This makes the following changes:
- corrects the font weight constants to match the OpenType values
- where possible, gets the font weight, stetch and slope from OS/2 data table
- adjusts the way FontEntry values are computed to account for these changes
- allows font entry weights which are not multiples of 100, but restricts them
  to range of 100 to 1000
- bumps the font database version number to force a recompute
break
# We prefer weight values from the OS/2 table, if available, otherwise
# infer from the "name" table's style
weight = props.get("weight")
if not weight:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure this was meant to be if weight is None:, just with the bad habits of years past.

@corranwebster corranwebster merged commit ff42b97 into main Mar 25, 2022
@corranwebster corranwebster deleted the fix/font-parsing branch March 29, 2022 09:54
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.

Kiva fonttool weight constants don't match OpenType and CSS specs
2 participants