%define _fontdir %{_datadir}/fonts/TrueType-ipafont

Name:    TrueType-ipafont
Version: 3.03
Release: 1%{?_dist_release}
Summary: IPA TrueType Fonts
Summary(ja): IPA の日本語 TrueType フォント
Group: User Interface/X
License: IPA Font License Agreement v1.0
URL: http://ossipedia.ipa.go.jp/ipafont/

Source:	IPAfont00303.zip
Source10: ipafont-mincho.ttfconf
Source11: ipafont-gothic.ttfconf
Source20: cidfmap.ja.ipafont-mincho
Source21: cidfmap.ja.ipafont-gothic
Source30: 59-ipa-mincho.conf
Source31: 60-ipa-gothic.conf

BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: TrueType-ipafont
Requires: TrueType-ipafont-mincho = %{version}
Requires: TrueType-ipafont-gothic = %{version}
Requires: TrueType-ipafont-doc = %{version}

%description
This package is meta package to install both IPAMincho and IPAGothic
fonts.

%description -l ja
このパッケージは独立行政法人情報処理推進機構のIPAフォントの明朝、ゴシック
両書体をインストールするためのメタパッケージです。このパッケージで
以下の5書体がインストールされます。
(IPA明朝、IPAP明朝、IPAゴシック、IPAPゴシック)

%package mincho
Summary: IPAMincho TrueType Fonts
Summary(ja): IPA明朝 True Type フォント
Group: User Interface/X
Requires: TrueType-ipafont-doc

%description mincho
This package includes IPA Mincho TrueType fonts.

%description -l ja mincho
このパッケージには独立行政法人情報処理推進機構のIPA明朝フォントが含まれています。
(IPA明朝、IPAP明朝)

%package gothic
Summary: IPA Gothic TrueType Fonts
Summary(ja): IPA Gothic 日本語 True Type フォント
Group: User Interface/X
Requires: TrueType-ipafont-doc

%description gothic
This package includes IPA Gothic TrueType fonts.
This font is distributable without modification.
(see /usr/share/doc/TrueType-ipafont/enduser_license.txt for details)

%description -l ja gothic
このパッケージには独立行政法人情報処理推進機構のIPAゴシックフォントが含まれて
います。(IPAゴシック、IPAPゴシック)

%package doc
Summary: IPA Font Documents
Summary(ja): IPA フォントドキュメント
Group: User Interface/X

%description doc
This package includes important documents for IPA fonts includes enduser
license.

%description -l ja doc
このパッケージには独立行政法人情報処理推進機構のIPAフォントのライセンス
を含むドキュメント類が含まれています。

%prep
%setup -q -n IPAfont00303

%build

%install
mkdir -p $RPM_BUILD_ROOT%{_fontdir}
cp -a *.ttf $RPM_BUILD_ROOT%{_fontdir}
cp -f %{SOURCE10} %{SOURCE11} $RPM_BUILD_ROOT%{_fontdir}

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/fonts/conf.{avail,d}
install -m664 %{SOURCE30} %{SOURCE31} $RPM_BUILD_ROOT/%{_sysconfdir}/fonts/conf.avail/
for i in $RPM_BUILD_ROOT/%{_sysconfdir}/fonts/conf.avail/*.conf
do
  ln -sf ../conf.avail/$(basename $i) $RPM_BUILD_ROOT/%{_sysconfdir}/fonts/conf.d/
done

# install ghostscript8 cidfmap 
mkdir -p $RPM_BUILD_ROOT%{_datadir}/ghostscript/conf.d
install -m644 %{SOURCE20} %{SOURCE21} $RPM_BUILD_ROOT%{_datadir}/ghostscript/conf.d

# add fontpath.d symlinks
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11/fontpath.d
ln -sf /usr/share/fonts/%{name} $RPM_BUILD_ROOT%{_sysconfdir}/X11/fontpath.d/

%clean
if test -n "${RPM_BUILD_ROOT}" && test "/" != "${RPM_BUILD_ROOT}"; then
    rm -rf ${RPM_BUILD_ROOT}
fi

%post mincho
%__font_install_post %{_fontdir}

%post gothic
%__font_install_post %{_fontdir}

%postun mincho
%__font_install_postun %{_fontdir}

%postun gothic
%__font_install_postun %{_fontdir}

%files

%files doc
%doc *.txt

%files mincho
%{_fontdir}/ipam*.ttf
%{_fontdir}/ipafont-mincho.ttfconf
%config %{_datadir}/ghostscript/conf.d/cidfmap.ja.ipafont-mincho
%{_sysconfdir}/fonts/conf.avail/*-ipa-mincho.conf
%{_sysconfdir}/X11/fontpath.d/%{name}
%config(missingok,noreplace) %{_sysconfdir}/fonts/conf.d/*-ipa-mincho.conf

%files gothic
%{_fontdir}/ipag*.ttf
%{_fontdir}/ipafont-gothic.ttfconf
%config %{_datadir}/ghostscript/conf.d/cidfmap.ja.ipafont-gothic
%{_sysconfdir}/fonts/conf.avail/*-ipa-gothic.conf
%config(missingok,noreplace) %{_sysconfdir}/fonts/conf.d/*-ipa-gothic.conf


%changelog
* Sun Nov 20 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 3.03-1
- update to IPAfont 00303

* Fri Sep 24 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 3.02-1
- update to IPAfont 00302
- update ttfconf/cidfmap

* Mon Aug 24 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 3.01-3
- add fontpath.d symlink

* Wed Jun 03 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 3.01-2
- use fixed width font for ghostscript.

* Wed Apr 22 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 3.01-1
- update to IPAfont 00301
  - drop IPAUIGothic
- update License tag
  - OSI approved license 'IPA Font License Agreement v1.0'
- add fontconfig file

* Thu Jan 08 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01-2
- fix typo in cidfmap.ja.ipafont
- update vine.map and exec updmap-sys on %%post/%%postun

* Wed Oct 29 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01-1
- add gs8 cidfmap
- move font files to new location
- new versioning policy, spec in utf-8

* Fri Jan 11 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01-0vl2
- remove Provides: TrueTypeFonts_jp
  - ipa*font is not free and should not be default font.

* Mon Oct 01 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01-0vl1
- initial build with new ipafont license
- sprit mincho and gothic as an independent package
- sprit readme and license to doc package
- drop M+IPA font which is not allowed by new enduser license.
