Skip to content

Commit 0aae3a7

Browse files
committed
Add GitHub Actions workflow to build Unifont BMP TTF
The Unifont project has decided to stop distributing precompiled TrueType fonts for the Unicode Basic Multilingual Plane (BMP) starting with version 15.1.01. The recommended migration path is to use OpenType fonts instead, but modifying software to accommodate this new format can be costly. So if we want to continue using TTF fonts for the foreseeable future, we need to build them ourselves from source, following the official instructions. To make this process easy, reproducible, and convenient, this PR introduces a GitHub Actions workflow that can be manually triggered for this effect, requesting the Unifont version to be built. When the workflow completes, an artifact containing the built TTF file is uploaded. The described workflow automatically verifies that the GPG signature of the Unifont source tarball checks up with the contents of `unifoundry-keys.gpg`, which can be downloaded from https://unifoundry.com/1A09227B1F435A33_public.asc, according to the official signature verification instructions.
1 parent c7dc9d0 commit 0aae3a7

File tree

2 files changed

+1928
-0
lines changed

2 files changed

+1928
-0
lines changed

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Unifont
2+
3+
permissions:
4+
# Required for uploading artifacts
5+
actions: write
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
unifont_version:
11+
description: 'The Unifont version to build (example: 15.1.01)'
12+
required: true
13+
type: string
14+
15+
jobs:
16+
build:
17+
name: Unifont BMP TTF
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
21+
steps:
22+
- name: Checkout source
23+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
24+
25+
- name: Install required dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -yq --no-install-recommends fontforge
29+
30+
- name: Download and verify Unifont v${{ inputs.unifont_version }}
31+
run: |
32+
readonly BASE_URL='https://unifoundry.com/pub/unifont/unifont-${{ inputs.unifont_version }}'
33+
readonly SOURCE_TARBALL_NAME='unifont-${{ inputs.unifont_version }}.tar.gz'
34+
35+
echo "> Fetching Unifont source tarball and its signature..."
36+
curl -o unifont.tar.gz "$BASE_URL/$SOURCE_TARBALL_NAME"
37+
curl -o unifont.tar.gz.sig "$BASE_URL/$SOURCE_TARBALL_NAME.sig"
38+
39+
# Verify according to the instructions at https://unifoundry.com/verify/index.html
40+
# with a known-good keyring at this repository
41+
echo "> Asserting Unifont source tarball provenance..."
42+
echo "Creating root of trust key"
43+
gpg --batch --quick-generate-key --passphrase '' '41898282+github-actions[bot]@users.noreply.github.com'
44+
echo "> Importing expected Unifoundry signing keys from unifoundry-keys.gpg"
45+
gpg --batch --import unifoundry-keys.gpg
46+
echo "> Extending trust to Unifoundry signing keys by signing with root of trust key"
47+
gpg --list-keys --with-colons | awk -F: '/^fpr:/ { print $10 }' | while read -r key_fingerprint; do
48+
gpg --batch --expert --quick-lsign "$key_fingerprint" || true
49+
done
50+
echo "> Verifying Unifont source tarball signature"
51+
gpg --batch --verify unifont.tar.gz.sig unifont.tar.gz
52+
53+
- name: Extract and build Unifont BMP TTF
54+
run: |
55+
tar -xf unifont.tar.gz
56+
mv 'unifont-${{ inputs.unifont_version }}' unifont
57+
make -C unifont/font truetype
58+
59+
- name: Upload generated Unifont BMP TTF as artifact
60+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
61+
with:
62+
name: Unifont BMP TTF
63+
path: unifont/font/compiled/unifont-${{ inputs.unifont_version }}.ttf

0 commit comments

Comments
 (0)