3 # make-afmtodit-tables -- script for creating the 'unicode_decomposed'
4 # and 'AGL_to_unicode' tables
6 # Copyright (C) 2005-2018 Free Software Foundation, Inc.
7 # Written by Werner Lemberg <wl@gnu.org>
9 # This file is part of groff.
11 # groff is free software; you can redistribute it and/or modify it under
12 # the terms of the GNU General Public License as published by the Free
13 # Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 # make-afmtodit-tables \
28 # UnicodeData.txt version-string glyphlist.txt > afmtodit.in
30 # 'UnicodeData.txt' is the central database file from the Unicode standard.
31 # Unfortunately, it doesn't contain a version number which must be thus
32 # provided manually as an additional parameter.
34 # 'glyphlist.txt' holds the Adobe Glyph List (AGL).
36 # This program needs a C preprocessor.
43 if test $# -ne 3; then
44 echo "usage: $0 UnicodeData.txt <version-string> glyphlist.txt > afmtodit.in"
52 if test ! -f "$1"; then
53 echo "File '$1' doesn't exist" >&2
56 if test ! -f "$3"; then
57 echo "File '$3' doesn't exist" >&2
61 # Handle UnicodeData.txt.
63 # Remove ranges and control characters,
64 # then extract the decomposition field,
65 # then remove lines without decomposition,
66 # then remove all compatibility decompositions.
68 | sed -e '/^[^;]*;</d' \
69 | sed -e 's/;[^;]*;[^;]*;[^;]*;[^;]*;\([^;]*\);.*$/;\1/' \
70 | sed -e '/^[^;]*;$/d' \
71 | sed -e '/^[^;]*;</d' > $$1
73 # Prepare input for running cpp.
75 | sed -e 's/^\([^;]*\);/#define \1 /' \
78 | sed -e 's/^\([^;]*\);.*$/\1 u\1/' >> $$2
80 # Run C preprocessor to recursively decompose.
83 # Convert it back to original format.
90 -e 's/^\([^ ]*\) /\1;/' > $$4
94 # This table has been algorithmically derived from the file
95 # UnicodeData.txt, version $version_string, available from unicode.org,
96 # on `date '+%Y-%m-%d'`.
100 echo 'my %unicode_decomposed = ('
103 -e 's/\(.*\);\(.*\)/ "\1", "\2",/'
109 # This table has been algorithmically derived from the file
110 # glyphlist.txt, version 2.0, available from partners.adobe.com,
111 # on `date '+%Y-%m-%d'`.
115 echo 'my %AGL_to_unicode = ('
119 -e '/;\(E\|F[0-8]\)/d' \
120 -e 's/\(.*\);\(.*\)/ "\1", "\2",/'
123 # Remove temporary files.