# Command macros
%define __mkfontdir     umask 133;/usr/bin/mkfontdir
%define __mkfontscale   umask 133;/usr/bin/mkfontscale
# Use this macro to call fc-cache throughout the specfile.
%define __fccache       umask 133;which fc-cache &> /dev/null && fc-cache -f

%define version 4.2
%define release 1%{?_dist_release}
%define sazanami_date 20040629-vl-20061231
%define ttfjp_version 6.0

%define xfontdir %{_datadir}/fonts/TrueType-sazanami
%define fontpathdir %{_sysconfdir}/X11/fontpath.d

Summary: Free Japanese True Type Font (Sazanami)
Summary(ja): フリーの日本語 True Type フォント(さざなみ明朝/さざなみゴシック)
Name: TrueType-sazanami
Version: %{version}
Release: %{release}
BuildArch: noarch

PreReq: TrueType-base >= 4.4.1
Requires: TrueType-base >= 4.4.1
Provides: TrueTypeFonts_jp = %{ttfjp_version}

Obsoletes: TrueTypeFonts_jp < 4.1
Obsoletes: TrueType-kochi <= 4.4.1
Provides: TrueType-kochi = %{ttfjp_version}

Requires: %{name}-mincho = %{version}-%{release}
Requires: %{name}-gothic = %{version}-%{release}

# This is not really required, but usefull to upgrade.
Requires: TrueType-vlgothic

Source: %{name}.tar.bz2
Source10: 60-sazanami-mincho.conf
Source11: 60-sazanami-gothic.conf

Source20: cidfmap.ja.sazanami-mincho
Source21: cidfmap.ja.sazanami-gothic

# Sazanami Font Family
Source4: sazanami-%{sazanami_date}.tar.bz2

License: distributable
Group: User Interface/X
Buildroot: %{_tmppath}/%{name}-root

Distribution: Vine Linux
Vendor: Project Vine

%description
This is meta package for Free Japanese True Type Font 'Sazanami Font'
- Sazanami-Mincho
- Sazanami-Gothic

%description -l ja
このパッケージはフリーの日本語 True Type フォント「さざなみフォント」
の明朝、ゴシック両書体をインストールするためのメタパッケージです。この
パッケージで以下のフォントがインストールされます。
- さざなみ明朝
- さざなみゴシック

%package mincho
Summary: Sazanami Mincho TrueType Fonts
Summary(ja): さざなみ明朝 True Type フォント
Group: User Interface/X
Requires(post,postun): mktcapdir >= 0.5.4
Requires(post,postun): fontconfig, xorg-x11-font-utils

%description mincho
This package includes Sazanami Mincho TrueType fonts.

%description -l ja mincho
このパッケージにはさざなみ明朝フォントが含まれています。

%package gothic
Summary: Sazanami Gothic TrueType Fonts
Summary(ja): さざなみゴシック 日本語 True Type フォント
Group: User Interface/X
Requires(post,postun): mktcapdir >= 0.5.4
Requires(post,postun): fontconfig, xorg-x11-font-utils

%description gothic
This package includes Sazanami Gothic TrueType fonts.

%description -l ja gothic
このパッケージにはさざなみゴシックフォントがふくまれています。

%prep
rm -rf ${RPM_BUILD_ROOT}

