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

Unexpected font selection with named + weight differences #241

Open
ecton opened this issue Mar 6, 2024 · 3 comments
Open

Unexpected font selection with named + weight differences #241

ecton opened this issue Mar 6, 2024 · 3 comments

Comments

@ecton
Copy link

ecton commented Mar 6, 2024

I was trying to add support for dynamically loading fonts to my library that uses cosmic-text, and I downloaded a random font and tried specifying the attribute using the FamilyOwned::Name() variant. I spent an hour debugging this before I finally noticed why it wasn't being found.

It wasn't due to a caching issue, it was due to the font I downloaded having a weight of 300, not 400. When I change the buffer's attributes to be a weight of 300, the font is found.

To me, the name of a font is more significant than the weight, especially if the difference is 100 or less. For reference, I was testing with Shantell Sans.

@ecton
Copy link
Author

ecton commented Mar 7, 2024

What font has a weight of 300? (specifically)

The linked font is the one I was testing with, specifically I was testing the non-italic variant named ShantellSans-VariableFont_BNCE,INFM,SPAC,wght.ttf

Assume you are using the static fonts.

Correct, I'm using local files that have been loaded. I have no problems with the loading process.

And are you using the fonts downloaded from Google Fonts (v1.008) or the fonts from the repository release (v1.009)?

I'm downloading from the page I linked by clicking Get Font, then Download All.

This ticket really isn't about the font itself, it's about the methodology of font fallback selection. To me, if I have asked Cosmic Text to render "Shantell Sans" and the font weight delta is 100, I feel like it should still render "Shantell Sans" instead of an arbitrary fallback that happens to match the weight.

Just to add another font to the mix: while debugging this, I picked another random font from Google fonts and it has a default weight of 200: https://fonts.google.com/specimen/Ojuju. I got really unlucky in that my two test fonts I was using today both had non-400 weights.

@ecton
Copy link
Author

ecton commented Mar 7, 2024

That is the variable font. If you want to test the static fonts, they are in the static folder.

I feel like we're talking past each other. Can we stop focusing on specific fonts, and talk about the actual issue I've reported? Sure, I could have picked some better versions of the fonts, but other users of my library might have variable fonts installed because other programs support variable fonts. The subject of this issue and the main focus of my description in the issue have not been about a specific font, but a very specific request.

@kenmcd
Copy link

kenmcd commented Mar 7, 2024

OK.

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

No branches or pull requests

2 participants