%define prefix		/usr
%define texmf		%{prefix}/share/texmf
%define build_texmf	$RPM_BUILD_ROOT%{texmf}
%define dvipdfmconfig	%{texmf}/dvipdfm/config/config

%define exec_texhash	[ -x %{prefix}/bin/texhash ] && /usr/bin/env - %{prefix}/bin/texhash 2> /dev/null
%define updmap		%{texmf}/dvips/config/updmap
%define exec_updmap	< %{updmap} > %{updmap}.rpmtmp && cat < %{updmap}.rpmtmp > %{updmap}; rm -f %{updmap}.rpmtmp && (cd %{texmf}/dvips/config/; umask 022; ./updmap)

Summary: Virtual Text fonts using Adobe Palatino for TeX
Summary(ja): Adobe Palatino を TeX 用に配置し直した仮想フォント
Name: pxfonts
Version: 1.0
Release: 9
Source0: ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN/fonts/pxfonts.tar.gz
URL: http://www.utdallas.edu/~ryoung/pxfonts/
Copyright: GPL
Buildroot: %{_tmppath}/%{name}-%{version}-root
Group: Applications/Publishing
BuildArch: noarch
BuildRequires: unzip
PreReq: sed, /usr/bin/env
Requires: tetex, txfonts
Packager: Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>

%description
The PX fonts consist of
 - virtual text roman fonts using Adobe Palatino (or URWPalladioL) with
      some modified and additional text symbols in
      the OT1, T1, and TS1 encoding
 - virtual text sans serif fonts using Adobe Helvetica (or URW NimbusSanL)
      with additional text symbols in OT1, T1, TS1, and LY1 encodings
      (Provided in the TX fonts distribution)
 - monospaced typewriter fonts in OT1, T1, TS1, and LY1 encodings
      (Provided in the TX fonts distribution)
 - math alphabets using Adobe Palatino (or URWPalladioL)
      with modified metrics
 - math fonts of all symbols corresponding to those of Computer Modern
      math fonts (CMSY, CMMI, CMEX, and Greek letters of CMR)
 - math fonts of all symbols corresponding to those of AMS fonts
      (MSAM and MSBM)
 - additional math fonts of various symbols

All fonts are in the Type 1 format (in afm and pfb files).
Necessary tfm and vf files together with
LaTeX2e package files and font map files for dvips are provided.

The PX fonts and related files are distributed 
without any guaranty or warranty.
I do not assume responsibility for any actual or possible
damages or losses, directly or indirectly caused by the
distributed files.
The PX fonts are distributed under the GNU public license (GPL).
The fonts will be improved and additional glyphs will be added
in the future.

%prep
rm -rf $RPM_BUILD_ROOT

%setup -q -n %{name}
unzip -qo px_patch1.zip
mv -f *.tfm tfm/
mv -f *.vf vf/

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p      %{build_texmf}/fonts/afm/pxr
cp -p afm/*   %{build_texmf}/fonts/afm/pxr
mkdir -p      %{build_texmf}/fonts/type1/pxr
cp -p pfb/*   %{build_texmf}/fonts/type1/pxr
mkdir -p      %{build_texmf}/fonts/tfm/pxr
cp -p tfm/*   %{build_texmf}/fonts/tfm/pxr
mkdir -p      %{build_texmf}/fonts/vf/pxr
cp -p vf/*    %{build_texmf}/fonts/vf/pxr
mkdir -p      %{build_texmf}/tex/latex/pxr
cp -p input/* %{build_texmf}/tex/latex/pxr
mkdir -p      %{build_texmf}/dvips/config
cp -p dvips/* %{build_texmf}/dvips/config
mkdir -p        %{build_texmf}/dvipdfm/config
cp -p dvipdfm/* %{build_texmf}/dvipdfm/config

%post
%{exec_texhash}
exit 0

%postun
%{exec_texhash}
exit 0


%trigger -- tetex
if [ -e %{updmap} ]; then
    sed -e "s/ pxr.map//" -e 's/extra_modules="/& pxr.map/' %{exec_updmap}
fi
exit 0

%triggerun -- tetex
rm -rf /var/lib/texmf/pk/modeless/pxr
if [ "$1" = 0 ]; then
    if [ -e %{updmap} ]; then
	sed -e "s/ pxr.map//" %{exec_updmap}
    fi
fi
exit 0


# begin generated by rpm-rewrite.pl 0.5
# http://www.nn.iij4u.or.jp/~tutimura/rpm-rewrite/
%triggerin -- dvipdfm
cat <<ORIGINAL_CODE >/dev/null
--------
%rewritetrigger -- dvipdfm
%rewrite %{dvipdfmconfig} %
f pxr3.map
%
--------
ORIGINAL_CODE

if [ -e %{dvipdfmconfig} ]; then
cp -af %{dvipdfmconfig} %{dvipdfmconfig}.rpmtemp && \
    sed -e '/^% Do not edit this line - begin %{name}-%{version}-%{release} 1$/,/^% Do not edit this line - end %{name}-%{version}-%{release} 1$/d' \
        -e 's/^% Do not edit this line - begin %{name}-%{version}-%{release} 2$/% Do not edit this line - begin %{name}-%{version}-%{release} 1/' \
        -e 's/^% Do not edit this line - end %{name}-%{version}-%{release} 2$/% Do not edit this line - end %{name}-%{version}-%{release} 1/' \
    < %{dvipdfmconfig}.rpmtemp > %{dvipdfmconfig}
cat <<EOF >>%{dvipdfmconfig}
% Do not edit this line - begin %{name}-%{version}-%{release} $2
% This part was added and will be removed by RPM automatically.
f pxr3.map
% Do not edit this line - end %{name}-%{version}-%{release} $2
EOF
fi

%triggerun -- dvipdfm
if [ -e %{dvipdfmconfig} ]; then
cp -af %{dvipdfmconfig} %{dvipdfmconfig}.rpmtemp && \
    sed -e '/^% Do not edit this line - begin %{name}-%{version}-%{release} 1$/,/^% Do not edit this line - end %{name}-%{version}-%{release} 1$/d' \
        -e 's/^% Do not edit this line - begin %{name}-%{version}-%{release} 2$/% Do not edit this line - begin %{name}-%{version}-%{release} 1/' \
        -e 's/^% Do not edit this line - end %{name}-%{version}-%{release} 2$/% Do not edit this line - end %{name}-%{version}-%{release} 1/' \
    < %{dvipdfmconfig}.rpmtemp > %{dvipdfmconfig}
fi
# end generated by rpm-rewrite.pl 0.5

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%{texmf}/fonts/afm/pxr
%{texmf}/fonts/type1/pxr
%{texmf}/fonts/tfm/pxr
%{texmf}/fonts/vf/pxr
%{texmf}/tex/latex/pxr
%{texmf}/dvips/config/*
%{texmf}/dvipdfm/config/*
%doc doc/pxfontsdocA4.{tex,pdf} patch1.txt


%changelog
* Tue Jun 19 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-9
- use rpm-rewrite.pl

* Tue Jun 12 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-8
- support dvipdfm

* Fri May 18 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-7
- modify %trigger/%triggerun

* Sun May  6 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-6
- use %trigger/%triggerun

* Fri Mar  2 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-5 (same revision as txfonts)
- apply patch1

* Tue Jan 16 2001 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-2
- update CTAN source

* Sat Dec 23 2000 Nobuyuki Tsuchimura <tutimura@nn.iij4u.or.jp>
- 1.0-1
- 1st release
