forked from LAK132/MegaWAT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefonts.sh
executable file
·48 lines (39 loc) · 1.33 KB
/
makefonts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/csh
set ttftof65=c65gs-font-rasteriser/ttftof65
# Normal fonts
foreach size (8 14 22 30)
foreach font (`echo assets/*.ttf assets/*.otf`)
set fontname=`echo $font | cut -f1 -d.`
echo ${ttftof65} -T ${font} -A -P ${size} -o ${fontname}-${size}.f65
${ttftof65} -T ${font} -A -P ${size} -o ${fontname}-${size}.f65
end
end
#bigger capitals only typeface for headings
set size=54
foreach font (`echo assets/*.ttf assets/*.otf`)
set fontname=`echo $font | cut -f1 -d.`
echo ${ttftof65} -T ${font} -8 "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\!.,?" -P ${size} -o ${fontname}-${size}.f65
${ttftof65} -T ${font} -A -P ${size} -o ${fontname}-${size}.f65
end
# Now make a pack of them that fits in 128KB
set fontlist=( \
assets/UbuntuMono-R-14.f65 \
assets/caladea-regular-14.f65 \
assets/Entypo-22.f65 \
assets/caladea-regular-22.f65 \
assets/caladea-regular-30.f65 \
)
set size=`ls -l $fontlist | cut -f5 -d" " | awk '{ n+=$1; } END { print n; }'`
echo "This will take $size bytes"
if ( $size > 131071 ) then
/bin/sh -c 'echo "ERROR: Fonts must be <128KB in total" 1>&2'
exit 1
endif
rm $1
foreach typeface ( $fontlist )
ls -l $typeface
dd if=${typeface} bs=1 skip=2 of=$1 conv=notrunc oflag=append
end
# Put end marker (empty 256 byte block) on
dd if=/dev/zero bs=256 count=1 of=fontpack.bin conv=notrunc oflag=append
ls -l $1