| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Bash script to extract kerning info for accents from sfd file that is passed in on standard input |
| 4 |
|
| 5 |
# SYNTAX: |
| 6 |
# cat sfdFile | sfdtokernaccent sfdFile KernAccentMTXfile |
| 7 |
|
| 8 |
sfdFile=$1 |
| 9 |
KernFile=$2 |
| 10 |
|
| 11 |
echo "Creating accent kerns $KernFile from $sfdFile" |
| 12 |
|
| 13 |
echo "% accent kerns $KernFile " > $KernFile |
| 14 |
echo "% Created by sfdtokernaccent from $sfdFile for accent kerning" >> $KernFile |
| 15 |
echo "% on `date`." >> $KernFile |
| 16 |
|
| 17 |
echo "\relax" >> $KernFile |
| 18 |
echo "\metrics" >> $KernFile |
| 19 |
|
| 20 |
read LineIn1 LineIn2 LineIn3 LineIn4 LineInRest |
| 21 |
ErrorVal=$? |
| 22 |
|
| 23 |
Char="" |
| 24 |
Width=0 |
| 25 |
AccentPos=0 |
| 26 |
|
| 27 |
while [ $ErrorVal -eq 0 ] |
| 28 |
do |
| 29 |
if [ "$LineIn1" = "StartChar:" ] |
| 30 |
then |
| 31 |
Char=$LineIn2 |
| 32 |
fi |
| 33 |
if [ "$LineIn1" = "Width:" ] |
| 34 |
then |
| 35 |
Width=$LineIn2 |
| 36 |
fi |
| 37 |
if [ "$LineIn1" = "AnchorPoint:" ] |
| 38 |
then |
| 39 |
if [ "$LineIn2" = '"TopCap"' ] |
| 40 |
then |
| 41 |
AccentPos=$LineIn3 |
| 42 |
#echo "found: $Char, $Width, $AccentPos" |
| 43 |
echo "\\fixaccentkern{$Char}{$AccentPos} % Width=$Width" >> $KernFile |
| 44 |
fi |
| 45 |
fi |
| 46 |
if [ "$LineIn1" = "AnchorPoint:" ] |
| 47 |
then |
| 48 |
if [ "$LineIn2" = '"Top"' ] |
| 49 |
then |
| 50 |
AccentPos=$LineIn3 |
| 51 |
#echo "found: $Char, $Width, $AccentPos" |
| 52 |
echo "\\fixaccentkern{$Char}{$AccentPos} % Width=$Width" >> $KernFile |
| 53 |
fi |
| 54 |
fi |
| 55 |
|
| 56 |
|
| 57 |
read LineIn1 LineIn2 LineIn3 LineIn4 LineInRest |
| 58 |
ErrorVal=$? |
| 59 |
done |
| 60 |
|
| 61 |
echo "\endmetrics" >> $KernFile |
| 62 |
|
| 63 |
echo "Done." |