#! /bin/sh
# Copyright(c) 2018 Thomas Wolff <towo@towo.net>

# generate WIDTH-A file, listing Unicode characters with width property
# Ambiguous, from EastAsianWidth.txt

if [ ! -r EastAsianWidth.txt ]
then	ln -s /usr/share/unicode/ucd/EastAsianWidth.txt . || exit 1
fi
if [ ! -r UnicodeData.txt ]
then	ln -s /usr/share/unicode/ucd/UnicodeData.txt . || exit 1
fi
if [ ! -r Blocks.txt ]
then	ln -s /usr/share/unicode/ucd/Blocks.txt . || exit 1
fi

sed -e "s,^\([^;]*\);A,\1," -e t -e d EastAsianWidth.txt > width-a-new
rm -f WIDTH-A
echo "# UAX #11: East Asian Ambiguous" > WIDTH-A
PATH="$PATH:." uniset +width-a-new compact >> WIDTH-A
rm -f width-a-new
