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

"Text" weight dropping out in Chrome/Windows when installed locally #341

Closed
colinmford opened this issue Sep 21, 2020 · 8 comments
Closed
Assignees

Comments

@colinmford
Copy link

colinmford commented Sep 21, 2020

Hey all,

While investigating a bug in a web app, I found an issue in Chromium that the Text weight of IBM Plex Sans/Serif exposes. It's not a problem with the font (I'm fairly certain), but I wanted to link to the ticket here since it affects Plex (among other fonts with "non-standard" style names such as "Text", "Book", etc), in the hopes that someone else here can confirm the issue and/or can help get it resolved. Thanks!

https://bugs.chromium.org/p/chromium/issues/detail?id=1130792

The issue can be reproduced as follows:

  1. Install IBM Plex Sans on your system by dragging the ttfs to the fonts folder (~/Library/Fonts on Mac, C:/Windows/Fonts on Windows)
  2. Open this page (zip) in Chrome on Windows 10 (or Edge, a Chromium-based browser), and observe that only the "Text" weight falls back to the monospace font.

IBM Plex Sans - Chrome-Win

  1. Open the same page in Chrome/Mac, Firefox/Win or Firefox/Mac, and observe the "Text" weight comes through correctly.

IBM Plex Sans - Chrome-Mac

IBM Plex Sans - Firefox-Win

IBM Plex Sans - Firefox-Mac

The test page declares each style of IBM Plex Sans in the following manner:

The font's "font family" field (Windows Name ID 1) is reproduced in the font-family CSS property. The font-weight and font-style CSS attributes reflect the font's "font style" field (Windows Name ID 2).

i.e.

font-family: "IBM Plex Sans Text";
font-weight: normal;
font-style: italic;

or

font-family: "IBM Plex Sans";
font-weight: bold;
font-style: normal;

etc.

This is how the fonts are referenced if a user makes an HTML document from a Word document, for example.

Thanks!

@twardoch
Copy link

I don't think it's related to the names but rather to the fact that Text has OS/2.usWeightClass = 450, and Chrome probably makes an assumption that font-weight only goes in full 100s for local fonts.

@twardoch
Copy link

Erm... But font-weight: normal = 400, and the font has usWeighClass 450. So that won't work. For local fonts, I think some browsers use usWeightClass for font-weight. For @font-face webfonts, you declare which font-weight a given font file corresponds to so usWeightClass is not used.

@twardoch
Copy link

AFAIK, the names don't matter.

@colinmford
Copy link
Author

colinmford commented Sep 22, 2020

I agree normally the names don't matter but I think here it does matter for the following reasons:

  1. Other style names that aren't working are "Book" and "Ultra", and others. The all the weights that do work are listed in this FontWeights Windows API (https://docs.microsoft.com/en-us/uwp/api/windows.ui.text.fontweights?view=winrt-19041#remarks), all the ones that don't work (that I've tried) are not listed. I agree this might be correlation rather than causation, but the correlation is quite strong. Plus, since this seems to be a Windows-only issue, I thought maybe some Windows API might be involved.
  2. If I TTX a working font, like the "Light" style with a usWeightClass of 300, and find/replace the name tables to say something like "FooBar" (leaving the OS/2 table untouched), the font will now not show up. Works fine in Firefox and Chrome/Mac.
  3. If I TTX the "Text", and change the names to "ExtraBold", Chrome/Win will look for the Bold instead of displaying the actual font named "IBM Sans ExtraBold". Again works fine in Firefox and Chrome/Mac.

I have a hypothesis that Chrome on Windows is using some sort of map to match style names to approximate weight numbers, and that map doesn't include unusual/arbitrary weight names like "Book", "Ultra", "Text" and "FooBar".

Screen Shot 2020-09-22 at 11 17 46 AM

Screen Shot 2020-09-22 at 11 16 46 AM

Screen Shot 2020-09-22 at 11 14 48 AM

@BoldMonday
Copy link
Collaborator

Hi @colinmford, thanks for the extensive report!

What is your impression here: is this a Chrome issue or something that can be fixed easily in the fonts?

@colinmford
Copy link
Author

@BoldMonday It seems like it's an issue in Chrome, which they now seem to be investigating. Just wanted to mention it here in case you had anything to add to the report since Plex was one of the fonts being affected by this bug.

@BoldMonday
Copy link
Collaborator

BoldMonday commented Oct 8, 2020

I figured as much. Lots of folks within IBM are using Chrome so it's good to know this is not a bug in Plex. We just try to be very precise and consistent with all the settings in the font info.
Thanks for the feedback @colinmford!

@mjabbink
Copy link
Collaborator

Closing but let me know otherwise.

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

4 participants