Add the font version in the font panel
Categories
(DevTools :: General, enhancement)
Tracking
(relnote-firefox ?, firefox137 fixed)
People
(Reporter: pascalc, Assigned: nchevobbe)
References
(Blocks 3 open bugs, Regressed 1 open bug)
Details
(Keywords: dev-doc-needed)
Attachments
(2 files, 1 obsolete file)
The font panel does not indicate the version of a web font. I had to load the font in a local font viewer to know the version number of the font I am serving which was a bit cumbersome as I only wanted to check if the font I serve to users was the latest release.
It would be nice to have some metadata for the font available in the font panel, specifically the font version.
Thanks.
Assignee | ||
Comment 1•25 days ago
|
||
This would need to be exposed in InspectorFontFace
(see https://searchfox.org/mozilla-release/rev/3cc654dd02eff9b74658b3490ac464bb4bda9f13/dom/chrome-webidl/InspectorUtils.webidl#200-234)
Under the hood it's using gfxFontEntry
(https://searchfox.org/mozilla-release/rev/3cc654dd02eff9b74658b3490ac464bb4bda9f13/gfx/thebes/gfxFontEntry.h#185), which doesn't seem to have anything regarding font version yet.
Jonathan, would you know how hard it would be to access the font version ?
Comment 2•25 days ago
|
||
For OpenType/TrueType fonts, the "font version" is stored as a string in the font's name
table. It'd be straightforward to add this as another attribute to InspectorFontFace
(or perhaps add a method to access arbitrary name strings by their ID -- see https://learn.microsoft.com/en-gb/typography/opentype/spec/name#name-ids -- though I'm not sure how many others might be of interest).
One issue that could arise is language. Name strings are lang-tagged (and the font may contain multiple localizations), so we'd have to decide what to request. In the vast majority of cases, English strings will be present, but in the (rare) case where no en
string is present, should we search for other languages (and how do we choose, if more than one are present)? And if the user is running a non-English localization of the browser, should we try their language first and then fall back to English, or is that overkill given that AFAIK devtools in general is not localized?
Comment 3•25 days ago
|
||
Comment 4•25 days ago
|
||
Here's a simple patch (untested, as yet) that should expose the version string; see if you think this would serve your purpose. (Not asking for review just yet, let's confirm whether it's useful first.)
Comment 5•25 days ago
|
||
OK, I've added a simple testcase to the experimental patch.
Note that the InspectorFontFace.version
attribute will simply return the version string from the font, whatever it contains. The OpenType spec encourages a standard format:
Should begin with the pattern “Version <number>.<number>” (upper case, lower case, or mixed, with a space between “Version” and the number)...
but there's no actual enforcement of this, so you may see other things in the wild (sometimes a bare version number without the word "Version"; and sometimes a lengthy string with other information as well). So any UI that exposes this needs to be somewhat flexible regarding the content.
Assignee | ||
Comment 6•24 days ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #2)
For OpenType/TrueType fonts, the "font version" is stored as a string in the font's
name
table. It'd be straightforward to add this as another attribute toInspectorFontFace
(or perhaps add a method to access arbitrary name strings by their ID -- see https://learn.microsoft.com/en-gb/typography/opentype/spec/name#name-ids -- though I'm not sure how many others might be of interest).
Thanks for the link, this looks quite interesting to me, we could expose the most relevant information bits in DevTools, maybe in a summary/details element.
One issue that could arise is language. Name strings are lang-tagged (and the font may contain multiple localizations), so we'd have to decide what to request. In the vast majority of cases, English strings will be present, but in the (rare) case where no
en
string is present, should we search for other languages (and how do we choose, if more than one are present)? And if the user is running a non-English localization of the browser, should we try their language first and then fall back to English, or is that overkill given that AFAIK devtools in general is not localized?
We do actually localize DevTools, but it's true that for example, some error message aren't, and generally I think it's okay if we display things in english. If there's no english string I'm not sure what we should do. I guess we could simply return the first one we encounter? Again, the information is interesting but not critical, so we can go to the simplest solution IMO
(In reply to Jonathan Kew [:jfkthame] from comment #4)
Here's a simple patch (untested, as yet) that should expose the version string; see if you think this would serve your purpose. (Not asking for review just yet, let's confirm whether it's useful first.)
That is definitely useful, thanks a lot.
(In reply to Jonathan Kew [:jfkthame] from comment #5)
OK, I've added a simple testcase to the experimental patch.
Note that the
InspectorFontFace.version
attribute will simply return the version string from the font, whatever it contains. The OpenType spec encourages a standard format:Should begin with the pattern “Version <number>.<number>” (upper case, lower case, or mixed, with a space between “Version” and the number)...
but there's no actual enforcement of this, so you may see other things in the wild (sometimes a bare version number without the word "Version"; and sometimes a lengthy string with other information as well). So any UI that exposes this needs to be somewhat flexible regarding the content.
Yeah, I have a simple page and I can see that for some of my fonts, I'm getting Version x.x.x; more stuff
, and for other just x.x.x
. That's fine to me, I'll have that in mind when exposing this in the UI
Comment 7•24 days ago
|
||
OK, sounds good. Do you want us to move forward with just adding a version
attribute for now, or do you think anything else is also of interest? Or a general function that retrieves 'name' table strings by ID?
Assignee | ||
Comment 8•22 days ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #7)
OK, sounds good. Do you want us to move forward with just adding a
version
attribute for now, or do you think anything else is also of interest? Or a general function that retrieves 'name' table strings by ID?
Let's have the general function, I think it would be nice to display the description, the designer, the website, the license, … alongside the version
Updated•22 days ago
|
Comment 9•22 days ago
|
||
Comment on attachment 9461877 [details]
Bug 1943605 - Add a getNameString() method to the InspectorFontFace interface, to retrieve OpenType name strings (specified by name ID). r=#layout
Revision D235588 was moved to bug 1944662. Setting attachment 9461877 [details] to obsolete.
Updated•22 days ago
|
Assignee | ||
Comment 10•8 days ago
|
||
We're displaying some font data when they're available (version, designer,
manufacturer, vendor, description, license, …).
We're expanding browser_fontinspector_all-fonts.js to check for those data,
adding a new custom font file with fine-tuned data so we can check different
things than in the existing font (mainly, that we truncate some of the longer
values, and that we don't linkify some values when we don't have a URL).
Other tests needed to be updated because of the added font on the test support file.
Updated•8 days ago
|
Comment 11•8 days ago
|
||
Comment 12•7 days ago
|
||
bugherder |
Reporter | ||
Comment 13•7 days ago
|
||
Nicolas, could you nominate this for a release note addition? Thanks
https://wiki.mozilla.org/Release_Management/Release_Notes#Nomination_in_Bugzilla
Assignee | ||
Comment 14•3 days ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Adding a new feature in the Inspector Fonts panel
[Affects Firefox for Android]: No
[Suggested wording]: In the Inspector Fonts panel, we now display fonts metadata, like the the font version, designer, vendor, license, etc …
[Links (documentation, blog post, etc)]: -
Assignee | ||
Comment 15•3 days ago
|
||
For relnotes
Reporter | ||
Comment 16•3 days ago
|
||
Note and image added to Nightly release notes with this wording:
In the Inspector Fonts panel, we now display fonts metadata, like the the font version, designer, vendor, license…
I am keeping the release-note flag open until we ship the note in 137 final, thanks.
Comment 17•2 days ago
|
||
This should additionally be mentioned in the developer release notes for 137. So adding the dev-doc-needed
flag.
And it should also be added to the related DevTools documentation. So I've created bug 1948903 for that.
Sebastian
Description
•