Skip to content

Commit 70f15d8

Browse files
authored
公开构建NotoSansPro工作流
1 parent 5288c26 commit 70f15d8

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build NotoSansPro Font
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Download Fonts From URLs
14+
run: |
15+
set -e
16+
mkdir -p tools/fontslist build
17+
count=0
18+
while read -r path; do
19+
[[ "$path" =~ ^\s*(#|$) ]] && continue
20+
if [[ "$path" =~ :// ]]; then
21+
url="$path"
22+
else
23+
url="https://${path#//}"
24+
fi
25+
file="${url##*/}"
26+
echo "Downloading $url"
27+
wget --timeout=30 --tries=3 -O "tools/fontslist/$file" "$url"
28+
count=$((count+1))
29+
done < tools/fontslist/urls.txt
30+
echo "Download complete: $count font files"
31+
32+
- name: Build and Merge All Fonts
33+
run: |
34+
set -euo pipefail
35+
36+
chmod +x tools/{otfccdump,merge-otd,otfccbuild}
37+
workdir=$(mktemp -d)
38+
trap 'rm -rf "$workdir"' EXIT
39+
40+
echo "Converting fonts to .otd..."
41+
for font in tools/fontslist/*.{ttf,otf}; do
42+
[[ -e "$font" ]] || continue
43+
base=$(basename "$font" | sed 's/\.\(ttf\|otf\)$//')
44+
out="$workdir/${base}.otd"
45+
echo " ➡️ $font → $out"
46+
if ! ./tools/otfccdump --ignore-hints "$font" -o "$out"; then
47+
echo "⚠️ Warning: failed to process $font, skipping." >&2
48+
continue
49+
fi
50+
done
51+
52+
echo "Collecting .otd files and sorting by size..."
53+
mapfile -t otd_files < <(ls -1S "$workdir"/*.otd)
54+
if [[ ${#otd_files[@]} -eq 0 ]]; then
55+
echo "❌ No .otd files found, exiting."
56+
exit 1
57+
fi
58+
echo "Merging .otd files into notosanspro.otd..."
59+
./tools/merge-otd -o notosanspro.otd -n "Noto Sans Pro;400;5;Normal" "${otd_files[@]}"
60+
echo "Building final OpenType font NotoSansPro.otf..."
61+
./tools/otfccbuild notosanspro.otd -O1 -o build/NotoSansPro.otf
62+
cp notosanspro.otd build/
63+
cp -r tools/fontslist build/
64+
65+
echo "✅ Build complete: build/NotoSansPro.otf, build/notosanspro.otd"
66+
67+
- name: Upload Artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: NotoSansPro-Build-OUTPUT
71+
path: build

0 commit comments

Comments
 (0)