question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instantiator usWidthClass

See original GitHub issue

We are having an issue with the instantiator regarding usWidthClass. Our Variable font ‘wdth’ axis spans from 50 to 275 (%) but the instantiator tries to map it to 50-200 because of the example of the OpenType specs: https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswidthclass https://github.com/googlefonts/fontmake/blob/24312140ce114691363f62b9293c46b10f95c0b4/Lib/fontmake/instantiator.py#L633

Why should the ‘wdth’ need to stick to the min=50 max=200 example of the specs? a variable font may as well have very different min-max values and still the named instance would need distinctive usWidthClass values.

In our case the last two wider instances get the same usWidthClass value of 9 (because both are beyond 200) and this is creating the confusion.

width_user_value = min(max(wdth_user_value, 50), 200): wouldn’t it be more correct to replace the arbitrary values of 50 and 200 by the VF wdth max and wdth min then map accordingly the instances values?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
anthrotypecommented, Aug 18, 2022

we could allow it to be greater than 9, but it certainly can’t be less than 0 because it’s an unsigned 16 bit integer in the OS/2 spec…

0reactions
fabiocaccamocommented, Aug 18, 2022

Your suggestion is correct, actually we are using the OS/2 fields for sorting because not all fonts are instantiated from a VF (so they have not instance coordinates).

Read more comments on GitHub >

github_iconTop Results From Across the Web

fontmake/instantiator.py at main · googlefonts ... - GitHub
"""Module for generating static font instances. It is an alternative to mutatorMath (used internally by fontmake) and ufoProcessor. The.
Read more >
PKG-INFO - platform/external/fonttools - android Git repositories
Metadata-Version: 2.1. Name: fonttools. Version: 3.39.0. Summary: Tools to manipulate font files. Home-page: http://github.com/fonttools/fonttools.
Read more >
TTFOS_2Table (FreeHEP Vector Graphics 2.2.2-SNAPSHOT API)
int, usWidthClass. int, usWinAscent. int, usWinDescent. int, version ... Constructor Summary. Constructors. Constructor and Description. TTFOS_2Table() ...
Read more >
Aspose.Font for .NET 20.9 Release Notes|Documentation
FontAgrumentException; Constructor Aspose.Font. ... FontNotSupportedOperationException; Constructor Aspose.Font. ... USWidthClass; Property Aspose.Font.
Read more >
fonttools [python-library] - Occam :: Details
usWeightClass and usWidthClass , and post.italicAngle based on the 'wght', 'wdth' and 'slnt' axis ... Added kind argument to T1Font constructor (c5c161c).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found