[xorg-x11-font-utils/f13/master] - Add xorg-x11-fonts-update-dirs, a script to automake mkfontscale and friends as well as generate

Peter Hutterer whot at fedoraproject.org
Tue Dec 7 03:29:41 UTC 2010


commit dfa79a6b2f6a63c61d99eea43b4797fda6159853
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Dec 7 13:28:36 2010 +1000

    - Add xorg-x11-fonts-update-dirs, a script to automake mkfontscale and
      friends as well as generate encodings directories during %post (used by
      xorg-x11-fonts). (#634039)
    - Fix need_ttmkfdir test in xorg-x11-fonts-update-dirs script (#655925)
    
    Conflicts:
    
    	xorg-x11-font-utils.spec
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

 xorg-x11-font-utils.spec   |   14 +++++++++-
 xorg-x11-fonts-update-dirs |   59 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/xorg-x11-font-utils.spec b/xorg-x11-font-utils.spec
index c2e72fa..f4a0e78 100644
--- a/xorg-x11-font-utils.spec
+++ b/xorg-x11-font-utils.spec
@@ -5,7 +5,7 @@ Name: xorg-x11-%{pkgname}
 # IMPORTANT: If package ever gets renamed to something else, remove the Epoch line!
 Epoch: 1
 Version: 7.2
-Release: 11%{?dist}
+Release: 12%{?dist}
 License: MIT
 Group: User Interface/X
 URL: http://www.x.org
@@ -16,6 +16,8 @@ Source1: ftp://ftp.x.org/pub/individual/app/fonttosfnt-1.0.3.tar.bz2
 Source2: ftp://ftp.x.org/pub/individual/app/mkfontdir-1.0.5.tar.bz2
 Source3: ftp://ftp.x.org/pub/individual/app/mkfontscale-1.0.7.tar.bz2
 Source4: ftp://ftp.x.org/pub/individual/font/font-util-1.1.0.tar.bz2
+# helper script used in %post for xorg-x11-fonts
+Source5: xorg-x11-fonts-update-dirs
 
 Patch0: font-util-1.0.1-mapdir-use-datadir-fix.patch
 Patch1: font-util-1.0.1-autoconf-add-with-fontdir-option.patch
@@ -85,6 +87,9 @@ rm -rf $RPM_BUILD_ROOT
     done
 }
 
+install -m 744 %{SOURCE5} ${RPM_BUILD_ROOT}%{_bindir}/xorg-x11-fonts-update-dirs
+sed -i "s:@DATADIR@:%{_datadir}:" ${RPM_BUILD_ROOT}%{_bindir}/xorg-x11-fonts-update-dirs
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -96,6 +101,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/mkfontdir
 %{_bindir}/mkfontscale
 %{_bindir}/ucs2any
+%{_bindir}/xorg-x11-fonts-update-dirs
 %dir %{_datadir}/X11/fonts
 %dir %{_datadir}/X11/fonts/util
 %{_datadir}/X11/fonts/util/map-*
@@ -114,6 +120,12 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Dec 07 2010 Peter Hutterer <peter.hutterer at redhat.com> 1:7.4-3
+- Add xorg-x11-fonts-update-dirs, a script to automake mkfontscale and
+  friends as well as generate encodings directories during %post (used by
+  xorg-x11-fonts). (#634039)
+- Fix need_ttmkfdir test in xorg-x11-fonts-update-dirs script (#655925)
+
 * Tue Nov 10 2009 Adam Jackson <ajax at redhat.com> 7.2-11
 - font-util 1.1.0
 
diff --git a/xorg-x11-fonts-update-dirs b/xorg-x11-fonts-update-dirs
new file mode 100755
index 0000000..88c6e66
--- /dev/null
+++ b/xorg-x11-fonts-update-dirs
@@ -0,0 +1,59 @@
+#!/bin/sh
+# This script is used by the xorg-x11-fonts package in the %post stage for
+# some fonts to generate the right encodings.
+
+fontdir=""
+encodingsdir="@DATADIR@/X11/fonts/encodings"
+
+# some fonts need to skip mkfontscale, set to "yes" to skip
+skip_fontscale=""
+# some fonts need to run ttmkfdir, set to "yes" to run
+need_ttmkfdir=""
+
+if [ $# -lt 1 ]; then
+    echo "Need at least one parameter for font dir."
+    exit 1
+fi
+
+while [ $# != 0 ]; do
+    case $1 in
+        --skip-fontscale)
+        skip_fontscale="yes"
+        ;;
+        --need-ttmkfdir)
+        need_ttmkfdir="yes"
+        ;;
+        --encodingsdir)
+        shift
+        encodingsdir="$1"
+        ;;
+        *)
+        fontdir="$1"
+
+        if [ $# != 1 ]; then
+            echo "Too many parameters."
+            exit 1
+        fi
+        ;;
+    esac
+    shift
+done
+
+if [ "$skip_fontscale" != "yes" ]; then
+    mkfontscale $fontdir
+fi
+if [ "$need_ttmkfdir" = "yes" ]; then
+    ttmkfdir $fontdir
+fi
+
+mkfontdir $fontdir
+fc-cache $fontdir
+
+if ! [ -z "$encodingsdir" ]; then
+    [ -d "$encodingsdir" ] || mkdir -p "$encodingsdir"
+    pushd "$encodingsdir"
+    mkfontscale -n -e "$encodingsdir" -e "$encodingsdir/large"
+    popd
+fi
+
+


More information about the fonts-bugs mailing list