Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install sys tools/deps
run: |
sudo apt-get update
sudo apt-get install ttfautohint libcairo2-dev python3-cairo-dev pkg-config python3-dev
sudo apt-get install ttfautohint libcairo2-dev python3-cairo-dev pkg-config python3-dev fontforge xmlstarlet
sudo snap install yq
- uses: actions/cache@v4
with:
Expand All @@ -42,10 +42,19 @@ jobs:
# bumpfontversion sources/$src --new-version $TAG_NAME;
# done

# original build process used sfdlib to convert .sfd files to .ufo and then built the .ufo files with gftools/fontmake
- name: Convert .sfd files to .ufo
run: make convert
# run: make convert # convert using sfdlib/sfd2ufo
run: ./scripts/convert.sh
- name: Build font
run: make build

# generate fonts directly with FontForge, which retains hinting information
#- name: Generate fonts with FontForge
# run: make fontforge # I'm not smart enough for makefiles...
# run:
# ./scripts/build.sh

- name: Check with fontbakery
run: make test
continue-on-error: true
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ help:
@echo
@echo " make convert: Converts FontForge .sfd source files to .ufo
@echo " make build: Builds the fonts and places them in the fonts/ directory"
@echo " make fontforge: Generate fonts directly with FontForge (recommended)
@echo " make test: Tests the fonts with fontbakery"
@echo " make proof: Creates HTML proof documents in the proof/ directory"
@echo " make images: Creates PNG specimen images in the documentation/ directory"
Expand Down Expand Up @@ -38,15 +39,15 @@ venv-test/touchfile: requirements-test.txt
. venv-test/bin/activate; pip install -Ur requirements-test.txt
touch venv-test/touchfile

test: venv-test build.stamp
test: venv-test #build.stamp # skip build step
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv-test/bin/activate; mkdir -p out/ out/fontbakery; fontbakery check-googlefonts -l WARN --full-lists --succinct --badges out/badges --html out/fontbakery/fontbakery-report.html --ghmarkdown out/fontbakery/fontbakery-report.md $$TOCHECK || echo '::warning file=sources/config.yaml,title=Fontbakery failures::The fontbakery QA check reported errors in your font. Please check the generated report.'

proof: venv build.stamp
proof: venv #build.stamp # skip build step
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv/bin/activate; mkdir -p out/ out/proof; diffenator2 proof $$TOCHECK -o out/proof

images: venv $(DRAWBOT_OUTPUT)

%.png: %.py build.stamp
%.png: %.py #build.stamp # skip build step
. venv/bin/activate; python3 $< --output $@

clean:
Expand All @@ -58,3 +59,6 @@ update-project-template:

update:
echo 'update' breaks any customization, manually update from google font template

fontforge:
echo I don't understand makefiles... run ./scripts/build.sh instead
13 changes: 13 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"

rm -rf ../fonts
mkdir ../fonts
mkdir ../fonts/ttf
mkdir ../fonts/webfonts
for sfd in ../sources/*.sfd;
do
font=${sfd##*/}
fontforge -c 'open(argv[1]).generate(argv[2])' $sfd ../fonts/ttf/${font%.*}.ttf
fontforge -c 'open(argv[1]).generate(argv[2])' $sfd ../fonts/webfonts/${font%.*}.woff2
done
16 changes: 16 additions & 0 deletions scripts/convert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"

for sfd in ../sources/*.sfd;
do
fontforge -c 'open(argv[1]).generate(argv[2])' $sfd ${sfd%.*}.ufo

# fontforge bug #5450 does not properly export 'use typo metrics' bit
xmlstarlet ed --inplace -s '//plist/dict[last()]' -t elem -n "key" -v "openTypeOS2Selection" -s '//plist/dict[last()]' -t elem -n "array" -s '//plist/dict[last()]/array[last()]' -t elem -n "integer" -v 7 ${sfd%.*}.ufo/fontinfo.plist

# fontforge exports tags that are interpreted weird by fontbakery/Google Fonts. Just delete them
xmlstarlet ed --inplace -d '//plist/dict/key[contains(text(),"styleMapFamilyName")]/following-sibling::string[1]' ${sfd%.*}.ufo/fontinfo.plist
xmlstarlet ed --inplace -d '//plist/dict/key[contains(text(),"styleMapFamilyName")]' ${sfd%.*}.ufo/fontinfo.plist
xmlstarlet ed --inplace -d '//plist/dict/key[contains(text(),"styleMapStyleName")]/following-sibling::string[1]' ${sfd%.*}.ufo/fontinfo.plist
xmlstarlet ed --inplace -d '//plist/dict/key[contains(text(),"styleMapStyleName")]' ${sfd%.*}.ufo/fontinfo.plist
done
Loading