fontbakery icon indicating copy to clipboard operation
fontbakery copied to clipboard

Variable Fonts: Check 'wght' axis regular value is 400, range is within 1-1000, matches legacy styles

Open davelab6 opened this issue 7 years ago ‱ 19 comments

We should have FB checks that begin by checking if it is a variable font, and if so, is it compliant with a few basic things.

One is that fontmake allows users to make fonts with a 'wght' axis that isn't spec compliant, eg from eg 160-232. Spec says,

Valid numeric range: Values must be in the range 1 to 1000.

Scale interpretation: Values can be interpreted in direct comparison to values for usWeightClass in the 'OS/2' table, or the CSS font-weight property.

Recommended or required “Regular” value: 400 is required.

  • https://www.microsoft.com/typography/otspec/dvaraxistag_wght.htm

Should be easy to check

  • [x] default is 400
  • [ ] range is within 1-1000
  • [ ] if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual

davelab6 avatar Feb 13 '18 01:02 davelab6

CabinVFBeta from current master on google/fonts repo, has a defaultValue of 95.0 instead of 400. I think I can use it as a bad-reference for code-testing this check:

screenshot at 2018-02-14 18 48 50

felipesanches avatar Feb 14 '18 20:02 felipesanches

Sure

davelab6 avatar Feb 14 '18 20:02 davelab6

From these axes defined in the spec:

  • 'ital' Italic
  • 'opsz' Optical size
  • 'slnt' Slant
  • 'wdth' Width
  • 'wght' Weight

which are strictly required in any varfont?

felipesanches avatar Feb 14 '18 21:02 felipesanches

Did I get it right that all these are required (with these required default values in parentheses):

  • 'ital' Italic (0)
  • 'slnt' Slant (0)
  • 'wdth' Width (100)
  • 'wght' Weight (400)

And that only 'opsz' (Optical size) is not required, but, if available, then with a defaultValue between 9 and 13 ? (So this should have a check emitting a WARN)

felipesanches avatar Feb 14 '18 21:02 felipesanches

And the required axes would result in the check emitting a FAIL if any of them is missing.

felipesanches avatar Feb 14 '18 21:02 felipesanches

@felipesanches Not all of them are required. Some fonts may have just a wght axis, others just an ital axis.

Here's what I think we should test

  • The origin should be the Regular weight (90% sure every font in GF which is MM compatible contains a regular)
  • Weight axis range should be from 0-1000. When you export fonts from Glyphs it uses the 'Axes coordinates' field. In the past, designers have gotten the values for this field by measuring the stem of the 'H'

screen shot 2018-02-15 at 07 53 52

This means the range of the axis is very small e.g 32-240 (Like your CabinvVFBeta example), this is wrong. Designers need to set an additional field called Axis location for each master. We can then set the 400 value for the Regular master.

m4rc1e avatar Feb 15 '18 07:02 m4rc1e

@davelab6 asked for:

  • (a) "range is within 1-1000"
  • (b) "if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual"

@m4rc1e suggested: "Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' axis have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

felipesanches avatar Feb 15 '18 19:02 felipesanches

The specs don't say the default should have a specific value. They specify what value is required or recommended for the Regular instance, which doesn't have to be the default instance.

On Thu, 15 Feb 2018, 19:08 Felipe CorrĂȘa da Silva Sanches, < [email protected]> wrote:

@davelab6 https://github.com/davelab6 asked for:

  • (a) "range is within 1-1000"
  • (b) "if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual"

@m4rc1e https://github.com/m4rc1e suggested: "Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366029812, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1ao45kx4NEKEiszCGIu7ruuYuYpodMks5tVIDEgaJpZM4SDETW .

moyogo avatar Feb 18 '18 09:02 moyogo

See https://docs.microsoft.com/en-gb/typography/opentype/spec/dvaraxisreg

For variable font implementations that support a given axis, the “Regular” value will often be a good choice for the default value of that axis in the 'fvar' variation axis record. The default values set in the 'fvar' table, however, are implementation-specific, and fonts are not required to use this “Regular” value as the axis default value.

