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

SKTypefaceCollection fails to load fonts with weights that aren't % 50 == 0 #7046

Open
nielsbosma opened this issue Nov 30, 2021 · 5 comments
Labels

Comments

@nielsbosma
Copy link
Contributor

Describe the bug
SKTypefaceCollection fails to load fonts with weight that aren't weight % 50 == 0

To Reproduce
Steps to reproduce the behaviour:

Try to load a font with weight 270.

Issue at

for (var j = 0; j < initialWeight; j += 50)

My suggestion is to change the 50 to 10.

My workaround was to change the weight of the font to 250 with help from FontForge after struggling to get my font rendering to work.

Expected behaviour

It should work.

Screenshots

image

Desktop (please complete the following information):

  • OS: [e.g. Windows, Mac, Linux (State distribution)]
    Windows
  • Version
    -0.10.10
@nielsbosma nielsbosma added the bug label Nov 30, 2021
@Gillibald
Copy link
Contributor

A FontWeight of 270 isn't a valid value

@Gillibald
Copy link
Contributor

I think we could introduce an additional fallback here that just takes the first typeface that is in the collection.

@Sorien
Copy link
Contributor

Sorien commented Nov 30, 2021

I think we could introduce an additional fallback here that just takes the first typeface that is in the collection.

browsers have some fancy fallback mechanism https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#fallback_weights

@Gillibald
Copy link
Contributor

You should also be able to set the FontWeight to 270 and it should work. In the end the fallback logic is failing to select your desired typeface. The fallback is needed because you didn't specify the FontWeight.

@nielsbosma
Copy link
Contributor Author

The font that I purchased (Kommon Grotesk Light) has a weight of 270. Didn't want to specify both font family and weight for each place where I'm using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants