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

Hello,

as Ondrej Grover pointed out on [1], the font.eclass installs font
files and indexes (font.dir, fonts.scale) into sub-dirs of
/usr/share/fonts/, e.g. /usr/share/fonts/terminus.

These directories are naturally not in the fontpath of Xorg server,
and could not be used without adding these with xset fp+.
As said on the bug, the Xserver itself should be abled to find all
fonts, and it's not the duty of the xinitrc/window-manager to collect
all these paths in the users process.

I'd like to propose a patch to font.eclass to add the newly created
paths to the Xorg server configuration via xorg.conf.d files [2].
I contacted fonts alias and, as mentioned on the bug and irc, Ben de
Groot (yngwin) does not object and says that font team lead Peter
Volkov (pva) is non-active.

Please review for technical problems (esp. for EPREFIX).

Open questions:

- - Should the (current) default xorg server paths
  /usr/share/fonts/{75dpi,100dpi,misc,TTF,OTF,TYPE1} really be excluded?
  How would the startup and font lookup perfomance degrade with
  multiple conf.d files, containing the same path multiple times?

- - How would already installed font packages see this fix?
  Revbump (and stabilize) every one of them?

- - Alternative solutions would be installing fonts in xorg-servers
  default paths or add one configuration file that gets newly
  assembled  on every font_pkg_postinst run.

Thanks

[1] https://bugs.gentoo.org/475488
[2] /etc/X11/xorg.conf.d/90-${PN}-${SLOT}.conf
- -- 
Michael Weber
Gentoo Developer
web: https://xmw.de/
mailto: Michael Weber <[email protected]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iF4EAREIAAYFAlHUrpsACgkQknrdDGLu8JA5rAEAgIALUkh/4qdikCnArjdsj2LP
v1MLlq9IQ8Mfv7WmWKkA/RDz6oJgDcl5k4bdSpJwFq5ORE64CWe0E82S927oVcH+
=UDJ7
-----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	3 Jul 2013 23:02:55 -0000
@@ -9,7 +9,7 @@
 
 inherit eutils
 
-EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
+EXPORT_FUNCTIONS pkg_setup src_install pkg_preinst pkg_postinst pkg_postrm
 
 # @ECLASS-VARIABLE: FONT_SUFFIX
 # @DEFAULT_UNSET
@@ -25,6 +25,13 @@
 # Working directory containing the fonts.
 FONT_S=${FONT_S:-${S}}
 
+# @ECLASS-VARIABLE: FONT_SLOT
+# @DEFAULT_UNSET
+# @REQUIRED
+# @DESCRIPTION:
+# Slot of the installed font package
+FONT_SLOT=${FONT_SLOT:-${SLOT}}
+
 # @ECLASS-VARIABLE: FONT_PN
 # @DESCRIPTION:
 # Font name (ie. last part of FONTDIR).
@@ -35,6 +42,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 element.
+FONT_X11_CONF=${FONT_X11_CONF:-/etc/X11/xorg.conf.d/90-${FONT_PN}-${FONT_SLOT}.conf}
+
 # @ECLASS-VARIABLE: FONT_CONF
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -74,6 +88,21 @@
 		if [[ -e ${FONT_S}/fonts.alias ]] ; then
 			doins "${FONT_S}"/fonts.alias
 		fi
+		if [[ -n ${FONT_X11_CONF} ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/75dpi ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/100dpi ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/misc ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/TTF ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/OTF ]] &&
+			[[ ${FONTDIR} != /usr/share/fonts/TYPE1 ]] ; then 
+			{
+				echo "Section \"Files\""
+				echo "    FontPath \"${FONTDIR}\""
+				echo "EndSection"
+			} > ${T}/$(basename ${FONT_X11_CONF})
+			insinto /etc/X11/xorg.conf.d
+			doins ${T}/$(basename ${FONT_X11_CONF})
+		fi
 	fi
 }
 
@@ -188,6 +217,18 @@
 	done
 }
 
+# @FUNCTION: font_pkg_preinst
+# @DESCRIPTION:
+# The font pkg_preinst function.
+font_pkg_preinst() {
+	if has X ${USE} && [[ -n "${FONT_X11_CONF}" ]] &&
+		! [[ -e ${EROOT}${FONT_X11_CONF} ]] ; then
+		elog "A new path element has been added to x11 fontpath."
+		elog "Either restart your x11 sessions or run"
+		elog "xset fp+ ${FONTDIR} ; xset fp rehash"
+	fi
+}
+
 # @FUNCTION: font_pkg_postinst
 # @DESCRIPTION:
 # The font pkg_postinst function.

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

Reply via email to