-
Notifications
You must be signed in to change notification settings - Fork 6
/
apple.sh
executable file
·78 lines (66 loc) · 2.35 KB
/
apple.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -e
NAME=apple
MOD=$1
IOS_FONT_NAME=AppleColorEmoji_iOS
[[ $MOD = 'LQ' || $MOD = 'HD-flip' ]] && ASSETS=$NAME/$MOD || ASSETS=$NAME/Default
COLORS=
[[ $MOD = 'HD' || $MOD = 'HD-flip' ]] && HD=true || HD=false
echo "Copying PNGs..."
mkdir -p $ASSETS
rm -rf $ASSETS/160 $ASSETS/96 $ASSETS/64 $ASSETS/52 $ASSETS/48 $ASSETS/40 $ASSETS/32 $ASSETS/26 $ASSETS/20
cp -r $NAME/images/* $ASSETS
if [[ $MOD == 'LQ' ]]
then
COLORS=8
echo "Applying mod: LQ..."
mogrify +dither -posterize 8 -normalize $ASSETS/96/*.png
mogrify +dither -posterize 8 -normalize $ASSETS/64/*.png
mogrify +dither -posterize 8 -normalize $ASSETS/40/*.png
elif [[ $MOD == 'HD-flip' ]]
then
echo "Applying mod: HD-flip..."
mogrify -flop $ASSETS/160/*.png
mogrify -flop $ASSETS/96/*.png
mogrify -flop $ASSETS/64/*.png
mogrify -flop $ASSETS/40/*.png
fi
echo "Optimizing PNGs..."
[[ $HD == true ]] && [[ $MOD != 'LQ' ]] && pngquant --skip-if-larger -f --ext .png $ASSETS/160/*.png || true
pngquant --skip-if-larger $COLORS -f --ext .png $ASSETS/96/*.png || true
pngquant --skip-if-larger $COLORS -f --ext .png $ASSETS/64/*.png || true
pngquant --skip-if-larger $COLORS -f --ext .png $ASSETS/40/*.png || true
[[ $HD == true ]] && [[ $MOD != 'LQ' ]] && oxipng -q $ASSETS/160/*.png
oxipng -q $ASSETS/96/*.png
oxipng -q $ASSETS/64/*.png
oxipng -q $ASSETS/40/*.png
if [[ $MOD != '' ]]
then
OUT_FONT_NAME=AppleColorEmoji-$MOD
else
OUT_FONT_NAME=AppleColorEmoji
COMPAT_OUT_FONT_NAME=AppleColorEmoji@2x
fi
python3 $NAME.py $HD common/${IOS_FONT_NAME}_00.ttf apple/${OUT_FONT_NAME}_00.ttf $ASSETS
python3 $NAME.py $HD common/${IOS_FONT_NAME}_01.ttf apple/${OUT_FONT_NAME}_01.ttf $ASSETS
rm -f apple/$OUT_FONT_NAME.ttf
if [[ $COMPAT_OUT_FONT_NAME != '' ]]
then
rm -f apple/$COMPAT_OUT_FONT_NAME.ttf
ln apple/${OUT_FONT_NAME}_00.ttf apple/$COMPAT_OUT_FONT_NAME.ttf
fi
if [[ $MOD == 'HD' ]]
then
rm -f apple/AppleColorEmoji-160px.ttc
ln apple/${OUT_FONT_NAME}.ttc apple/AppleColorEmoji-160px.ttc
fi
otf2otc apple/${OUT_FONT_NAME}_00.ttf apple/${OUT_FONT_NAME}_01.ttf -o apple/$OUT_FONT_NAME.ttc
if [[ $COMPAT_OUT_FONT_NAME != '' ]]
then
rm -f apple/$COMPAT_OUT_FONT_NAME.ttc
ln apple/$OUT_FONT_NAME.ttc apple/$COMPAT_OUT_FONT_NAME.ttc
fi
if [[ $MOD != '' && $MOD != 'HD' ]]
then
rm -f apple/${OUT_FONT_NAME}_00.ttf apple/${OUT_FONT_NAME}_01.ttf
fi