#! /bin/sh

set -e

CONF=/etc/fonts/local.conf

# Duplicate list of all possible links in /etc/fonts/conf.d created
# in postinst
unhinted="10-unhinted.conf"
autohint="10-autohint.conf"
hintnone="10-hinting-none.conf"
hintslight="10-hinting-slight.conf"
hintmedium="10-hinting-medium.conf"
hintfull="10-hinting-full.conf"
subpixel="10-sub-pixel-rgb.conf"
no_subpixel="10-no-sub-pixel.conf"
yes_bitmaps="70-yes-bitmaps.conf"
no_bitmaps="70-no-bitmaps.conf"

CONFFILES="$unhinted $autohint $hintnone $hintslight $hintmedium $hintfull $subpixel $no_subpixel $yes_bitmaps $no_bitmaps"
CONFDIR=/etc/fonts/conf.d

case "$1" in
	purge)
	    if which ucf >/dev/null 2>&1; then
		ucf --purge $CONF
	    fi
	    rm -f $CONF

	    # Remove any files linked in postinst
	    for c in $CONFFILES; do
		rm -f $CONFDIR/$c
	    done

	    # Remove an empty local fonts directory
	    rmdir /usr/local/share/fonts 2>/dev/null || true

	    # Purge debconf database
	    if [ -e /usr/share/debconf/confmodule ]; then
		. /usr/share/debconf/confmodule
		db_purge
	    fi
	    ;;
esac

# Automatically added by dh_installdeb/13.11.4
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-autohint.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-no-sub-pixel.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-sub-pixel-bgr.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-sub-pixel-rgb.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-sub-pixel-vbgr.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-sub-pixel-vrgb.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/10-unhinted.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/11-lcdfilter-default.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/11-lcdfilter-legacy.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/11-lcdfilter-light.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/20-fix-globaladvance.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/20-unhint-small-vera.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/25-unhint-nonlatin.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/30-metric-aliases.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/30-urw-aliases.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/40-nonlatin.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/45-latin.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/49-sansserif.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/50-user.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/51-local.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/60-latin.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/65-fonts-persian.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/65-khmer.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/65-nonlatin.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/69-unifont.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/70-force-bitmaps.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/70-no-bitmaps.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/70-yes-bitmaps.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/80-delicious.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/conf.avail/90-synthetic.conf 2.10 -- "$@"
dpkg-maintscript-helper rm_conffile /etc/fonts/fonts.dtd 2.10 -- "$@"
# End automatically added section
# Automatically added by dh_installdebconf/13.11.4
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
	. /usr/share/debconf/confmodule
	db_purge
fi
# End automatically added section

