From 6ee86a64b8d008e69c599dbf4b886dab80c60deb Mon Sep 17 00:00:00 2001 From: Stephen Nixon Date: Tue, 26 Mar 2019 16:04:28 -0400 Subject: [PATCH] resolve and document fontbakery FAILs --- FiraCode.glyphs | 44 +++++-- distr/ttf/FiraCode-Bold.ttf | Bin 248252 -> 248252 bytes distr/ttf/FiraCode-Light.ttf | Bin 223952 -> 223952 bytes distr/ttf/FiraCode-Medium.ttf | Bin 237692 -> 237692 bytes distr/ttf/FiraCode-Regular.ttf | Bin 239572 -> 239572 bytes distr/ttf/FiraCode-Retina.ttf | Bin 240488 -> 240488 bytes distr/variable_ttf/FiraCode-VF.ttf | Bin 241724 -> 241780 bytes distr/variable_ttf/FiraCode-VF.ttx | 57 --------- .../checks/FiraCode-Light.checks.md | 27 ++-- googlefonts-qa/notes/QA-notes.md | 120 ++++++++++++------ .../scripts/set-vertical-metrics.py | 113 +++++++++++++++++ 11 files changed, 234 insertions(+), 127 deletions(-) delete mode 100644 distr/variable_ttf/FiraCode-VF.ttx create mode 100644 googlefonts-qa/scripts/set-vertical-metrics.py diff --git a/FiraCode.glyphs b/FiraCode.glyphs index accb177..b901f68 100644 --- a/FiraCode.glyphs +++ b/FiraCode.glyphs @@ -234,11 +234,11 @@ capHeight = 1374; customParameters = ( { name = typoAscender; -value = 1870; +value = 1980; }, { name = typoDescender; -value = -530; +value = -644; }, { name = typoLineGap; @@ -246,19 +246,19 @@ value = 0; }, { name = winAscent; -value = 1870; +value = 2164; }, { name = winDescent; -value = 530; +value = 1000; }, { name = hheaAscender; -value = 1870; +value = 1980; }, { name = hheaDescender; -value = -530; +value = -644; }, { name = hheaLineGap; @@ -300,11 +300,11 @@ capHeight = 1386; customParameters = ( { name = typoAscender; -value = 1870; +value = 1980; }, { name = typoDescender; -value = -530; +value = -644; }, { name = typoLineGap; @@ -312,19 +312,19 @@ value = 0; }, { name = winAscent; -value = 1870; +value = 2164; }, { name = winDescent; -value = 530; +value = 1000; }, { name = hheaAscender; -value = 1870; +value = 1980; }, { name = hheaDescender; -value = -530; +value = -644; }, { name = hheaLineGap; @@ -107244,6 +107244,10 @@ name = "Remove Features"; value = ( cpsp ); +}, +{ +name = weightClass; +value = 300; } ); interpolationWeight = 62; @@ -107260,6 +107264,10 @@ name = "Remove Features"; value = ( cpsp ); +}, +{ +name = weightClass; +value = 400; } ); interpolationWeight = 84; @@ -107270,11 +107278,10 @@ instanceInterpolations = { name = Regular; }, { -exports = 0; customParameters = ( { name = weightClass; -value = 900; +value = 450; }, { name = "Remove Features"; @@ -107289,6 +107296,7 @@ instanceInterpolations = { "B67F0F2D-EC95-4CB8-966E-23AE86958A69" = 0.64583; }; name = Retina; +weightClass = Normal; }, { customParameters = ( @@ -107297,6 +107305,10 @@ name = "Remove Features"; value = ( cpsp ); +}, +{ +name = weightClass; +value = 500; } ); interpolationWeight = 112; @@ -107334,6 +107346,10 @@ name = "Remove Features"; value = ( cpsp ); +}, +{ +name = weightClass; +value = 700; } ); interpolationWeight = 158; diff --git a/distr/ttf/FiraCode-Bold.ttf b/distr/ttf/FiraCode-Bold.ttf index 7c38c5f6b083e1180a63abc2e3f73763312e508c..6d304338305cb1030afbdd1d417423d6de4d9be4 100644 GIT binary patch delta 106 zcmdlpnSak@{s{prnNOxOObm$=@(5yJw%o(Oz+je+oQ zFPhKgwx7#o+XXAlkuCWgcb39vCR-D+WAU@*(bNKIrq!&18O2xBg%-`{r(4D5bP zLe1xL+t1}PZa~Xx&QzG diff --git a/distr/ttf/FiraCode-Regular.ttf b/distr/ttf/FiraCode-Regular.ttf index b33c44690870acbb25f90023132d6f8580413043..92161795a78123fa449bcf9727098d0060ad48e3 100644 GIT binary patch delta 58 zcmca|p6|+ez6qO{oLCySv~FQ+-NLkW3-enkX@S!Y@%%Pl8Q7U$FaW{zYtxp4=o<%& Mr)}RO%`DLa0KtnEQ2+n{ delta 58 zcmca|p6|+ez6qO{ICnH|Y2Cuux`k=$7Us87(t_4E;`wd9GO#nhU;u*a*QPB8(Kq)0 M_S(KjnpvU;0NoB3Pyhe` diff --git a/distr/ttf/FiraCode-Retina.ttf b/distr/ttf/FiraCode-Retina.ttf index 6dd48ecefd70a0c8ceb477b0143d872651828775..a016314e11b46a7090f8bb6057bd222278aecc1d 100644 GIT binary patch delta 42 zcmV+_0M-BK)(+^_4v?|}LIr`eg|q>Mv;wuX14$kO66dCt9|IKwz%!S(7#{;rjEoEr AY5)KL delta 42 zcmV+_0M-BK)(+^_4v?|}3All@g|q>Mv;wuX14$kO6Iei&9|IKwzxztJ7#{;rjF46k AY5)KL diff --git a/distr/variable_ttf/FiraCode-VF.ttf b/distr/variable_ttf/FiraCode-VF.ttf index d2a1e849fa9c1d4a666497bb887563957e69a301..478384c606f401f12f7fd44ee3af012d82554811 100644 GIT binary patch delta 726 zcmYk3QAkr^6vzMPyLWSQb6Qv}nYQ*2SwXpEsQ55Tw?&qC0L3HJ5{5>t^jh_hb+aXNTvATs{yxD(=>A82k5Mh1_3${y{6nAU;ldT6L8?5_{J zhgclt`a>sJKN`8ez&g#kcOY`moBX)k2vCLfXe8Pbok}Gh^7#^Lmv&v72s{rFgm>{P z8=mu5w3N5+y9p|N2Tb=;S0{Bkprt_NTbW^UxjO78heztWzd@<_z?E1o zJ)JY+O5t!Rlct?Y{@0Dn0^PQ9{~6X1M6C>$Lsc|e?sp6rSZ%^r6_^wt9nfoQC!bCx%*hF1*9z+SUb>U1@r*W77+9uX zN?iw%NFa@I459_Y$RJUeTA|5ryG`?$FF!Q@q~oy{J9@$hmnEN|{JC7~q2_lkiG8LL MyK3S5l5ns61+5l|-2eap diff --git a/distr/variable_ttf/FiraCode-VF.ttx b/distr/variable_ttf/FiraCode-VF.ttx deleted file mode 100644 index 2d309f0..0000000 --- a/distr/variable_ttf/FiraCode-VF.ttx +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/googlefonts-qa/checks/FiraCode-Light.checks.md b/googlefonts-qa/checks/FiraCode-Light.checks.md index f4f49c3..a002adc 100644 --- a/googlefonts-qa/checks/FiraCode-Light.checks.md +++ b/googlefonts-qa/checks/FiraCode-Light.checks.md @@ -267,11 +267,10 @@ But instead we have got: 'Copyright 2012-2015 The Mozilla Foundation, Telefonica
-πŸ”₯ FAIL: Checking OS/2 usWinAscent & usWinDescent. +πŸ”₯ FAIL: Variable font weight coordinates must be multiples of 100. -* [com.google.fonts/check/family/win_ascent_and_descent](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/family/win_ascent_and_descent) -* πŸ”₯ **FAIL** OS/2.usWinAscent value should be equal or greater than 2100, but got 1870 instead [code: ascent] -* πŸ”₯ **FAIL** OS/2.usWinDescent value should be equal or greater than 1000, but got 530 instead [code: descent] +* [com.google.fonts/check/varfont_weight_instances](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont_weight_instances) +* πŸ”₯ **FAIL** Found an variable font instance with 'wght'=450.0. This should instead be a multiple of 100.
@@ -444,9 +443,9 @@ But instead we have got: 'Copyright 2012-2015 The Mozilla Foundation, Telefonica | | FiraCode-Light.ttf | |:--- | ---:| -| Dehinted Size | 238.0kb | +| Dehinted Size | 238.1kb | | Hinted Size | 236.1kb | -| Increase | -1996 bytes | +| Increase | -1992 bytes | | Change | -0.8 % | @@ -494,7 +493,7 @@ The version string must ideally include a git commit hash and either a 'dev' or β„Ή INFO: Font contains all required tables? * [com.google.fonts/check/required_tables](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/required_tables) -* β„Ή **INFO** This font contains the following optional tables [GPOS, gasp, DSIG, loca, GSUB, prep] +* β„Ή **INFO** This font contains the following optional tables [GSUB, loca, GPOS, DSIG, gasp, prep] * 🍞 **PASS** Font contains all required tables.
@@ -808,6 +807,13 @@ The version string must ideally include a git commit hash and either a 'dev' or * [com.google.fonts/check/varfont/has_HVAR](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont/has_HVAR) * 🍞 **PASS** This variable font contains an HVAR table. + +
+🍞 PASS: Checking OS/2 usWinAscent & usWinDescent. + +* [com.google.fonts/check/family/win_ascent_and_descent](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/family/win_ascent_and_descent) +* 🍞 **PASS** OS/2 usWinAscent & usWinDescent values look good! +
🍞 PASS: Checking OS/2 Metrics match hhea Metrics. @@ -850,13 +856,6 @@ The version string must ideally include a git commit hash and either a 'dev' or * [com.google.fonts/check/varfont_has_instances](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont_has_instances) * 🍞 **PASS** OK -
-
-🍞 PASS: Variable font weight coordinates must be multiples of 100. - -* [com.google.fonts/check/varfont_weight_instances](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont_weight_instances) -* 🍞 **PASS** OK -
🍞 PASS: Checking with ftxvalidator. diff --git a/googlefonts-qa/notes/QA-notes.md b/googlefonts-qa/notes/QA-notes.md index d58c956..1a8db66 100644 --- a/googlefonts-qa/notes/QA-notes.md +++ b/googlefonts-qa/notes/QA-notes.md @@ -1,49 +1,9 @@ # QA Notes – checking & polishing Fira Code for Google Fonts -- [ ] autohint static TTFs +- [x] autohint static TTFs ## Checks to resolve - -
-πŸ”₯ FAIL: Variable font weight coordinates must be multiples of 100. - -* [com.google.fonts/check/varfont_weight_instances](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont_weight_instances) -* πŸ”₯ **FAIL** Found an variable font instance with 'wght'=450.0. This should instead be a multiple of 100. - -
- -- (fontmake also started to fail, as "Retina" instance was given a custom param of `weightClass: 900`) - -- [x] uncheck "Retina" instance as `is active` instance -- [ ] file issue with FontBakery to ask Dave/Marc about this `450` weight "Retina" instance - ----------------------------- - -
-πŸ”₯ FAIL: Checking OS/2 usWinAscent & usWinDescent. - -* [com.google.fonts/check/family/win_ascent_and_descent](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/family/win_ascent_and_descent) -* πŸ”₯ **FAIL** OS/2.usWinAscent value should be equal or greater than 1050, but got 935 instead [code: ascent] -* πŸ”₯ **FAIL** OS/2.usWinDescent value should be equal or greater than 500, but got 265 instead [code: descent] - -
- -- [ ] run script to correct vertical metrics, recheck - - ----------------------------- - -
-[119] FiraCode-Light.ttf -
-πŸ”₯ FAIL: Checking file is named canonically. - -* [com.google.fonts/check/canonical_filename](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/canonical_filename) -* πŸ”₯ **FAIL** This is a variable font, but it is using a naming scheme typical of a static font. -* πŸ”₯ **FAIL** Please change the font filename to use one of the following valid suffixes for variable fonts: VF, Italic-VF, Roman-VF - -
πŸ”₯ FAIL: Checking OS/2 usWeightClass. @@ -52,6 +12,8 @@
+- [ ] explore to find why this would be happening ... + - Encode Sans gets an OS/2 usWeightClass of `100`, matching its default instance. ====================================================================================== @@ -69,7 +31,22 @@ But instead we have got: 'Copyright 2012-2015 The Mozilla Foundation, Telefonica - additionally, it's unclear how the original copyright on Fira Mono & Fira Code should best be integrated to credit all designers involved - [x] file issue on fontbakery (https://github.com/googlefonts/fontbakery/issues/2419) -- [ ] confirm that current approach is fine (https://github.com/google/fonts/issues/1460#issuecomment-476713822) +- [x] confirm that current approach is fine (https://github.com/google/fonts/issues/1460#issuecomment-476713822) (seems okay, based on Hangouts discussion) + +---------------------------- + +
+[119] FiraCode-Light.ttf +
+πŸ”₯ FAIL: Checking file is named canonically. + +* [com.google.fonts/check/canonical_filename](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/canonical_filename) +* πŸ”₯ **FAIL** This is a variable font, but it is using a naming scheme typical of a static font. +* πŸ”₯ **FAIL** Please change the font filename to use one of the following valid suffixes for variable fonts: VF, Italic-VF, Roman-VF + +
+ +- [x] ask if/when this is changing (via hangouts) – Marc: "We’ll batch the vfs once they’ve implemented it" ---------------------------- @@ -102,4 +79,63 @@ But instead we have got: 'Copyright 2012-2015 The Mozilla Foundation, Telefonica - [x] remove Β© symbol +---------------------------- + +
+[31] Family checks +
+πŸ”₯ FAIL: METADATA.pb: According Google Fonts standards, families should have a Regular style. + +* [com.google.fonts/check/metadata/has_regular](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/metadata/has_regular) +* πŸ”₯ **FAIL** This family lacks a Regular (style: normal and weight: 400) as required by Google Fonts standards. + +
+ +- [x] this issue is already filed with fontbakery (https://github.com/googlefonts/fontbakery/issues/2378) + +---------------------------- + +
+πŸ”₯ FAIL: Checking OS/2 usWinAscent & usWinDescent. + +* [com.google.fonts/check/family/win_ascent_and_descent](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/family/win_ascent_and_descent) +* πŸ”₯ **FAIL** OS/2.usWinAscent value should be equal or greater than 1050, but got 935 instead [code: ascent] +* πŸ”₯ **FAIL** OS/2.usWinDescent value should be equal or greater than 500, but got 265 instead [code: descent] + +
+ +- [x] run script to correct vertical metrics, recheck +- [x] ~~add issue~~ issue exists to gf-docs to update vertical metrics to recommendation at https://github.com/googlefonts/fontbakery/issues/2164#issuecomment-436595886 (will track / manage separately) + + +---------------------------- + +
+πŸ”₯ FAIL: Glyph names are all valid? + +* [com.google.fonts/check/valid_glyphnames](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/valid_glyphnames) +* πŸ”₯ **FAIL** The following glyph names do not comply with naming conventions: ['numbersign_numbersign_numbersign.liga', 'numbersign_numbersign_numbersign_numbersign.liga', 'numbersign_underscore_parenleft.liga', 'backslash_backslash_backslash.rem', 'numbersign_numbersign_numbersign.liga.rem', 'numbersign_numbersign_numbersign_numbersign.liga.rem', 'semicolon_semicolon_semicolon.rem', 'quadrantUpperLeftAndLowerLeftAndLowerRight', 'quadrantUpperLeftAndUpperRightAndLowerLeft', 'quadrantUpperLeftAndUpperRightAndLowerRight', 'quadrantUpperRightAndLowerLeftAndLowerRight', 'whiteSquareWithUpperLeftQuadrant', 'whiteSquareWithLowerLeftQuadrant', 'whiteSquareWithLowerRightQuadrant', 'whiteSquareWithUpperRightQuadrant', 'asciitilde_asciitilde_greater.liga', 'ampersand_ampersand_ampersand.rem', 'asciitilde_asciitilde_asciitilde.rem'] A glyph name may be up to 31 characters in length, must be entirely comprised of characters from the following set: A-Z a-z 0-9 .(period) _(underscore). and must not start with a digit or period. There are a few exceptions such as the special character ".notdef". The glyph names "twocents", "a1", and "_" are all valid, while "2cents" and ".twocents" are not. + +
+ +- [x] issue filed at https://github.com/tonsky/FiraCode/issues/730 – I'm guessing this won't cause any real issues on the web fonts. + - I'll leave these glyphs as they are for now, and let @tonsky handle it if it seems to be the cause of an actual user issue + +---------------------------- + +
+πŸ”₯ FAIL: Variable font weight coordinates must be multiples of 100. + +* [com.google.fonts/check/varfont_weight_instances](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/varfont_weight_instances) +* πŸ”₯ **FAIL** Found an variable font instance with 'wght'=450.0. This should instead be a multiple of 100. + +
+ +- (fontmake also started to fail, as "Retina" instance was given a custom param of `weightClass: 900`) + +- [x] uncheck "Retina" instance as `is active` instance +- [x] file issue with FontBakery to ask Dave/Marc about this `450` weight "Retina" instance (https://github.com/googlefonts/fontbakery/issues/2420)- +- [x] change if you find a better approach to keep Retina without disrupting builds / Regular weight + - To set up the instance in GlyhpsApp such that it exports a font as expected: "Retina" gets a custom parameter of `weightClass: 450`, and a glyphs menu-weight of "Normal." Tested in axis-praxis, it seems to work well. All instances have a `weightClass` custom parameter. + ---------------------------- \ No newline at end of file diff --git a/googlefonts-qa/scripts/set-vertical-metrics.py b/googlefonts-qa/scripts/set-vertical-metrics.py new file mode 100644 index 0000000..f68e320 --- /dev/null +++ b/googlefonts-qa/scripts/set-vertical-metrics.py @@ -0,0 +1,113 @@ +#MenuTitle: Set Vertical Metric Params +# -*- coding: utf-8 -*- + +font = Glyphs.font + +print(font) + +__doc__=""" + Assumes the masters keep the same vertical metrics. + + I am not sure whether winAscent and winDescent should be different between masters, + otherwise, but you should check if that's the case before using this script + on a font where min/max heights are different between styles. + + Useful when created; may or may not match the latest Google Fonts vertical metrics standards. +""" + +font = Glyphs.font + + + +caps = ["A", "Aacute", "Abreve", "Acircumflex", "Adieresis", "Agrave", "Amacron", "Aogonek", "Aring", "Aringacute", "Atilde", "AE", "AEacute", "B", "C", "Cacute", "Ccaron", "Ccedilla", "Ccircumflex", "Cdotaccent", "D", "Eth", "Dcaron", "Dcroat", "Ddotbelow", "E", "Eacute", "Ebreve", "Ecaron", "Ecircumflex", "Edieresis", "Edotaccent", "Edotbelow", "Egrave", "Emacron", "Eogonek", "Etilde", "F", "G", "Gbreve", "Gcircumflex", "Gcommaaccent", "Gdotaccent", "H", "Hbar", "Hcircumflex", "Hdotbelow", "I", "IJ", "Iacute", "Ibreve", "Icircumflex", "Idieresis", "Idotaccent", "Idotbelow", "Igrave", "Imacron", "Iogonek", "Itilde", "J", "Jcircumflex", "K", "Kcommaaccent", "L", "Lacute", "Lcaron", "Lcommaaccent", "Ldot", "Lslash", "M", "N", "Nacute", "Ncaron", "Ncommaaccent", "Ndotaccent", "Eng", "Ntilde", "O", "Oacute", "Obreve", "Ocircumflex", "Odieresis", "Odotbelow", "Ograve", "Ohungarumlaut", "Omacron", "Oogonek", "Oslash", "Oslashacute", "Otilde", "OE", "P", "Thorn", "Q", "R", "Racute", "Rcaron", "Rcommaaccent", "Rdotbelow", "S", "Sacute", "Scaron", "Scircumflex", "Sdotbelow", "Schwa", "T", "Tbar", "Tcaron", "Tdotbelow", "U", "Uacute", "Ubreve", "Ucircumflex", "Udieresis", "Udotbelow", "Ugrave", "Uhungarumlaut", "Umacron", "Uogonek", "Uring", "Utilde", "V", "W", "Wacute", "Wcircumflex", "Wdieresis", "Wgrave", "X", "Y", "Yacute", "Ycircumflex", "Ydieresis", "Ygrave", "Ytilde", "Z", "Zacute", "Zcaron", "Zdotaccent", "Zdotbelow", "uni015E", "uni0162", "uni01C4", "uni01C5", "uni01C7", "uni01C8", "uni01CA", "uni01CB", "uni01F1", "uni01F2", "uni0218", "uni021A" ] +lowercase = ["a", "aacute", "abreve", "acircumflex", "adieresis", "agrave", "amacron", "aogonek", "aring", "aringacute", "atilde", "ae", "aeacute", "b", "c", "cacute", "ccaron", "ccedilla", "ccircumflex", "cdotaccent", "d", "eth", "dcaron", "dcroat", "ddotbelow", "e", "eacute", "ebreve", "ecaron", "ecircumflex", "edieresis", "edotaccent", "edotbelow", "egrave", "emacron", "eogonek", "etilde", "schwa", "f", "g", "gbreve", "gcircumflex", "gcommaaccent", "gdotaccent", "h", "hbar", "hcircumflex", "hdotbelow", "i", "dotlessi", "iacute", "ibreve", "icircumflex", "idieresis", "idotbelow", "igrave", "ij", "imacron", "iogonek", "itilde", "j", "dotlessj", "jcircumflex", "k", "kcommaaccent", "kgreenlandic", "l", "lacute", "lcaron", "lcommaaccent", "ldot", "lslash", "m", "n", "nacute", "napostrophe", "ncaron", "ncommaaccent", "ndotaccent", "eng", "ntilde", "o", "oacute", "obreve", "ocircumflex", "odieresis", "odotbelow", "ograve", "ohungarumlaut", "omacron", "oogonek", "oslash", "oslashacute", "otilde", "oe", "p", "thorn", "q", "r", "racute", "rcaron", "rcommaaccent", "rdotbelow", "s", "sacute", "scaron", "scircumflex", "sdotbelow", "germandbls", "t", "tbar", "tcaron", "tdotbelow", "u", "uacute", "ubreve", "ucircumflex", "udieresis", "udotbelow", "ugrave", "uhungarumlaut", "umacron", "uni015F", "uni0163", "uni01C6", "uni01C9", "uni01CC", "uni01F3", "uni0219", "uni021B", "uogonek", "uring", "utilde", "v", "w", "wacute", "wcircumflex", "wdieresis", "wgrave", "x", "y", "yacute", "ycircumflex", "ydieresis", "ygrave", "ytilde", "z", "zacute", "zcaron", "zdotaccent", "zdotbelow", "c_t", "f_b", "f_f", "f_f_b", "f_f_h", "f_f_i", "f_f_j", "f_f_k", "f_f_l", "f_f_t", "f_h", "f_i", "f_j", "f_k", "f_l", "f_t", "s_t", ] + +# starter values +mainMaxDescent = 0 +mainMaxDescentGlyph = "" +maxDescent = 0 +mainMaxAscent = 0 +mainMaxAscentGlyph = "" +maxAscent = 0 + +# find highest and lowest point in font +for glyph in font.glyphs: + + # get total yMax and yMin, for win values + for layer in glyph.layers: + + # get descender of current layer + descent = layer.bounds.origin.y + + # get ascender of current layer + ascent = layer.bounds.size.height + descent + + # if descent/ascent of current layer is greater than previous max descents/ascents, update the max descent/ascent + if descent <= maxDescent: + maxDescent = descent + maxDescentGlyph = glyph.name + + if ascent >= maxAscent: + maxAscent = ascent + maxAscentGlyph = glyph.name + + # get descender of current layer + descent = layer.bounds.origin.y + + # get ascender of current layer (total height of layer, subtracting value of descender) + ascent = layer.bounds.size.height + descent + + # get maximums of only letters in list vars, for typo and hhea values + if glyph.name in caps: + + for layer in glyph.layers: + if ascent >= mainMaxAscent: + mainMaxAscent = ascent + mainMaxAscentGlyph = glyph.name + + + if glyph.name in lowercase: + # if descent/ascent of current layer is greater than previous max descents/ascents, update the max descent/ascent + if descent <= mainMaxDescent: + mainMaxDescent = descent + mainMaxDescentGlyph = glyph.name + + + + +# check values for sanity +print(maxDescentGlyph, maxDescent, maxAscentGlyph, maxAscent) + +# make lineGap so that the total of `ascent + descent + lineGap` equals 120% of UPM size + +UPM = font.upm + +totalSize = maxAscent + abs(maxDescent) + +# lineGap = int((UPM * 1.2)) - totalSize + +# print(UPM, UPM * 1.2, totalSize, lineGap) + +## use highest/lowest points to set custom parameters for winAscent and winDescent +## following vertical metric schema from https://github.com/googlefonts/gf-docs/tree/master/VerticalMetrics (actually, that source must be updated to better recommendations found at https://github.com/googlefonts/fontbakery/issues/2164#issuecomment-436595886) + +font.customParameters["Use Typo Metrics"] = True + +for master in font.masters: + + # Win Ascent/Descent = Font bbox yMax/yMin + master.customParameters["winAscent"] = maxAscent + master.customParameters["winDescent"] = abs(maxDescent) + + typoLineGap = 0 + master.customParameters["typoLineGap"] = typoLineGap + master.customParameters["hheaLineGap"] = typoLineGap + + typoDescender = mainMaxDescent + master.customParameters["typoDescender"] = typoDescender + master.customParameters["hheaDescender"] = typoDescender + + typoAscender = mainMaxAscent + master.customParameters["typoAscender"] = typoAscender + master.customParameters["hheaAscender"] = typoAscender +