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