# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ ECLASS=font EXPORT_FUNCTIONS pkg_postinst pkg_postrm INHERITED="$INHERITED $ECLASS" DESCRIPTION="Based on the ${ECLASS} eclass" DEPEND="media-fonts/chkfontpath" font_pkg_postinst() { if [ -x /usr/X11R6/bin/chkfontpath ] ; then for fp in ${FONTPATH} do if [ -z "`/usr/X11R6/bin/chkfontpath -l | grep " ${fp}$"`" ]; then ebegin "Adding ${fp} to XF86Config and xfs..." /usr/X11R6/bin/chkfontpath -qa ${fp} eend $? fi done fi } font_pkg_postrm() { if [ -x /usr/X11R6/bin/chkfontpath ] ; then for fp in ${FONTPATH} do if [ ! -f "${fp}/fonts.dir" -o `head -n 1 "${fp}/fonts.dir"` = "0" ] ; then ebegin "Removing ${fp} from XF86Config and xfs..." /usr/X11R6/bin/chkfontpath -qr ${fp} eend $? fi done fi } fontdir_config() { if [ ! -x /usr/X11R6/bin/mkfontdir -o ! -x /usr/X11R6/bin/ttmkfdir ] then ewarn "Could not find the mkfontdir or ttmkfdir binaries!" return 0 fi if [ ! -d /usr/X11R6/lib/X11/fonts/encodings ] then ewarn "Encodings directory are missing!" ewarn "Please restore /usr/X11R6/lib/X11/fonts/encodings ..." return 0 fi # Generate the encodings.dir ... /usr/X11R6/bin/mkfontdir -n \ -e /usr/X11R6/lib/X11/fonts/encodings \ -e /usr/X11R6/lib/X11/fonts/encodings/large \ -- /usr/X11R6/lib/X11/fonts/encodings ebegin "Scanning font directories" for fp in ${FONTPATH} do ebegin " ${fp}" /usr/X11R6/bin/ttmkfdir \ -e /usr/X11R6/lib/X11/fonts/encodings/encodings.dir \ -o ${fp}/fonts.scale -d ${fp} > /dev/null # Now generate fonts.dir files ... /usr/X11R6/bin/mkfontdir \ -e /usr/X11R6/lib/X11/fonts/encodings \ -e /usr/X11R6/lib/X11/fonts/encodings/large \ -- ${fp} > /dev/null if [ -x /usr/X11R6/bin/xftcache ] && \ [ -f "${fp}/fonts.scale" -a `head -n 1 "${fp}/fonts.dir"` != "0" ] then # xftcache is broken, but run it anyhow ... /usr/X11R6/bin/xftcache ${fp} &> /dev/null fi eend $? done # While we at it, update fontconfig's cache as well if [ -x /usr/bin/fc-cache ] then ebegin "Updating FC cache" HOME="/root" /usr/bin/fc-cache -f eend $? fi }