%setup -n %{name} -a 4
mv sazanami-%{sazanami_date}/* .

%install

# mkdir fontdirs
mkdir -p $RPM_BUILD_ROOT/%{xfontdir}-{mincho,gothic}
# install ttfconf
install -m644 *-mincho.ttfconf *-mincho.ttf $RPM_BUILD_ROOT/%{xfontdir}-mincho
install -m644 *-gothic.ttfconf *-gothic.ttf $RPM_BUILD_ROOT/%{xfontdir}-gothic
# install fonts
ln -sf sazanami-mincho.ttf $RPM_BUILD_ROOT/%{xfontdir}-mincho/kochi-mincho.ttf
ln -sf sazanami-gothic.ttf $RPM_BUILD_ROOT/%{xfontdir}-gothic/kochi-gothic.ttf

# install fontpath.d symlink
mkdir -p $RPM_BUILD_ROOT/%{fontpathdir}
ln -sf %{xfontdir}-mincho $RPM_BUILD_ROOT/%{fontpathdir}/%{name}-mincho
ln -sf %{xfontdir}-gothic $RPM_BUILD_ROOT/%{fontpathdir}/%{name}-gothic

# install fontconfig files
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/fonts/conf.{avail,d}
install -m644 %{SOURCE10} %{SOURCE11} $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


%post mincho
%{_bindir}/mktcapdir %{xfontdir}-mincho %{xfontdir}-mincho/*.ttfconf
( %__fccache %{xfontdir}-mincho ) ||:

%post gothic
%{_bindir}/mktcapdir %{xfontdir}-gothic %{xfontdir}-gothic/*.ttfconf
( %__fccache %{xfontdir}-gothic ) ||:

%postun mincho
%{_bindir}/mktcapdir %{xfontdir}-mincho %{xfontdir}-mincho/*.ttfconf
( %__fccache %{xfontdir}-mincho ) ||:

%postun gothic
%{_bindir}/mktcapdir %{xfontdir}-gothic %{xfontdir}-gothic/*.ttfconf
( %__fccache %{xfontdir}-gothic ) ||:

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README doc/

%files mincho
%defattr(-,root,root)
%{xfontdir}-mincho/*
%{fontpathdir}/%{name}-mincho
%{_sysconfdir}/fonts/conf.avail/60-sazanami-mincho.conf
%config(missingok,noreplace) %{_sysconfdir}/fonts/conf.d/60-sazanami-mincho.conf
%config %{_datadir}/ghostscript/conf.d/cidfmap.ja.sazanami-mincho

%files gothic
%defattr(-,root,root)
%{xfontdir}-gothic/*
%{fontpathdir}/%{name}-gothic
%{_sysconfdir}/fonts/conf.avail/60-sazanami-gothic.conf
%config(missingok,noreplace) %{_sysconfdir}/fonts/conf.d/60-sazanami-gothic.conf
%config %{_datadir}/ghostscript/conf.d/cidfmap.ja.sazanami-gothic

%changelog
* Wed Oct 29 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 4.2-1
- add gs8 cidfmap for sazanami

* Sat Jun 07 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1-1
- split mincho and gothic to its own fontdir
- add fontpath.d symlink

* Thu May 22 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 4.0-1
- build for xorg-x11-7.3
  - change font location to %{_datadir}/fonts/TrueType-sazanami
  - require(post,postun) fontconfig and xorg-x11-font-utils
- split to TrueType-sazanami-mincho and TrueType-sazanami-gothic

* Sat Sep 15 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 3.0-0vl1
- split out VLGothic to TrueType-vlgothic package.

* Sat Sep 01 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.10-0vl1
- update VLGothic to 20070901
  - update some kanji glyphs

* Thu Aug 30 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.9-0vl1
- update VLGothic to 20070830
  - update M+1C/M+1M to CVS head
  - update some kanji glyphs

* Mon Jul 31 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.8-0vl1
- update VLGothic to 20070731
  - update M+1C/M+1M to CVS head
  - add new glyphs to VL-PGothic/VL-Gothic
    - add Roman Numeral Glyphs (some part of Number Forms)
    - update some glyphs

* Mon May 07 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.7-0vl1
- update VLGothic to 20070507
  - add new glyphs to VL-Gothic
    - add ISO8859-1 Glyphs (Latin-1 Supplement)
    - add ISO8859-15 Glyphs (some part of Latin Extended-A)

* Sun May 06 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6-0vl1
- update VLGothic to 20070506
  - add new glyphs to VL-PGothic
    - add ISO8859-1 Glyphs (Latin-1 Supplement)
    - add ISO8859-15 Glyphs (some part of Latin Extended-A)

* Thu May 03 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5-0vl1
- update VLGothic to 20070503
  - update M+1C/1M to CVS head

* Wed Mar 28 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4-0vl1
- update VLGothic to 20070328
  - update M+1C/1M to CVS head
  - fix embolden problem on freetype-2.2

* Sat Mar 17 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3-0vl1
- update VLGothic to 20070317
  - update M+1C/1M to CVS head
    - include M+ Kanji glyphs
  - update some glyphs
  - add some special sign characters
  - fix broken glyphs

* Mon Jan 01 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2-0vl1
- update VLGothic to 20070101
  - fix embolden problem on freetype-2.2

* Sun Dec 31 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1-0vl1
- update VLGothic to 20061231
  - update M+1C/M+1M to cvs head 20061231
  - update kanji glyphs
- update Sazanami to 20040629-vl-20061231
  - fix broken glyphs of sazanami-mincho

* Sat Oct 21 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0-0vl1
- bump up version to 2.0
- update VLGothic to 20061026
  - update greek letter glyphs
  - split license information file from README.
  - add english version of license.

* Sat Oct 21 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.29-0vl1
- update VLGothic to 20061021

* Fri Oct 20 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.28-0vl1
- update VLGothic to 20061020 (<BTS:221>)
  - update M+1C/M+1M to TESTFILGHT012
  - update some glyphs
  - fix outline direction
  - remove overlap path

* Thu Oct 05 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.27-0vl1
- update VLGothic to 20061005 (<BTS:221>)
  - update some glyphs
  - fix outline direction
  - remove overlap path

* Sat Sep 30 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.26-0vl1
- update VLGothic to 20060930 (<BTS:221>)
  - fix outline direction
  - remove overlap path

* Fri Sep 29 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.25-0vl1
- update VLGothic to 20060929
  - update some glyphs
  - fix outline direction
  - remove overlap path

* Mon Sep 25 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.24-0vl1
- update VLGothic to 20060925
  - update some glyphs
  - add minimum gsub table for vertical writing

* Thu Sep 21 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.23-0vl1
- update VLGothic to 20060921
  - update few glyphs
  - update M+1C/M+1M to cvs head 2006/09/21

* Wed Sep 13 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.22-0vl1
- update VLGothic to 20060913
  - update some glyphs
  - fix half width space

* Mon Sep 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.21-0vl1
- update VLGothic to 20060911
  - update M+1C/M+1M to cvs head 2006/09/11
- use VL-PGothic for -alias-gothic-p- (legacy core font)

* Thu Aug 31 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.20-0vl1
- update VLGothic to 20060831
  - add VL-Gothic-Regular.ttf for 
  - use M+1C for VLPGothic instead of M+1P

* Mon Aug 28 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.19-0vl1
- fix sazanami.ttfconf

* Tue Aug 22 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.18-0vl1
- change the fontname to VLPGothic
- update VLPGothic
- TODO:
  - split VLGothic family to new package.
  - add M+1M based VLGothic for monospace font. 

* Wed Aug 15 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.17-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs

* Wed Aug 09 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.16-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - add some glyphs for windows compatibility
- update sazanami.ttfconf
  - add -fake-kochi gothic-, -fake-kochi mincho- without TTCap
    for Flash Plugin. (<BTS:0100>)

* Fri Aug 04 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.15-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - add new full-width alphabets and numeric letters based on M+1P

* Mon Jul 31 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.14-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs

* Sun Jul 30 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.13-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - redesign greek letter based on M+ 1P fonts

* Thu Jul 27 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.12-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs

* Sun Jul 23 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.11-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs

* Fri Jul 21 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.10-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - fix encoding

* Thu Jul 20 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.9-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - fix outline direction (fix corruption on emboldening)

* Wed Jul 19 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.8-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - fix broken glyph
  - refine greek letters

* Tue Jul 18 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.7-0vl1
- update M+1P+Sazanami.ttf
  - refine more glyphs
  - TODO: should rename the fontname?

* Sun Jul 16 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.6-0vl1
- update M+1P+Sazanami.ttf
  - fix outline direction (fix corruption of some glyphs)
  - refine more glyphs

* Wed Jul 12 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5-0vl1
- update M+1P+Sazanami.ttf
  - refine some glyphs.. (modified 200 or more)
- update sazanami.ttfconf to use M+1P+Sazanami for alias-{sans,gothic}-p

* Mon Jul 10 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4-0vl1
- update M+1P+Sazanami.ttf
  - refine some glyphs.. (modified 100 or more)

* Mon Jul 10 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3-0vl1
- update M+1P-Sazanami.ttf
  - fix corruption of some glyphs
  - refine some glyphs to make it more usable..

* Thu May 11 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2-0vl1
- add M+1P+Sazanami.ttf (Mplus 1P Font + Sazanami Gothic)

* Mon Nov 08 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1-0vl1
- new upstream release

* Wed Jun 16 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0-0vl1
- initial build for Vine Linux based on TrueType-kochi-subst package
- Provides TrueType-kochi, TrueTypeFonts_jp
- include Kochi-{mincho,gothic}.ttf symlinks for compatibility
