#!/bin/bash
# read fonts.dir and write fonts.alias
# for creating truetype font directories in X windows
# anything below 9pts is 9pts, resolution is always 75
# part of the gn*nix conspiracy http://gnnix.org
# Copyright (c) Linus Sphinx 2004
#
let x=1
while read line
do
 if [ $x -eq 1 ]; then
  echo skipping first line...
 else
#  echo $x: $line
  if test -n "$line"; then
   olifs=$IFS
   IFS=-
   set $line 
   name="-${2}-${3}-${4}-${5}-${6}-${7}-"
   shift 7 
   for sz in 6 7 8 9 10 11 12 13 14 15 18 24 
   do
    left="${sz}-${sz}0-75-75-${5}-${6}-${7}-${8}"
    if [ $sz -lt 9 ]; then
     rite="9-90-${3}-${4}-${5}-${6}-${7}-${8}"
    else
     rite="${sz}-${sz}0-${3}-${4}-${5}-${6}-${7}-${8}"
    fi
    echo "\"${name}${left}\" \"${name}${rite}\"" >> fonts.alias
   done
   IFS=$olifs
  fi
 fi
 let x=$x+1
done < fonts.dir
let j=$x*12
echo wrote $j aliases for $x fonts
exit 0
#eof

