From 6b02c90ab127f16d3f08e619c8913ca73adb212e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 22 Nov 2010 08:59:27 +1000 Subject: [PATCH] - 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) --- xorg-x11-font-utils.spec | 13 ++++++++- xorg-x11-fonts-update-dirs | 59 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100755 xorg-x11-fonts-update-dirs diff --git a/xorg-x11-font-utils.spec b/xorg-x11-font-utils.spec index 1c96dee..876a487 100644 --- a/xorg-x11-font-utils.spec +++ b/xorg-x11-font-utils.spec @@ -6,7 +6,7 @@ Name: xorg-x11-%{pkgname} # IMPORTANT: If package ever gets renamed to something else, remove the Epoch line! Epoch: 1 Version: 7.5 -Release: 2%{?dist} +Release: 3%{?dist} License: MIT Group: User Interface/X URL: http://www.x.org @@ -17,6 +17,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.6.tar.bz2 Source3: ftp://ftp.x.org/pub/individual/app/mkfontscale-%{mkfontscale}.tar.bz2 Source4: ftp://ftp.x.org/pub/individual/font/font-util-1.2.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 @@ -93,6 +95,9 @@ rm -rf $RPM_BUILD_ROOT cp font-util-*/COPYING COPYING-bdftruncate } +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 @@ -104,6 +109,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-* @@ -123,6 +129,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Nov 19 2010 Peter Hutterer 1:7.5-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) + * Mon Nov 08 2010 Peter Hutterer 1:7.5-2 - mkfontdir 1.0.6 diff --git a/xorg-x11-fonts-update-dirs b/xorg-x11-fonts-update-dirs new file mode 100755 index 0000000..e481af6 --- /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 + +