On Sun, 18 Feb 2018, 09:37 Denis Moyogo Jacquerye, [email protected] wrote:

The specs don't say the default should have a specific value. They specify what value is required or recommended for the Regular instance, which doesn't have to be the default instance.

On Thu, 15 Feb 2018, 19:08 Felipe CorrĂȘa da Silva Sanches, < [email protected]> wrote:

@davelab6 https://github.com/davelab6 asked for:

  • (a) "range is within 1-1000"
  • (b) "if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual"

@m4rc1e https://github.com/m4rc1e suggested: "Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366029812 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AB1ao45kx4NEKEiszCGIu7ruuYuYpodMks5tVIDEgaJpZM4SDETW

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366503555, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1ao6u62DfWa3ucMNEIi9zBC4MoEdzPks5tV-9FgaJpZM4SDETW .

moyogo avatar Feb 18 '18 09:02 moyogo

You need to fix your checks. They should only enforce required or recommended values for the Regular instance, not for the default when it's not the Regular.

On Sun, 18 Feb 2018, 09:42 Denis Moyogo Jacquerye, [email protected] wrote:

See https://docs.microsoft.com/en-gb/typography/opentype/spec/dvaraxisreg

For variable font implementations that support a given axis, the “Regular” value will often be a good choice for the default value of that axis in the 'fvar' variation axis record. The default values set in the 'fvar' table, however, are implementation-specific, and fonts are not required to use this “Regular” value as the axis default value.

On Sun, 18 Feb 2018, 09:37 Denis Moyogo Jacquerye, < [email protected]> wrote:

The specs don't say the default should have a specific value. They specify what value is required or recommended for the Regular instance, which doesn't have to be the default instance.

On Thu, 15 Feb 2018, 19:08 Felipe CorrĂȘa da Silva Sanches, < [email protected]> wrote:

@davelab6 https://github.com/davelab6 asked for:

  • (a) "range is within 1-1000"
  • (b) "if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual"

@m4rc1e https://github.com/m4rc1e suggested: "Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366029812

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AB1ao45kx4NEKEiszCGIu7ruuYuYpodMks5tVIDEgaJpZM4SDETW

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366503555 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AB1ao6u62DfWa3ucMNEIi9zBC4MoEdzPks5tV-9FgaJpZM4SDETW

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366503795, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1ao6ZLUbPVYKEdnUmYMcYGcgU_XqYjks5tV_B4gaJpZM4SDETW .

moyogo avatar Feb 18 '18 09:02 moyogo

Agree, thanks for the note Denis :)

On Feb 18, 2018 4:45 AM, "Denis Moyogo Jacquerye" [email protected] wrote:

You need to fix your checks. They should only enforce required or recommended values for the Regular instance, not for the default when it's not the Regular.

On Sun, 18 Feb 2018, 09:42 Denis Moyogo Jacquerye, < [email protected]> wrote:

See https://docs.microsoft.com/en-gb/typography/opentype/spec/ dvaraxisreg

For variable font implementations that support a given axis, the “Regular” value will often be a good choice for the default value of that axis in the 'fvar' variation axis record. The default values set in the 'fvar' table, however, are implementation-specific, and fonts are not required to use this “Regular” value as the axis default value.

On Sun, 18 Feb 2018, 09:37 Denis Moyogo Jacquerye, < [email protected]> wrote:

The specs don't say the default should have a specific value. They specify what value is required or recommended for the Regular instance, which doesn't have to be the default instance.

On Thu, 15 Feb 2018, 19:08 Felipe CorrĂȘa da Silva Sanches, < [email protected]> wrote:

@davelab6 https://github.com/davelab6 asked for:

  • (a) "range is within 1-1000"
  • (b) "if range is not starting/ending on a value cleanly divisible by 100, warn that it is unusual"

@m4rc1e https://github.com/m4rc1e suggested: "Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <

