question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Though params refer to variable font grade, script changes font weight

See original GitHub issue

Just noticed: the code that handles setting the variable grade in PR #25 uses the font-variation-settings with the "wght" flag:

https://github.com/glyphic-co/textblock/blob/934cf16a77f336710d8102bf374c118a2ac87a1e/src/textblock.js#L52-L53

This is based on the current 0.9.9 code:

https://github.com/glyphic-co/textblock/blob/567a0e3354f8c02469f2dc7c5f7c9f041a341f3e/src/textblock.js#L56

I’m new to variable fonts, but based on MDN’s Variable Font Guide, it looks like font grade is specified not using the "wght" flag but rather the "GRAD" flag (capitalized because grade is a (less common) custom variation axis, unlike weight, which is a (more commonly used) registered axis).

The font used in demo.html, Source Sans Variable - Roman, contains only the weight variation axis. So perhaps the parameter names should be changed from min/maxWidthVariableGrade to min/maxWidthFontWeight? The Variable part could be dropped, since both variable and non-variable fonts’ weights can be set using just the font-weight CSS property (non-variable fonts will just round to the nearest available weight); the font-variation-settings property that only works with variable fonts wouldn’t need to be used.

The VariableGrade params could be retained in addition to FontWeight params, and the code could be updated accordingly, though a variable font with a grade axis should be used to demonstrate it.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
davelab6commented, Sep 5, 2022

Also note that grade axes aren’t consistent; eg Roboto Flex and San Francisco both have grade but with different axis details

0reactions
theorosendorfcommented, Jul 31, 2019

Hey @tinymachine, I know you have this in https://github.com/glyphic-co/textblock/pull/36 but should we pull it out and apply it on its own?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variable fonts guide - CSS: Cascading Style Sheets | MDN
The term 'grade' refers to the relative weight or density of the typeface design, but differs from traditional 'weight' in that the physical ......
Read more >
Introduction to variable fonts on the web
Modern browsers that can handle variable fonts will get the variable font, and will have every weight between 200 and 700 available. Older ......
Read more >
Font weight isn't working with variable fonts? - Stack Overflow
For variable fonts, you want to use the font-variation-settings CSS property, not the font-weight . Also the file you are using represents ...
Read more >
Font Info Dialog Box - FontLab VI Help
Since variable fonts can have several master fonts and instances, ... For example, if a font's Weight is defined as Black, its Width...
Read more >
Variable Fonts
A simple resource for finding and trying variable fonts. ... Offered with discounted pricing while it's still a work in progress.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found