Submodule hustle.
27
init/FiraCode/googlefonts-qa/METADATA.pb
Normal 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 2012-2015 The Fira Code Project Authors (https://github.com/tonsky/FiraCode)"
|
||||
}
|
||||
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
|
||||
}
|
73
init/FiraCode/googlefonts-qa/README.md
Normal file
@ -0,0 +1,73 @@
|
||||
# Onboarding to Google Fonts
|
||||
|
||||
This directory is made to run a Google Fonts onboarding process for Fira Code.
|
||||
|
||||
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.
|
||||
|
||||
## USAGE
|
||||
|
||||
### First, setup prerequisites
|
||||
|
||||
If you haven't already done so, open a terminal, clone this repo, and move to the `qa` branch:
|
||||
|
||||
```
|
||||
git clone git@github.com:thundernixon/firacode.git
|
||||
cd firacode
|
||||
git checkout qa
|
||||
```
|
||||
|
||||
FontBakery checks are made to be run on fonts within the folder structure of the [google/fonts repo](https://github.com/google/fonts). Therefore, you must have a local copy of this repo on your computer to run this QA procedure. If you don't yet have a local google/fonts repo, open a new terminal session, navigate to a parent folder for this (e.g. `cd ~/yourusername/type_repos`, but use whatever location makes sense), and clone the repo:
|
||||
|
||||
```
|
||||
git clone git@github.com:google/fonts.git
|
||||
```
|
||||
|
||||
### Second, set up your testing environment
|
||||
|
||||
Create a Python 3 virtual environment:
|
||||
|
||||
```
|
||||
virtualenv -p python3 build/venv
|
||||
```
|
||||
|
||||
Then, activate the new virtual environment:
|
||||
|
||||
```
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
Now, install the QA dependencies:
|
||||
|
||||
```
|
||||
pip install -U -r googlefonts-qa/scripts/requirements.txt
|
||||
```
|
||||
|
||||
Give the build and move-check scripts permission to run:
|
||||
|
||||
```
|
||||
chmod +x googlefonts-qa/scripts/build.sh
|
||||
chmod +x googlefonts-qa/scripts/move-check.sh
|
||||
```
|
||||
|
||||
### Third, use scripts to build fonts, then move and check
|
||||
|
||||
With your terminal at the top level of your Fira Code directory, build fresh copies of the relevant fonts by running:
|
||||
|
||||
```
|
||||
googlefonts-qa/scripts/build.sh
|
||||
```
|
||||
|
||||
When that completes, run the move-check script (using the path to your local `google/fonts` repo as an argument):
|
||||
|
||||
```
|
||||
move-check <absolute_path_to_parent_dir>/fonts
|
||||
```
|
||||
|
||||
If all goes well, you will have created a local `firacode` branch in your google fonts directory, moved the fresh fonts there, and run QA checks which will create new markdown documents at `googlefonts-qa/scripts/checks`. If following this guide doesn't work, please file an issue at `thundernixon/firacode`.
|
1120
init/FiraCode/googlefonts-qa/checks/FiraCode-Light.checks.md
Normal file
1159
init/FiraCode/googlefonts-qa/checks/static/FiraCode-Bold.checks.md
Normal file
1159
init/FiraCode/googlefonts-qa/checks/static/FiraCode-Light.checks.md
Normal file
1160
init/FiraCode/googlefonts-qa/checks/static/FiraCode-Medium.checks.md
Normal file
1155
init/FiraCode/googlefonts-qa/checks/static/FiraCode-Retina.checks.md
Normal file
12
init/FiraCode/googlefonts-qa/gfonts-description.html
Normal file
@ -0,0 +1,12 @@
|
||||
<p>Programmers use a lot of symbols, often encoded with several characters. For the human brain, sequences like
|
||||
<code>-></code>, <code><=</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 that’s 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>
|
149
init/FiraCode/googlefonts-qa/notes/QA-notes.md
Normal file
@ -0,0 +1,149 @@
|
||||
# QA Notes – checking & polishing Fira Code for Google Fonts
|
||||
|
||||
- [x] autohint static TTFs
|
||||
- [ ] check extrapolated outlines for issues
|
||||
|
||||
## Checks to resolve
|
||||
|
||||
|
||||
|
||||
======================================================================================
|
||||
|
||||
## Waiting on others
|
||||
|
||||
<details>
|
||||
<summary>🔥 <b>FAIL:</b> Copyright notices match canonical pattern in fonts</summary>
|
||||
|
||||
* [com.google.fonts/check/font_copyright](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/font_copyright)
|
||||
* 🔥 **FAIL** Name Table entry: Copyright notices should match a pattern similar to: 'Copyright 2017 The Familyname Project Authors (git url)'
|
||||
But instead we have got: 'Copyright 2012-2015 The Mozilla Foundation, Telefonica S.A., and Nikita Prokopov (https://github.com/tonsky/FiraCode)'
|
||||
|
||||
</details>
|
||||
|
||||
- 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)
|
||||
- [x] confirm that current approach is fine (https://github.com/google/fonts/issues/1460#issuecomment-476713822) (seems okay, based on Hangouts discussion)
|
||||
|
||||
----------------------------
|
||||
|
||||
<details>
|
||||
<summary><b>[119] FiraCode-Light.ttf</b></summary>
|
||||
<details>
|
||||
<summary>🔥 <b>FAIL:</b> Checking file is named canonically.</summary>
|
||||
|
||||
* [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
|
||||
|
||||
</details>
|
||||
|
||||
- [x] ask if/when this is changing (via hangouts) – Marc: "We’ll batch the vfs once they’ve implemented it"
|
||||
|
||||
----------------------------
|
||||
|
||||
======================================================================================
|
||||
|
||||
## 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
|
||||
|
||||
----------------------------
|
||||
|
||||
<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 © 2015 by Nikita Prokopov''
|
||||
|
||||
</details>
|
||||
|
||||
- [x] remove © symbol
|
||||
|
||||
----------------------------
|
||||
|
||||
<details>
|
||||
<summary><b>[31] Family checks</b></summary>
|
||||
<details>
|
||||
<summary>🔥 <b>FAIL:</b> METADATA.pb: According Google Fonts standards, families should have a Regular style.</summary>
|
||||
|
||||
* [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.
|
||||
|
||||
</details>
|
||||
|
||||
- [x] this issue is already filed with fontbakery (https://github.com/googlefonts/fontbakery/issues/2378)
|
||||
|
||||
----------------------------
|
||||
|
||||
<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>
|
||||
|
||||
- [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)
|
||||
|
||||
|
||||
----------------------------
|
||||
|
||||
<details>
|
||||
<summary>🔥 <b>FAIL:</b> Glyph names are all valid?</summary>
|
||||
|
||||
* [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.
|
||||
|
||||
</details>
|
||||
|
||||
- [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
|
||||
|
||||
----------------------------
|
||||
|
||||
<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
|
||||
- [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.
|
||||
|
||||
----------------------------
|
||||
|
||||
<details>
|
||||
<summary>🔥 <b>FAIL:</b> Checking OS/2 usWeightClass.</summary>
|
||||
|
||||
* [com.google.fonts/check/usweightclass](https://github.com/googlefonts/fontbakery/search?q=com.google.fonts/check/usweightclass)
|
||||
* 🔥 **FAIL** OS/2 usWeightClass expected value for 'Light' is 300 but this font has 400.
|
||||
|
||||
</details>
|
||||
|
||||
- [ ] explore to find why this would be happening ...
|
||||
- Encode Sans gets an OS/2 usWeightClass of `100`, matching its default instance.
|
||||
|
||||
**Solution**
|
||||
- Custom Parameters of `Axis Location` needed to be set in source masters (https://github.com/googlei18n/fontmake/issues/540)
|
||||
|
||||
----------------------------
|
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 17 KiB |
245
init/FiraCode/googlefonts-qa/notes/outline-checks.md
Normal file
@ -0,0 +1,245 @@
|
||||
# Checking outlines after extrapolation
|
||||
|
||||
It was necessary to extrapolate a `Light` master to allow Fira Code to build via FontMake. As a result, some outline errors may have made their way into the glyphs in this new Master, because extrapolation is a useful but imperfect tool.
|
||||
|
||||
For the most part, I will abstain from fixing every little outline issue, because by and large, things here are well-drawn, and haven't been extrapolated in too extreme a manner.
|
||||
|
||||
## General Process
|
||||
|
||||
I will use the Glyphs App extension Red Arrows to find potential problems, then check them over and fix what seems to be clearly wrong.
|
||||
|
||||
If it is not super obvious how to fix a potential issue, I will generally:
|
||||
- Check what the Bold master does
|
||||
- Check what Fira Mono (the ancestor of Fira Code) does in its Regular master
|
||||
- Copy the existing layer to the background, and make that copied layer visible to provide a basic guide for my changes. For example:
|
||||
|
||||

|
||||
|
||||
I am not trying to change the design, but rather, to fix unintended vector issues that make the design less useful.
|
||||
|
||||
### /U-cy
|
||||
|
||||
The main stem of this glyph has a "kink" that seems unintentional.
|
||||
|
||||

|
||||
|
||||
|
||||
### Zhedescender-cy
|
||||
|
||||
This has a component that isn't needed, and this juts out in the Bold master, causing an outline blip.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
If we look at Fira Sans, it's clear what this shape is supposed to do:
|
||||
|
||||

|
||||
|
||||
The component was transformed to (10%, 10%) – way too small. I've adjust that to (85%, 100%) in the Bold and (100%,100%) in the light. Now it's like this:
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Kastroke-cy
|
||||
|
||||
This crossbar is overly-thick, compared to others – I'll thin it out a bit:
|
||||
|
||||

|
||||
|
||||
|
||||
## Kahook-cy
|
||||
|
||||
Before:
|
||||
|
||||

|
||||
|
||||
Now:
|
||||
|
||||

|
||||
|
||||
|
||||
## Lha-cy
|
||||
|
||||
Mismatch in upper-left:
|
||||

|
||||
|
||||
I removed the overlap in that stroke:
|
||||
|
||||

|
||||
|
||||
## be-cy
|
||||
|
||||
The ascender has an issue:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## ve-cy
|
||||
|
||||
Inflected curve:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## ze-cy
|
||||
|
||||
(Almost certainly) unintended curve upwards:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## ii-cy
|
||||
|
||||
Unintended upwards-handles.
|
||||
|
||||

|
||||
|
||||
The bold looks better:
|
||||
|
||||

|
||||
|
||||
So:
|
||||
|
||||

|
||||
|
||||
### komije-cy
|
||||
|
||||
Ouch:
|
||||
|
||||

|
||||
|
||||
Better:
|
||||
|
||||

|
||||
|
||||
|
||||
### Chi
|
||||
|
||||
These feet aren't suppose to be angled so sharply:
|
||||

|
||||
|
||||
In Fira Mono, you can see that the angle simply becomes less steep:
|
||||
|
||||

|
||||
|
||||
|
||||
So:
|
||||
|
||||

|
||||
|
||||
### kaiSymbol
|
||||
|
||||
Not-quite-vertical strokes:
|
||||
|
||||

|
||||
|
||||
Straightened in Bold & Reg:
|
||||
|
||||

|
||||
|
||||
### betaSymbol
|
||||
|
||||
These lines are't supposed to intersect:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### Nine
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
(similar problem in /nine.tosf)
|
||||
|
||||
|
||||
### asciitilde_greater.liga
|
||||
|
||||
Broken connection on right side:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### asciitilde_asciitilde_greater.liga
|
||||
|
||||
Broken connection on right side:
|
||||
|
||||

|
||||
|
||||
I've just scooted the curvy thing towards the arrow by a bit.
|
||||
|
||||

|
||||
|
||||
### uniE0A0
|
||||
|
||||
Broken connection:
|
||||
|
||||

|
||||
|
||||
Fixed:
|
||||
|
||||

|
||||
|
||||
### r.001
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### ae
|
||||
|
||||
This curve isn't quite continuous:
|
||||
|
||||

|
||||
|
||||
I've made it a little more graceful:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### "Incorrect smooth connections" in several glyphs:
|
||||
|
||||
Like these slight kinks:
|
||||
|
||||

|
||||
|
||||
Should be this:
|
||||
|
||||

|
||||
|
||||
============================================================
|
||||
|
||||
## (Small) issues I'm leaving
|
||||
|
||||
Often, crossbars have unnecessary points. These aren't really needed for the shapes and add a very small amount of data, but they're harmless, so I won't remove them right now.
|
||||
|
||||

|
||||
|
||||
|
||||
---
|
||||
|
||||
There are many instances of overlapping shapes that, while technically fine, might not render absolutely perfectly. I'll leave these, however, as they will probably bother no one.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Small inflections, or semi-vertical handles that clearly should be that way:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Some curvy shapes have slight issues around smooth connections. I'm looking at intermediate weights to make sure there aren't huge kinks (which is a concern in angled curve points), but otherwise mostly leaving these.
|
||||
|
||||

|
1
init/FiraCode/googlefonts-qa/scripts/build.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../../script/build
|
0
init/FiraCode/googlefonts-qa/scripts/get-version.py
Normal file
90
init/FiraCode/googlefonts-qa/scripts/move-check.sh
Executable file
@ -0,0 +1,90 @@
|
||||
#!/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 'googlefonts-qa/scripts/move-check.sh /Users/your-username/type-repos/google-font-repos/fonts'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
firaCodeDir=$(pwd)
|
||||
|
||||
firaCodeQADir=$firaCodeDir/googlefonts-qa
|
||||
|
||||
firaCodeVF=$firaCodeDir/distr/variable_ttf/FiraCode-VF.ttf
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# get latest version ------------------------------------------------
|
||||
|
||||
ttx -t head $firaCodeVF
|
||||
fontVersion=v$(xml sel -t --match "//*/fontRevision" -v "@value" ${firaCodeVF/".ttf"/".ttx"})
|
||||
rm ${firaCodeVF/".ttf"/".ttx"}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# navigate to google/fonts repo, then fira code branch --------------
|
||||
|
||||
cd $gFontsDir
|
||||
git checkout master
|
||||
git pull upstream master
|
||||
git reset --hard
|
||||
git checkout -B firacode
|
||||
git clean -f -d
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# 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 ---------------------------------------
|
||||
|
||||
cp $firaCodeDir/googlefonts-qa/METADATA.pb ofl/firacode/METADATA.pb
|
||||
|
||||
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
|
||||
echo $ttf
|
||||
fontbakery check-googlefonts $ttf --ghmarkdown $firaCodeQADir/checks/${ttf/".ttf"/".checks.md"}
|
||||
done
|
||||
|
||||
git add .
|
||||
git commit -m "fira code: $fontVersion added."
|
||||
|
||||
git push --force upstream firacode
|
6
init/FiraCode/googlefonts-qa/scripts/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
# first: make & activate virtual environment, `venv`
|
||||
# virtualenv -p python3 venv
|
||||
|
||||
fontbakery
|
||||
git+https://github.com/googlefonts/gftools.git
|
||||
fontmake
|
113
init/FiraCode/googlefonts-qa/scripts/set-vertical-metrics.py
Normal file
@ -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
|
||||
|