-
Notifications
You must be signed in to change notification settings - Fork 7
/
learning
executable file
·43 lines (34 loc) · 1.3 KB
/
learning
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
#!/bin/bash
if (( $# < 3 )) || [[ ! -x $1 || ! -x $2 || ! -x $3 ]]; then
echo $0 write_glyphs_bin normalize_glyphs_bin write_datas_bin >&2
exit 1
fi
dir_launch="$(pwd)"
write_glyphs="$(readlink -f "$1")"
base="$(readlink -f "$(dirname $0)")"
learning() {
cd "$base"/resources/fonts/"$1"/generated
for d in * ; do
for f in "$d"/*.pnm ; do
"$write_glyphs" -l 100 "$f" ../letters "$d" || return $?
done
done
cd ../mano
for d in * ; do
for f in "$d/"*.pbm ; do
"$write_glyphs" -l 100 "$f" "${f:0:-3}txt" "$d" || return $?
done
done
cd "$dir_launch"
}
glyphs="$base"/resources/glyphs
datas="$base"/resources/datas
learning latin "$1" > "$glyphs"/glyphs-latin.txt &&
learning cyrillic "$1" > "$glyphs"/glyphs-cyrillic.txt &&
"$2" "$glyphs"/glyphs-latin.txt > "$glyphs"/normalized-glyphs-latin.txt &&
"$2" "$glyphs"/glyphs-cyrillic.txt > "$glyphs"/normalized-glyphs-cyrillic.txt &&
"$2" "$glyphs"/glyphs-latin.txt "$glyphs"/glyphs-cyrillic.txt > "$glyphs"/normalized-glyphs-latin-cyrillic.txt &&
"$3" "$glyphs"/normalized-glyphs-latin.txt > "$datas"/latin.txt &&
"$3" "$glyphs"/normalized-glyphs-cyrillic.txt > "$datas"/cyrillic.txt &&
"$3" "$glyphs"/normalized-glyphs-latin-cyrillic.txt > "$datas"/latin-cyrillic.txt &&
rm -- "$glyphs"/glyphs-latin.txt "$glyphs"/glyphs-cyrillic.txt