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