Skip to content

Improve font weight parsing#918

Merged
corranwebster merged 1 commit into
mainfrom
fix/font-parsing
Mar 25, 2022
Merged

Improve font weight parsing#918
corranwebster merged 1 commit into
mainfrom
fix/font-parsing

Conversation

@corranwebster
Copy link
Copy Markdown
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
# 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
Copy Markdown
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