5cc849
#!/bin/sh
5cc849
# This script is used by the xorg-x11-fonts package in the %post stage for
5cc849
# some fonts to generate the right encodings.
5cc849
5cc849
fontdir=""
5cc849
encodingsdir="@DATADIR@/X11/fonts/encodings"
5cc849
5cc849
# some fonts need to skip mkfontscale, set to "yes" to skip
5cc849
skip_fontscale=""
5cc849
# some fonts need to run ttmkfdir, set to "yes" to run
5cc849
need_ttmkfdir=""
5cc849
5cc849
if [ $# -lt 1 ]; then
5cc849
    echo "Need at least one parameter for font dir."
5cc849
    exit 1
5cc849
fi
5cc849
5cc849
while [ $# != 0 ]; do
5cc849
    case $1 in
5cc849
        --skip-fontscale)
5cc849
        skip_fontscale="yes"
5cc849
        ;;
5cc849
        --need-ttmkfdir)
5cc849
        need_ttmkfdir="yes"
5cc849
        ;;
5cc849
        --encodingsdir)
5cc849
        shift
5cc849
        encodingsdir="$1"
5cc849
        ;;
5cc849
        *)
5cc849
        fontdir="$1"
5cc849
5cc849
        if [ $# != 1 ]; then
5cc849
            echo "Too many parameters."
5cc849
            exit 1
5cc849
        fi
5cc849
        ;;
5cc849
    esac
5cc849
    shift
5cc849
done
5cc849
5cc849
if [ "$skip_fontscale" != "yes" ]; then
5cc849
    mkfontscale $fontdir
5cc849
fi
5cc849
if [ "$need_ttmkfdir" = "yes" ]; then
5cc849
    ttmkfdir -d $fontdir -o "$fontdir/fonts.scale"
5cc849
fi
5cc849
5cc849
mkfontdir $fontdir
5cc849
fc-cache $fontdir
5cc849
5cc849
if ! [ -z "$encodingsdir" ]; then
5cc849
    [ -d "$encodingsdir" ] || mkdir -p "$encodingsdir"
5cc849
    [ -d "$encodingsdir/large" ] || mkdir -p "$encodingsdir/large"
5cc849
    oldpwd=$(pwd)
5cc849
    cd "$encodingsdir"
5cc849
    mkfontscale -n -e "$encodingsdir" -e "$encodingsdir/large"
5cc849
    cd ${oldpwd}
5cc849
fi
5cc849
5cc849