2 #@ make-afmtodit-tables -- script for creating the `unicode_decomposed'
3 #@ and `AGL_to_unicode' tables
5 #@ make-afmtodit-tables \
6 #@ UnicodeData.txt version-string glyphlist.txt > afmtodit.in
8 #@ `UnicodeData.txt' is the central database file from the Unicode standard.
9 #@ Unfortunately, it doesn't contain a version number which must be thus
10 #@ provided manually as an additional parameter.
11 #@ `glyphlist.txt' holds the Adobe Glyph List (AGL).
12 #@ This program needs a C preprocessor.
13 #@ TODO remove in favour of S-CText
15 # Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
18 # Free Software Foundation, Inc.
19 # Written by Werner Lemberg <wl@gnu.org>
21 # This is free software; you can redistribute it and/or modify it under
22 # the terms of the GNU General Public License as published by the Free
23 # Software Foundation; either version 2, or (at your option) any later
26 # This is distributed in the hope that it will be useful, but WITHOUT ANY
27 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
28 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 # You should have received a copy of the GNU General Public License along
32 # with groff; see the file COPYING. If not, write to the Free Software
33 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
39 if test $# -ne 3; then
40 echo "Synopsis: $0 UnicodeData.txt <version-string> glyphlist.txt > afmtodit.in"
48 if test ! -f "$1"; then
49 echo "File \`$1' doesn't exist" >&2
52 if test ! -f "$3"; then
53 echo "File \`$3' doesn't exist" >&2
57 # Handle UnicodeData.txt.
59 # Remove ranges and control characters,
60 # then extract the decomposition field,
61 # then remove lines without decomposition,
62 # then remove all compatibility decompositions.
64 |
sed -e '/^[^;]*;</d' \
65 |
sed -e 's/;[^;]*;[^;]*;[^;]*;[^;]*;\([^;]*\);.*$/;\1/' \
66 |
sed -e '/^[^;]*;$/d' \
67 |
sed -e '/^[^;]*;</d' > $
$1
69 # Prepare input for running cpp.
71 |
sed -e 's/^\([^;]*\);/#define \1 /' \
74 |
sed -e 's/^\([^;]*\);.*$/\1 u\1/' >> $
$2
76 # Run C preprocessor to recursively decompose.
79 # Convert it back to original format.
86 -e 's/^\([^ ]*\) /\1;/' > $
$4
90 # This table has been algorithmically derived from the file
91 # UnicodeData.txt, version $version_string, available from unicode.org,
92 # on `date '+%Y-%m-%d'`.
96 echo 'my %unicode_decomposed = ('
99 -e 's/\(.*\);\(.*\)/ "\1", "\2",/'
105 # This table has been algorithmically derived from the file
106 # glyphlist.txt, version 2.0, available from partners.adobe.com,
107 # on `date '+%Y-%m-%d'`.
111 echo 'my %AGL_to_unicode = ('
115 -e '/;\(E\|F[0-8]\)/d' \
116 -e 's/\(.*\);\(.*\)/ "\1", "\2",/'
119 # Remove temporary files.