]> git.pld-linux.org Git - packages/fontpostinst.git/blobdiff - fontpostinst
- rever
[packages/fontpostinst.git] / fontpostinst
index a20fe4a38214119427160e99f43bc3b045bb9348..8a432f4438810b6ac6953c5c30f70b408e6694f4 100644 (file)
@@ -1,10 +1,16 @@
 #!/bin/sh
 
+# TODO:
+# Generating Fontmap for TTF fonts: http://docs.scribus.net/index.php?lang=en&page=gsfont
+
+# $Id$
+
 # Requires: /bin/sh textutils fileutils
 # optionally:
 #      mkfontdir, mkfontscale (XFree86)  (or ttmkfdir - for TTF only)
-#      fc-cache (XFree86-fontconfig)
+#      fc-cache (fontconfig or XFree86-fontconfig)
 #      gnome-font-install (gnome-print)
+#      t1libconfig (t1lib)
 
 FBASEDIR="/usr/share/fonts"
 
@@ -15,13 +21,17 @@ MKFONTSCALE="$MKFONTSCALEBIN"
 
 MKTTFFONTSCALEBIN="$MKFONTSCALEBIN"
 MKTTFFONTSCALE="$MKTTFFONTSCALEBIN"
-if [ ! -x "$MKFONTSCALEBIN" -a -f /usr/bin/ttmkfdir ]; then
+if [ ! -x "$MKFONTSCALEBIN" -a -x /usr/bin/ttmkfdir ]; then
        # fallback for X <= 4.2.x
        MKTTFFONTSCALEBIN="/usr/bin/ttmkfdir"
        MKTTFFONTSCALE="$MKFONTSCALEBIN -e /usr/share/fonts/encodings/encodings.dir"
 fi
 
-FCCACHEBIN="/usr/X11R6/bin/fc-cache"
+FCCACHEBIN="/usr/bin/fc-cache"
+if [ ! -x $FCCACHEBIN -a -x /usr/X11R6/bin/fc-cache ]; then
+       # use XFree86-fontconfig
+       FCCACHEBIN="/usr/X11R6/bin/fc-cache"
+fi
 if [ ! -x $FCCACHEBIN -a -x /usr/X11R6/bin/xftcache ]; then
        # fallback for XFree86 4.[0-2]
        FCCACHEBIN="/usr/X11R6/bin/xftcache"
@@ -35,13 +45,17 @@ if [ ! -x $GNOMEFONTINSTBIN -a -x /usr/X11R6/bin/gnome-font-install ]; then
 fi
 GNOMEFONTINST="$GNOMEFONTINSTBIN --target $FBASEDIR/fontmap"
 
+T1LIBCONFIGBIN="/usr/bin/t1libconfig"
+T1LIBCONFIG="$T1LIBCONFIGBIN --force"
+
 if [ -z "$1" ]; then
        echo "Usage: fontpostinst TYPE [DIR]"
-       echo "  TYPE is one of OTF, TTF, Type1, misc, 100dpi, 75dpi, CID, Speedo, PEX"
+       echo "  TYPE is one of:"
+       echo "    OTF, TTF, Type1, misc, 100dpi, 75dpi, cyrillic, local, CID, Speedo, PEX"
        echo "  default DIR is $FBASEDIR/TYPE"
        exit 1
 fi
-       
+
 FTYPE="$1"
 if [ -z "$2" ]; then
        FDIR="$FBASEDIR/$FTYPE"
@@ -50,7 +64,7 @@ else
 fi
 
 umask 022
-cd "$FDIR"
+cd "$FDIR" || exit 0
 if [ "`echo fonts.alias.*`" != 'fonts.alias.*' ]; then
        cat fonts.alias.* | LC_ALL=C sort -u > fonts.alias
 elif [ -f fonts.alias ]; then
@@ -66,18 +80,16 @@ case "$FTYPE" in
        fi
        if [ -x $FCCACHEBIN ]; then
                $FCCACHE
-       elif [ -x $XFTCACHEBIN ]; then
-               $XFTCACHE
        fi
        ;;
     Type1)
        rm -f fonts.scale.bak Fontmap.bak
-       if "`echo fonts.scale.*`" != 'fonts.scale.*' ]; then
+       if "`echo fonts.scale.*`" != 'fonts.scale.*' ]; then
                cat fonts.scale.* 2>/dev/null | LC_ALL=C sort -u > fonts.scale.tmp
                cat fonts.scale.tmp | wc -l | tr -d ' ' > fonts.scale
                cat fonts.scale.tmp >> fonts.scale
                rm -f fonts.scale.tmp
-       else if [ "`echo *.pf[ab]`" != '*.pf[ab]' ]; then
+       elif [ "`echo *.pf[ab]`" != '*.pf[ab]' ]; then
                # no hints - try to generate
                if [ -x $MKFONTSCALEBIN ]; then
                        $MKFONTSCALE
@@ -90,10 +102,8 @@ case "$FTYPE" in
        fi
        if [ -x $FCCACHEBIN ]; then
                $FCCACHE
-       elif [ -x $XFTCACHEBIN ]; then
-               $XFTCACHE
        fi
-       if "`echo Fontmap.*`" != 'Fontmap.*' ]; then
+       if "`echo Fontmap.*`" != 'Fontmap.*' ]; then
                cat Fontmap.* > Fontmap
        elif [ -f Fontmap ]; then
                mv -f Fontmap Fontmap-save
@@ -101,9 +111,12 @@ case "$FTYPE" in
        if [ -x $GNOMEFONTINSTBIN ]; then
                $GNOMEFONTINST
        fi
+       if [ -x $T1LIBCONFIGBIN ]; then
+               $T1LIBCONFIG
+       fi
        ;;
     CID|Speedo)
-       if "`echo fonts.scale.*`" != 'fonts.scale.*' ]; then
+       if "`echo fonts.scale.*`" != 'fonts.scale.*' ]; then
                cat fonts.scale.* 2>/dev/null | LC_ALL=C sort -u > fonts.scale.tmp
                cat fonts.scale.tmp | wc -l | tr -d ' ' > fonts.scale
                cat fonts.scale.tmp >> fonts.scale
@@ -114,6 +127,7 @@ case "$FTYPE" in
        if [ -x $MKFONTDIRBIN ]; then
                $MKFONTDIR
        fi
+       ;;
     misc)
        # special case - fonts needed for X server to start
        if [ -x $MKFONTDIRBIN ]; then
@@ -125,11 +139,17 @@ case "$FTYPE" in
 cursor.pcf.gz cursor
 EOF
        fi
+       if [ -x $FCCACHEBIN ]; then
+               $FCCACHE
+       fi
        ;;
-    100dpi|75dpi|cyrillic)
+    100dpi|75dpi|cyrillic|local)
        if [ -x $MKFONTDIRBIN ]; then
                $MKFONTDIR
        fi
+       if [ -x $FCCACHEBIN ]; then
+               $FCCACHE
+       fi
        ;;
     PEX)
        ;;
@@ -139,3 +159,4 @@ EOF
                $MKFONTDIR
        fi
 esac
+exit 0
This page took 0.097368 seconds and 4 git commands to generate.