-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

New approch,

since Xorg server only accepts FontPath from the last loaded
xorg.conf.d file, this would be 90-font.conf.
It's created/updated during pkg_postinst and pkg_postrm, so outside
the scope of CONFIG_PROTECT.

To allow users/admins to add out-of-portage fonts dir permanently,
(/usr/local et al), a file 90-font.conf.in is sourced if present.

Explanation is moved to 90-font.conf, no explicit warning to restart
Xserver or `xset fp+` is given on the portage output.

Better/Fine/Feedback/Any?

- -- 
Michael Weber
Gentoo Developer
web: https://xmw.de/
mailto: Michael Weber <x...@gentoo.org>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlHVh84ACgkQknrdDGLu8JBKWwD/aRjT/oKeL9uyKqMWLxObmRyG
+VidocTtQ0JqERWyD4QA/jb89tV3rAbiOwaXHS/zBxA9qvh43GtU5Hjt38paQeOb
=E1Xp
-----END PGP SIGNATURE-----
Index: font.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/font.eclass,v
retrieving revision 1.56
diff -u -B -r1.56 font.eclass
--- font.eclass	9 Jun 2013 02:08:23 -0000	1.56
+++ font.eclass	4 Jul 2013 14:28:33 -0000
@@ -35,6 +35,13 @@
 # Full path to installation directory.
 FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
 
+# @ECLASS-VARIABLE: FONT_X11_CONF
+# @DEFAULT_UNSET
+# @REQUIRED
+# @DESCRIPTION:
+# X11 config file containing the additional fontpath elements.
+FONT_X11_CONF=${FONT_X11_CONF:-${EROOT}etc/X11/xorg.conf.d/90-font.conf}
+
 # @ECLASS-VARIABLE: FONT_CONF
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -188,6 +195,38 @@
 	done
 }
 
+# @FUNCTION: font_update_x11_conf
+# @DESCRIPTION:
+# Update the FontPath lines in FONT_X11_CONF file
+# Do this regardless of USE=X on a particular font package
+font_update_x11_conf() {
+	if [ -z "${FONT_X11_CONF}" ] ; then
+		einfo "FONT_X11_CONF is empty"
+		return
+	fi
+	ebegin "collecting X11 FontPath elements for ${FONT_X11_CONF}."
+	mkdir -p "$(basename ${FONT_X11_CONF})"
+	{
+		echo "# Changes to this file need Xserver restart or"
+		echo "# xset fp default ; xset fp rehash."
+		echo "# Add custom paths to ${FONT_X11_CONF}.in."
+		echo "# See font.eclass/font_update_x11_conf for implementation."
+		echo "Section \"Files\""
+		# installed directories 
+		local cand
+		for cand in $(find "${EROOT}usr/share/fonts" -name fonts.dir | sort)
+		do
+			echo "    FontPath \"$(dirname "${cand}")\""
+		done
+		# user supplied lines
+		echo "# begin of ${FONT_X11_CONF}.in"
+		[ -r "${FONT_X11_CONF}.in" ] && cat "${FONT_X11_CONF}.in"
+		echo "# end of ${FONT_X11_CONF}.in"
+		echo "EndSection"
+	} > "${FONT_X11_CONF}"
+	eend
+}
+
 # @FUNCTION: font_pkg_postinst
 # @DESCRIPTION:
 # The font pkg_postinst function.
@@ -216,6 +255,8 @@
 		fc-cache -fs
 		eend $?
 	fi
+	
+	font_update_x11_conf
 }
 
 # @FUNCTION: font_pkg_postrm
@@ -233,4 +274,6 @@
 		fc-cache -fs
 		eend $?
 	fi
+	
+	font_update_x11_conf
 }

Attachment: font.eclass.patch.sig
Description: PGP signature

Reply via email to