https://github.com/googlefonts/fontbakery/issues/ 1707#issuecomment-366029812

, or mute the thread <

https://github.com/notifications/unsubscribe-auth/ AB1ao45kx4NEKEiszCGIu7ruuYuYpodMks5tVIDEgaJpZM4SDETW

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/googlefonts/fontbakery/issues/ 1707#issuecomment-366503555 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ AB1ao6u62DfWa3ucMNEIi9zBC4MoEdzPks5tV-9FgaJpZM4SDETW

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/googlefonts/fontbakery/issues/ 1707#issuecomment-366503795>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AB1ao6ZLUbPVYKEdnUmYMcYGcgU_XqYjks5tV_B4gaJpZM4SDETW> .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366503957, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP9y9NxuP-wrUbpD-R9JRvfBJVnRyPkks5tV_E2gaJpZM4SDETW .

davelab6 avatar Feb 18 '18 20:02 davelab6

So, all these new checks should be looking for the value of one of these axes for the regular instance (instead of the default axis value) and then FAIL or WARN if they're not the recommended or required values, right?

I'll take care of this, then.

felipesanches avatar Feb 19 '18 18:02 felipesanches

Yes the regular at 400 is a fail, the bold at 700 too I think, and the rest can be warnings

On Feb 19, 2018 1:52 PM, "Felipe CorrĂȘa da Silva Sanches" < [email protected]> wrote:

So, all these new checks should be looking for the value of one of these axes for the regular instance (instead of the default axis value) and then FAIL or WARN if they're not the recommended or required values, right?

I'll take care of this, then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366776883, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP9y4PbTczJN3BF75yjT_B-LwdnvrHzks5tWcLhgaJpZM4SDETW .

davelab6 avatar Feb 19 '18 19:02 davelab6

Cool.

  • [x] FAIL when regular is not wght:400
  • [x] FAIL when bold is not wght:700

felipesanches avatar Feb 19 '18 19:02 felipesanches

All Regular:axis and Bold:wght checks have been fixed above (thanks @moyogo!)

I still need feedback on https://github.com/googlefonts/fontbakery/issues/1707#issuecomment-366029812

felipesanches avatar Feb 20 '18 02:02 felipesanches

"Weight axis range should be from 0-1000."

Should we expect that all fonts with a 'wght' axis have a range of exactly 0-1000 ? (If so, then testing (b) would not be necessary)

No, it should be 1–1000. From the wght spec:

Valid numeric range: Values must be in the range 1 to 1000.

arrowtype avatar Oct 13 '20 22:10 arrowtype

Also, it is not required that "wght default is 400". The spec says:

Recommended or required “Regular” value: 400 is required.

Variable fonts should probably include a 400 value for regular, but this needn’t be the default value of the wght axis.

arrowtype avatar Oct 13 '20 22:10 arrowtype

Hi, I'm getting this error for my italic fonts:

đŸ”„ FAIL The "wght" axis coordinate of the "Regular" instance must be 400. Got None instead. [code: wght-not-400].

I'm not sure if it is an issue of my designspace or fontbakery profile or me not understanding what exacly this fail is. My instance is called "Regular Italic". Maybe this profile assumes different naming scheme?

RafalBuchner avatar Oct 18 '22 14:10 RafalBuchner

The Open Type Spec requires "Italic" (instead of "Regular Italic") in Name ID2 to make sure style linking will work correctly. Then it is recommended to not generate name IDs 16 and 17 for the RIBBI styles since they would be the same as name IDs 1 and 2, but if you want "Regular Italic" it should be like this:

Name ID 1: Family Name Name ID 2: Italic Name ID 16: Family Name Name ID 17: Regular Italic

This scheme is unconventional and against opentype recommendations, therefore Fontbakery will continue to FAIL this check (at least for googlefonts), but from experience, it's okay the font will work everywhere.

Additional info: https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids

RosaWagner avatar Oct 20 '22 08:10 RosaWagner