]> git.pld-linux.org Git - packages/fontpostinst.git/blobdiff - fontpostinst
- added "local" type, release 4
[packages/fontpostinst.git] / fontpostinst
index 6c40ac3bfdc4d97c4352669b8b2931dc64d1107e..d1766c9aabd3fc802f1ccb75b2790575bbca03bf 100644 (file)
@@ -15,8 +15,11 @@ MKFONTSCALE="$MKFONTSCALEBIN"
 
 MKTTFFONTSCALEBIN="$MKFONTSCALEBIN"
 MKTTFFONTSCALE="$MKTTFFONTSCALEBIN"
-#MKTTFFONTSCALEBIN="/usr/bin/ttmkfdir"
-#MKTTFFONTSCALE="$MKFONTSCALEBIN -e /usr/share/fonts/encodings/encodings.dir"
+if [ ! -x "$MKFONTSCALEBIN" -a -f /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"
 if [ ! -x $FCCACHEBIN -a -x /usr/X11R6/bin/xftcache ]; then
@@ -34,7 +37,8 @@ GNOMEFONTINST="$GNOMEFONTINSTBIN --target $FBASEDIR/fontmap"
 
 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
@@ -50,8 +54,8 @@ umask 022
 cd "$FDIR"
 if [ "`echo fonts.alias.*`" != 'fonts.alias.*' ]; then
        cat fonts.alias.* | LC_ALL=C sort -u > fonts.alias
-else
-       rm -f fonts.alias
+elif [ -f fonts.alias ]; then
+       mv -f fonts.alias fonts.alias-save
 fi
 case "$FTYPE" in
     OTF|TTF)
@@ -69,18 +73,18 @@ case "$FTYPE" in
        ;;
     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
                fi
-       else
-               rm -f fonts.scale
+       elif [ -f fonts.scale ]; then
+               mv -f fonts.scale fonts.scale-save
        fi
        if [ -x $MKFONTDIRBIN ]; then
                $MKFONTDIR
@@ -90,15 +94,28 @@ case "$FTYPE" in
        elif [ -x $XFTCACHEBIN ]; then
                $XFTCACHE
        fi
-       if "`echo Fontmap.*`" != 'Fontmap.*' ]; then
+       if "`echo Fontmap.*`" != 'Fontmap.*' ]; then
                cat Fontmap.* > Fontmap
-       else
-               rm -f Fontmap
+       elif [ -f Fontmap ]; then
+               mv -f Fontmap Fontmap-save
        fi
        if [ -x $GNOMEFONTINSTBIN ]; then
                $GNOMEFONTINST
        fi
        ;;
+    CID|Speedo)
+       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
+       elif [ -f fonts.scale ]; then
+               mv -f fonts.scale fonts.scale-save
+       fi
+       if [ -x $MKFONTDIRBIN ]; then
+               $MKFONTDIR
+       fi
+       ;;
     misc)
        # special case - fonts needed for X server to start
        if [ -x $MKFONTDIRBIN ]; then
@@ -111,11 +128,13 @@ cursor.pcf.gz cursor
 EOF
        fi
        ;;
-    100dpi|75dpi|CID|Speedo|PEX)
+    100dpi|75dpi|cyrillic|local)
        if [ -x $MKFONTDIRBIN ]; then
                $MKFONTDIR
        fi
        ;;
+    PEX)
+       ;;
     *)
        echo "Warning: \"$FTYPE\": unknown font type!" >&2
        if [ -x $MKFONTDIRBIN ]; then
This page took 0.1125 seconds and 4 git commands to generate.