3 # Requires: /bin/sh textutils fileutils
5 # mkfontdir, mkfontscale (XFree86) (or ttmkfdir - for TTF only)
6 # fc-cache (XFree86-fontconfig)
7 # gnome-font-install (gnome-print)
9 FBASEDIR="/usr/share/fonts"
11 MKFONTDIRBIN="/usr/X11R6/bin/mkfontdir"
12 MKFONTDIR="$MKFONTDIRBIN"
13 MKFONTSCALEBIN="/usr/X11R6/bin/mkfontscale"
14 MKFONTSCALE="$MKFONTSCALEBIN"
16 MKTTFFONTSCALEBIN="$MKFONTSCALEBIN"
17 MKTTFFONTSCALE="$MKTTFFONTSCALEBIN"
18 #MKTTFFONTSCALEBIN="/usr/bin/ttmkfdir"
19 #MKTTFFONTSCALE="$MKFONTSCALEBIN -e /usr/share/fonts/encodings/encodings.dir"
21 FCCACHEBIN="/usr/X11R6/bin/fc-cache"
22 if [ ! -x $FCCACHEBIN -a -x /usr/X11R6/bin/xftcache ]; then
23 # fallback for XFree86 4.[0-2]
24 FCCACHEBIN="/usr/X11R6/bin/xftcache"
26 FCCACHE="$FCCACHEBIN ."
28 GNOMEFONTINSTBIN="/usr/bin/gnome-font-install"
29 if [ ! -x $GNOMEFONTINSTBIN -a -x /usr/X11R6/bin/gnome-font-install ]; then
31 GNOMEFONTINSTBIN="/usr/X11R6/bin/gnome-font-install"
33 GNOMEFONTINST="$GNOMEFONTINSTBIN --target $FBASEDIR/fontmap"
36 echo "Usage: fontpostinst TYPE [DIR]"
37 echo " TYPE is one of OTF, TTF, Type1, misc, 100dpi, 75dpi, CID, Speedo, PEX"
38 echo " default DIR is $FBASEDIR/TYPE"
44 FDIR="$FBASEDIR/$FTYPE"
51 if [ "`echo fonts.alias.*`" != 'fonts.alias.*' ]; then
52 cat fonts.alias.* | LC_ALL=C sort -u > fonts.alias
58 if [ -x $MKTTFFONTSCALEBIN ]; then
61 if [ -x $MKFONTDIRBIN ]; then
64 if [ -x $FCCACHEBIN ]; then
66 elif [ -x $XFTCACHEBIN ]; then
71 rm -f fonts.scale.bak Fontmap.bak
72 if "`echo fonts.scale.*`" != 'fonts.scale.*' ]; then
73 cat fonts.scale.* 2>/dev/null | LC_ALL=C sort -u > fonts.scale.tmp
74 cat fonts.scale.tmp | wc -l | tr -d ' ' > fonts.scale
75 cat fonts.scale.tmp >> fonts.scale
77 else if [ "`echo *.pf[ab]`" != '*.pf[ab]' ]; then
78 # no hints - try to generate
79 if [ -x $MKFONTSCALEBIN ]; then
85 if [ -x $MKFONTDIRBIN ]; then
88 if [ -x $FCCACHEBIN ]; then
90 elif [ -x $XFTCACHEBIN ]; then
93 if "`echo Fontmap.*`" != 'Fontmap.*' ]; then
94 cat Fontmap.* > Fontmap
98 if [ -x $GNOMEFONTINSTBIN ]; then
103 # special case - fonts needed for X server to start
104 if [ -x $MKFONTDIRBIN ]; then
106 elif [ -f 6x13-ISO8859-1.pcf.gz -a -f cursor.pcf.gz ]; then
107 cat > fonts.dir <<EOF
109 6x13-ISO8859-1.pcf.gz -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
114 100dpi|75dpi|CID|Speedo|PEX)
115 if [ -x $MKFONTDIRBIN ]; then
120 echo "Warning: \"$FTYPE\": unknown font type!" >&2
121 if [ -x $MKFONTDIRBIN ]; then