forked from mintty/mintty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkwide
executable file
·49 lines (40 loc) · 1.22 KB
/
mkwide
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
#! /bin/sh
# generate list of wide characters, with convex closure
skipcheck=false
if $skipcheck || make Blocks.txt >&2
then true
else echo Could not acquire Unicode data file Blocks.txt >&2
exit 1
fi
if $skipcheck || make EastAsianWidth.txt >&2
then true
else echo Could not acquire Unicode data file EastAsianWidth.txt >&2
exit 1
fi
if $skipcheck || make UnicodeData.txt >&2
then true
else echo Could not acquire Unicode data file UnicodeData.txt >&2
exit 1
fi
sed -e "s,^\([^;]*\);[NAH],\1," -e t -e d EastAsianWidth.txt > wide.na
sed -e "s,^\([^;]*\);[WF],\1," -e t -e d EastAsianWidth.txt > wide.fw
nrfw=`uniset +wide.fw nr | sed -e 's,.*:,,'`
echo FW $nrfw
nrna=`uniset +wide.na nr | sed -e 's,.*:,,'`
echo NAH $nrna
extrablocks="2E80-303E"
# check all blocks
includes () {
nr=`uniset +wide.$2 -$1 nr | sed -e 's,.*:,,'`
test $nr != $3
}
echo "adding compact closure of wide ranges, this may take ~10min"
for b in $extrablocks `sed -e 's,^\([0-9A-F]*\)\.\.\([0-9A-F]*\).*,\1-\2,' -e t -e d Blocks.txt`
do range=$b
echo checking $range $* >&2
if includes $range fw $nrfw && ! includes $range na $nrna
then echo $range
fi
done > wide.blocks
uniset `sed -e 's,^,+,' wide.blocks` +wide.fw c > wide.t
rm -f wide.na wide.fw wide.blocks