summaryrefslogtreecommitdiff
path: root/fonts/gentium-tug/source/type1/generate-extra-kerns.sh
blob: d4049aa528f36e10b0fe0ac1d5f15ceaa4c21c95 (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
#!/bin/sh
# This file is part of the Gentium package for TeX.
# It is licensed under the Expat License, see doc//README for details.

# Generates extra kerning pairs for Greek.
# GentiumBasic has no Greek, so no correction is needed.
#
# If you want to keep the files with extra kerning pairs,
# run just this script.

TTF_PATH="../../../../fonts/truetype/public/gentium-tug"
AFM_PATH="../../../../fonts/afm/public/gentium-tug"

for i in Gentium{,Book}Plus-{Regular,Italic,Bold,BoldItalic}.ttf; do
  echo "----------------------------------------------"
  echo "* Generating extra kerns for $i"
  echo "* Converting font to sfd"
  FILE_TTF="$TTF_PATH/$i"
  FILE_SFD="$(basename $i .ttf).sfd"
  fontforge -lang=ff -c "Open('$FILE_TTF');Save('$FILE_SFD')" 
  echo "* Calculating the kerns"
  ./greekcorrection.py $(basename $i .ttf).sfd
  ./kerncorrection.py "$AFM_PATH/$(basename $i .ttf).afm" $(basename $i .ttf)-extra.afm

  if [ -f "$(basename $i .ttf)-Czech.kern" ]
  then
    cat $(basename $i .ttf)-Czech.kern >> $(basename $i .ttf)-extra.afm
  fi
done

rm *sfd