blob: d4e51de4b571051ed4c338f0b097f2d099030860 (
plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/bash
# Bash script to make glyph list from afm file.
# The glyph list is then used in making the etx file and for reglyphing.
# SYNTAX:
# afmtoglyphlist AfmFile GlyphListFile EncFile
# The EncFile is a PostScript encoding vector for dvips.
# If a glyph name from the AFM file appears in the encoding vector,
# then the script puts \ok as the second parameter to \declareglyph.
AfmFile=$1
GlyphList=$2
EncFile=$3
echo "Creating glyph list $GlyphList from $AfmFile for $EncFile"
MaxLines=`wc -l $AfmFile | cut -d" " -f 1`
echo " $MaxLines lines in afm file."
LineNum=1
UnknownGlyph=1
ProccessingChars=FALSE
echo "% glyph list $GlyphList " > $GlyphList
echo "% Created by afmtoglyhlist from $AfmFile for encoding $EncFile" >> $GlyphList
echo "% on `date`." >> $GlyphList
while [ $LineNum -le $MaxLines ];
do
Line=`head -n $LineNum $AfmFile | tail -1`
#echo "$LineNum: $Line"
if [ "$ProcessingChars" == "TRUE" ]
then
if [ "`echo \"$Line\" | grep EndCharMetrics`" != "" ]
then
ProcessingChars=FALSE
LineNum=$((MaxLines+1))
else
# process a character
Char=`echo "$Line" | cut -d" " -f 8`
if [ "$Char" != "" ]
then
if [ "`grep -x '[[:space:]]*/'$Char'[[:space:]]*' $EncFile`" != "" ]
then
echo '\declareglyph{'$Char'}{\ok}{}{}' >> $GlyphList
else
echo '\declareglyph{'$Char'}{unknown'$UnknownGlyph'}' >> $GlyphList
UnknownGlyph=$((UnknownGlyph+1))
fi
fi
fi
else
if [ "`echo \"$Line\" | grep StartCharMetrics`" != "" ]
then
ProcessingChars=TRUE
fi
fi
LineNum=$((LineNum+1))
done
echo "Done."
|