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

Font Library: font name changes weight depending on which variants are active #54915

Closed
annezazu opened this issue Sep 28, 2023 · 2 comments
Closed
Labels
[Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

annezazu commented Sep 28, 2023

In trying to replicate this issue #54568, I noticed that the font name in the Typography section changes weight depending on which variants are active. In the video below, watch the weight of "Inclusive sans" in the Typography section (it changes from a more normal weighting to thin to bold by th end):

Screen.Recording.2023-09-28.at.9.50.57.AM.mov

To replicate, add a font that has a number of variants and deactivate different ones to see the font name change weight.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Typography Font and typography-related issues and PRs labels Sep 28, 2023
@ironprogrammer
Copy link
Contributor

ironprogrammer commented Sep 29, 2023

This behavior seems correct to me. The Typography sidebar only displays active fonts/variants. E.g. if I have only enabled italics variants, I'd like that to be reflected here.

From the page load/resource perspective, when variants are deactivated, they are no longer enqueued. In order to display e.g. the "Regular" weight for each font would potentially require enqueuing non-active variants, and could behave inconsistently, say if a user has only uploaded an italics variant.

Testing this locally with only the italic variant of Inclusive Sans active (cleared cache and checking enqueues in #wp-fonts-local), Safari overrides italics and weight, but falls back to a serif font. Chrome ignores the overrides completely.

Figure 1: Safari - override italic face's font-style.
Safari override font-style

Figure 2: Chrome - override italic face's font-style.
Chrome override font-style

There might be other ways to normalize the listed font's styling if this behavior is desired.

@annezazu
Copy link
Contributor Author

Hmm interesting! I found it to be a bit random in my testing but I can see what you’re saying. I’ll close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants