Adjusting metadata to pass Google Fonts QA checks

This commit is contained in:
Stephen Nixon 2019-03-25 18:06:24 -04:00
parent 2eb3fc6b9e
commit ee0b1aff51
22 changed files with 54205 additions and 47233 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ clojure/*.edn
FiraCode\ (Autosaved).glyphs
.cpcache
master_ufo
instance_ufo
instance_ufo
venv

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.32">
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="4"/>
<xAvgCharWidth value="600"/>
<usWeightClass value="400"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="650"/>
<ySubscriptYSize value="600"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="75"/>
<ySuperscriptXSize value="650"/>
<ySuperscriptYSize value="600"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="350"/>
<yStrikeoutSize value="50"/>
<yStrikeoutPosition value="315"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="0"/>
<bSerifStyle value="0"/>
<bWeight value="0"/>
<bProportion value="0"/>
<bContrast value="0"/>
<bStrokeVariation value="0"/>
<bArmStyle value="0"/>
<bLetterForm value="0"/>
<bMidline value="0"/>
<bXHeight value="0"/>
</panose>
<ulUnicodeRange1 value="11100000 00000000 00000010 11101111"/>
<ulUnicodeRange2 value="01010010 00000000 11111000 11111011"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00001000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="CTDB"/>
<fsSelection value="00000000 11000000"/>
<usFirstCharIndex value="13"/>
<usLastCharIndex value="65535"/>
<sTypoAscender value="935"/>
<sTypoDescender value="-265"/>
<sTypoLineGap value="0"/>
<usWinAscent value="935"/>
<usWinDescent value="265"/>
<ulCodePageRange1 value="01100000 00000000 00000000 10011111"/>
<ulCodePageRange2 value="11011111 11010111 00000000 00000000"/>
<sxHeight value="525"/>
<sCapHeight value="687"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="5"/>
</OS_2>
</ttFont>

View File

@ -0,0 +1,27 @@
name: "Fira Code"
designer: "Multiple Designers"
license: "OFL"
category: "Monospace"
date_added: "2019-03-25"
fonts {
name: "Fira Code"
style: "normal"
weight: 300
filename: "FiraCode-Light.ttf"
post_script_name: "FiraCode-Light"
full_name: "Fira Code Light"
copyright: "Copyright 2015 by Nikita Prokopov"
}
subsets: "cyrillic"
subsets: "cyrillic-ext"
subsets: "greek"
subsets: "greek-ext"
subsets: "latin"
subsets: "latin-ext"
subsets: "menu"
axes {
tag: "wght"
min_value: 300.0
default_value: 300.0
max_value: 700.0
}

12
googlefonts-qa/README.md Normal file
View File

@ -0,0 +1,12 @@
# Onboarding to Google Fonts
This directory is made to run a Google Fonts onboarding process for Inter.
The `build.sh` script builds variable and static font files as required by Google Fonts.
The `move-check.sh` script does a few things:
- Fixes a few pieces of font metadata to align them to Google Fonts standards
- Moves font files into a google/fonts directory, to prep/update a PR to [the official google/fonts repo](https://github.com/google/fonts)
- Runs [FontBakery](https://github.com/googlefonts/fontbakery) to check the fonts against Google Fonts standards, and saves results to the [checks](checks) subfolder.
This process must be run multiple times, tweaking source files and rebuilding output fonts to solve issues flagged by FontBakery.

25
googlefonts-qa/build.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
source venv/bin/activate
# variable font
fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf
# static TTFs
fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf
# ============================================================================
# Autohinting ================================================================
statics=$(ls distr/ttf/*.ttf)
for file in $statics; do
echo "fix DSIG in " ${file}
gftools fix-dsig --autofix ${file}
echo "TTFautohint " ${file}
# autohint with detailed info
hintedFile=${file/".ttf"/"-hinted.ttf"}
ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn
cp ${hintedFile} ${file}
rm -rf ${hintedFile}
done

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
<p>Programmers use a lot of symbols, often encoded with several characters. For the human brain, sequences like
<code>-&gt;</code>, <code>&lt;=</code> or <code>:=</code> are single logical tokens, even if they take two or three
characters on the screen. Your eye spends a non-zero amount of energy to scan, parse and join multiple characters
into a single logical one. Ideally, all programming languages should be designed with full-fledged Unicode symbols
for operators, but thats not the case yet.
</p>
<p>
Fira Code is an extension of the Fira Mono font containing a set of ligatures for common programming multi-character
combinations. This is just a font rendering feature: underlying code remains ASCII-compatible. This helps to read
and understand code faster. For some frequent sequences like <code>..</code> or <code>//</code>, ligatures allow us
to correct spacing.
</p>

99
googlefonts-qa/move-check.sh Executable file
View File

@ -0,0 +1,99 @@
#!/bin/bash
# This script copies the latest builds to the google fonts dir in order to run QA checks and prep for a PR
#
# USAGE:
# Install requirements with `pip install -U -r googlefonts-qa/requirements.txt`
#
# call this script from the root of your fira code repo, with the absolute path your your local google/fonts repo
# `move-check <your_username>/<path>/fonts`
set -ex
source venv/bin/activate
gFontsDir=$1
if [[ -z "$gFontsDir" || $gFontsDir = "--help" ]] ; then
echo 'Add absolute path to your Google Fonts Git directory, like:'
echo 'move-check /Users/username/type-repos/google-font-repos/fonts'
exit 2
fi
firaCodeDir=$(pwd)
firaCodeQADir=$firaCodeDir/googlefonts-qa
firaCodeVF=$firaCodeDir/distr/variable_ttf/FiraCode-VF.ttf
# -------------------------------------------------------------------
# fix variable font metadata as needed ------------------------------
# TODO: Add gftools scripts as needed
# TODO: test VFs with TTFautohint-VF vs no hinting
gftools fix-nonhinting $firaCodeVF $firaCodeVF
# TODO: decide if `--autofix` is really the best option, or if we should assert more control
gftools fix-gasp --autofix $firaCodeVF
gftools fix-dsig --autofix $firaCodeVF
# fix variable font metadata
gftools fix-vf-meta $firaCodeVF
# cleanup
tempFiles=$(ls distr/variable_ttf/*.fix && ls distr/variable_ttf/*-gasp*)
for temp in $tempFiles
do
rm -rf $temp
done
# -------------------------------------------------------------------
# navigate to google/fonts repo, then fira code branch --------------
cd $gFontsDir
git checkout master
git checkout -B firacode
# -------------------------------------------------------------------
# move fonts --------------------------------------------------------
mkdir -p ofl/firacode
cp $firaCodeVF ofl/firacode/FiraCode-Light.ttf
mkdir -p ofl/firacode/static
statics=$(ls $firaCodeDir/distr/ttf/*.ttf)
for ttf in $statics
do
cp $ttf ofl/firacode/static/$(basename $ttf)
done
# -------------------------------------------------------------------
# make or move basic metadata ---------------------------------------
gftools add-font ofl/firacode
cp $firaCodeDir/LICENSE ofl/firacode/OFL.txt
cp $firaCodeQADir/gfonts-description.html ofl/firacode/DESCRIPTION.en_us.html
# -------------------------------------------------------------------
# run checks, saving to firacode/googlefonts-qa/checks ------------
set +e # otherwise, the script stops after the first fontbakery check output
mkdir -p $firaCodeQADir/checks/static
cd ofl/firacode
# ttfs=$(ls -R */*.ttf && ls *.ttf) # use this to statics and VFs
ttfs=$(ls *.ttf) # use this to check only the VFs
# ttfs=$(ls -R */*.ttf ) # use this to check only statics
for ttf in $ttfs
do
fontbakery check-googlefonts $ttf --ghmarkdown $firaCodeQADir/checks/${ttf/".ttf"/".checks.md"}
done

