Blame SOURCES/xorg-x11-fonts-update-dirs

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