5 dh_installxfonts - register X fonts
10 use Debian::Debhelper::Dh_Lib;
14 B<dh_installxfonts> [S<I<debhelper options>>]
18 B<dh_installxfonts> is a debhelper program that is responsible for
19 registering X fonts, so their corresponding F<fonts.dir>, F<fonts.alias>,
20 and F<fonts.scale> be rebuilt properly at install time.
22 Before calling this program, you should have installed any X fonts provided
23 by your package into the appropriate location in the package build
24 directory, and if you have F<fonts.alias> or F<fonts.scale> files, you should
25 install them into the correct location under F<etc/X11/fonts> in your
26 package build directory.
28 Your package should depend on B<xfonts-utils> so that the
29 B<update-fonts->I<*> commands are available. (This program adds that dependency to
32 This program automatically generates the F<postinst> and F<postrm> commands needed
33 to register X fonts. These commands are inserted into the maintainer
34 scripts by B<dh_installdeb>. See L<dh_installdeb(1)> for an explanation of how
39 See L<update-fonts-alias(8)>, L<update-fonts-scale(8)>, and
40 L<update-fonts-dir(8)> for more information about X font installation.
42 See Debian policy, section 11.8.5. for details about doing fonts the Debian
49 foreach my $package (@{$dh{DOPACKAGES}}) {
50 my $tmp=tmpdir($package);
52 # Find all font directories in the package build directory.
54 foreach my $parentdir ("$tmp/usr/share/fonts/X11/") {
55 opendir(DIR, $parentdir) || next;
56 @fontdirs = grep { -d "$parentdir/$_" && !/^\./ } (readdir DIR);
61 # Figure out what commands the postinst and postrm will need
66 foreach my $f (@fontdirs) {
67 # This must come before update-fonts-dir.
68 push @cmds, "update-fonts-scale $f"
69 if -f "$tmp/etc/X11/fonts/$f/$package.scale";
70 push @cmds, "update-fonts-dir --x11r7-layout $f";
71 if (-f "$tmp/etc/X11/fonts/$f/$package.alias") {
72 push @cmds_postinst, "update-fonts-alias --include /etc/X11/fonts/$f/$package.alias $f";
73 push @cmds_postrm, "update-fonts-alias --exclude /etc/X11/fonts/$f/$package.alias $f";
74 addsubstvar($package, "misc:Depends", "xfonts-utils (>= 1:7.5+2)");
78 autoscript($package, "postinst", "postinst-xfonts",
79 "s:#CMDS#:".join(";", @cmds, @cmds_postinst).":");
80 autoscript($package, "postrm", "postrm-xfonts",
81 "s:#CMDS#:".join(";", @cmds, @cmds_postrm).":");
83 addsubstvar($package, "misc:Depends", "xfonts-utils");
91 This program is a part of debhelper.
95 Joey Hess <joeyh@debian.org>