#!/bin/bash
################################################################################
# Fichier : mfinst.sh
# Auteur  : Sebastien Beaugrand
# Date    : 13 Nov 2008
# Url     : http://www.chez.com/beaugrand/
################################################################################
texdir=/usr/share/texmf

user=`whoami`
if [ $user != "root" ]; then
  echo "you must be root"
  exit -1
fi

if [ -z "$1" ]; then
  echo "usage: ${0##*/} <font.mf>"
  exit -1
fi
name=${1%.mf}

cat > $texdir/tex/latex/psnfss/$name.sty << EOF
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{$name}
\newcommand{\\$name}[1]{{\fontencoding{T1}\fontfamily{$name}\selectfont #1}}
\endinput
EOF

cat > $texdir/tex/latex/psnfss/t1$name.fd << EOF
\ProvidesFile{t1$name.fd}
\DeclareFontFamily{T1}{$name}{}
\DeclareFontShape{T1}{$name}{m}{n}{<-> $name}{}
\endinput
EOF

cp -f $name.mf $texdir/fonts/source/public/misc/
texhash

# Pour convertir en TTF :
# mftrace --formats=ttf $name.mf

# Fin du fichier mfinst.sh