# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.36 2003/10/26 10:22:51 liquidx Exp $ # Author: foser # Author: Mamoru KOMACHI # Font Eclass # # Eclass to make font installation more uniform ECLASS="font" INHERITED="$INHERITED $ECLASS" EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm einstall genfontdir # # Variable declarations # if [ -z "${FONT_SUFFIXES}" ] then # Space-delimited list of font suffixes to install FONT_SUFFIXES="ttf pcf.gz" fi if [ -z "${FONTPATH}" ] then # Path to destination font directory FONTPATH="/usr/share/fonts/${PN}" fi IUSE="${IUSE} X" newdepend "X? ( virtual/x11 )" # # Public inheritable functions # font_src_install() { einstall || die rm -f fonts.{dir,scale} encodings.dir genfontdir || die } font_pkg_postinst() { einfo einfo "You need to add following line to 'Section \"Files\"' in" einfo "XF86Config and reboot X Window System to use these fonts." einfo einfo " FontPath \"${FONTPATH}\"" einfo } font_pkg_postrm() { einfo einfo "You need to remove following line to 'Section \"Files\"' in" einfo "XF86Config to unmerge this package completely." einfo einfo " FontPath \"${FONTPATH}\"" einfo } font_einstall() { insinto ${FONTPATH} shopt -s nullglob for suffix in ${FONT_SUFFIXES} do if [ "`echo *.$suffix`" != "" ] then einfo "Installing $suffix fonts..." doins *.$suffix fi done } font_genfontdir() { if [ -n "`use X`" ] then insinto ${FONTPATH} einfo "Creating fonts.scale & fonts.dir..." mkfontscale ${D}/${FONTPATH} mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings ${D}/${FONTPATH} doins fonts.alias if [ "${ROOT}" = "/" ] && [ -x /usr/bin/fc-cache ] then einfo "Creating fontconfig cache..." HOME="/root" /usr/bin/fc-cache -f ${D}/${FONTPATH} fi fi }