Skip to content

Commit 614e144

Browse files
committed
Add patch-hack.sh script
1 parent cc8d85a commit 614e144

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

patch-hack.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# 1. Set the path to the downloaded Hack repo here first
4+
HACK_PATH=""
5+
6+
# 2. List your alternate glyphs here
7+
declare -a alternates=(
8+
"u00EC-slab"
9+
"u00ED-slab"
10+
"u00EF-slab"
11+
"u012B-slab"
12+
"u012D-slab"
13+
"u012F-slab"
14+
"u0030-diamond"
15+
"u0069-slab"
16+
"u0129-slab"
17+
"u0131-slab"
18+
"u0456-slab"
19+
"u0457-slab"
20+
)
21+
22+
# 3. Run this script and enjoy!
23+
24+
# ------------------------------------------------------------------------------------------------ #
25+
26+
if [ -z $HACK_PATH ]; then
27+
echo "❌ Set the HACK_PATH variable in this script to your downloaded Hack repo root."
28+
exit 1
29+
fi
30+
31+
declare -a styles=("Regular" "Bold" "Italic" "BoldItalic")
32+
33+
for alternate in "${alternates[@]}"
34+
do
35+
for style in "${styles[@]}"
36+
do
37+
stylePath="${HACK_PATH}/source/Hack-${style}.ufo/glyphs"
38+
lowercaseStyle=`echo "$style" | tr '[:upper:]' '[:lower:]'`
39+
alternatePath="./glyphs/${alternate}/${lowercaseStyle}/*.glif"
40+
41+
cp $alternatePath $stylePath
42+
if [ $? -ne 0 ]; then
43+
echo "❌ Aborting patching of Hack, check errors above."
44+
exit 1
45+
fi
46+
done
47+
48+
echo "✅ Patched $alternate"
49+
done
50+
51+
echo
52+
echo "All done! Now go to the Hack repo and build the font files."

0 commit comments

Comments
 (0)