View File

@ -0,0 +1,64 @@
# QA Notes checking & polishing Fira Code for Google Fonts
- [ ] autohint static TTFs
## Checks to resolve
----------------------------
<details>
<summary>🔥 <b>FAIL:</b> Variable font weight coordinates must be multiples of 100.</summary>
* [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.
</details>
- (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
----------------------------
<details>
<summary>🔥 <b>FAIL:</b> Checking OS/2 usWinAscent & usWinDescent.</summary>
* [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]
</details>
- [ ] run script to correct vertical metrics, recheck
----------------------------
<details>
<summary>🔥 <b>FAIL:</b> Are there non-ASCII characters in ASCII-only NAME table entries?</summary>
* [com.google.fonts/check/name/ascii_only_entries](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/name/ascii_only_entries)
* 🔥 **FAIL** There are 1 strings containing non-ASCII characters in the ASCII-only NAME table entries.
* **INFO** Bad string at [nameID 0, 'utf_16_be']: 'b'Copyright &#169; 2015 by Nikita Prokopov''
</details>
- [ ] remove © symbol
======================================================================================
## Edits and corrected FontBakery checks
<details>
<summary><b>WARN:</b> Stricter unitsPerEm criteria for Google Fonts. </summary>
* [com.google.fonts/check/unitsperem_strict](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/unitsperem_strict)
* ⚠ **WARN** Even though unitsPerEm (1000) in this font is reasonable. It is strongly advised to consider changing it to 2000, since it will likely improve the quality of Variable Fonts by avoiding excessive rounding of coordinates on interpolations.
</details>
- [x] scale UPM to 2000
----------------------------

View File

@ -0,0 +1,6 @@
# first: make & activate virtual environment, `venv`
# virtualenv -p python3 venv
fontbakery
git+https://github.com/googlefonts/gftools.git
fontmake