Open sigurdle opened 2 years ago
Interesting - what platform (OS) are you testing on?
In Chrome's implementation we get the list of fonts via the OS's API - DirectWrite on Windows, CoreText on macOS, FontConfig on Linux/ChromeOS. So it should be the underlying API that is deriving those postscriptNames from the variable font file - we don't synthesize it ourselves.
Nice. I tried this with Chrome 102.0.5005.61 and got correct postscript name SegoeUIVariable_Light-Display
as per Adobe spec
So I tried again, and I still get "wrong results":
const fontArray = await queryLocalFonts();
for await (const metadata of fontArray)
{
metadata.postscriptName
Segoe-UI-Variable-Display-Bold Segoe-UI-Variable-Display-Light etc.
I'm now on chrome 103, windows 11.
Checked and I can confirm, Incorrect names like Segoe-UI-Variable-Display-Bold are coming from windows OS 11 which are not as per the Adobe standard spec.
Hi,
I'm using the Local Fonts API, and writing my own font parser to parse the blob. With regards to variable fonts:
The Local Fonts API gives me this in its array of fonts (the postscriptName) ... Segoe-UI-Variable-Display Segoe-UI-Variable-Display-Bold Segoe-UI-Variable-Display-Light Segoe-UI-Variable-Display-Semibold etc.
These names I believe are all coming from the same font file, a variable font file with an "fvar" table, when I'm parsing that file, the postscript names of these variable font "instances" do not seem to be included, but must be generated. Though I did find a document that suggests how to generate a postscript name from a variable font instance:
https://adobe-type-tools.github.io/font-tech-notes/pdfs/5902.AdobePSNameGeneration.pdf
This document doesn't seem to give the same results however as that returned from Local Fonts API. Even if I tweak it, I'm not getting same results. What I can get however is e.g this:
Segoe-UI-Variable-Light-Display
But Notice: "Light" and "Display" is reversed (There's a string in the file that says "Light Display", which I've used to build the final string) Local Fonts API returns "Display-Light", so its reversed from what I've managed to get, and I don't want to just HACK and reverse strings etc.
In short: How would I parse the truetype font to match it with the postscript names from a variable font, that the Local Fonts API is giving me ??
Thanks, Sigurd Lerstad