Name:           google-droid-fonts
Version:        20120715
Release:        15
Summary:        A font family for Android

License:        ASL 2.0
URL:            https://android.googlesource.com/
Source0:        %{name}-%{version}.tar.xz
# Source1 to Source9 get from fedora
Source1:        getdroid.sh
Source2:        %{name}-sans-fontconfig.conf
Source3:        %{name}-sans-mono-fontconfig.conf
Source4:        %{name}-serif-fontconfig.conf
Source5:        %{name}-kufi-fontconfig.conf
Source6:        google-droid-sans.metainfo.xml
Source7:        google-droid-sans-mono.metainfo.xml
Source8:        google-droid-serif.metainfo.xml
Source9:        google-droid-kufi.metainfo.xml

BuildArch:      noarch
BuildRequires:  fontpackages-devel

%description
Droid is a font family, it was created by Ascender in 2007. It licensed the Open Handheld Alliance with an Apache
license. The Droid is designed for use on small screen devices, the designer is Steve Matteson, named after the Open
Handset Alliance's smart system Android.

%package        -n google-droid-sans-fonts
Summary:        A humanized font
Requires:       fontpackages-filesystem
Obsoletes:      %{name}-common <= 20090906-5.fc12

%description    -n google-droid-sans-fonts
Droid Sans contains a subset of multiple text systems. The Chinese character subset and the Latin alphabet subset
are juxtaposed, but because the Latin alphabet is the most basic character and the characters are few, it is placed
in the main file, while the Chinese character is a single file, and the Japanese and other text systems also stand alone.

%_font_pkg -n sans -f ??-google-droid-sans.conf DroidSans*ttf
%doc README.txt NOTICE
%{_datadir}/appdata/google-droid-sans.metainfo.xml

%package        -n google-droid-sans-mono-fonts
Summary:        A humanized font
Requires:       fontpackages-filesystem

%description    -n google-droid-sans-mono-fonts
Droid Sans Mono is a humanist font which contains a subset of multiple text systems.

%_font_pkg -n sans-mono -f ??-google-droid-sans-mono.conf DroidSansMono.ttf
%doc README.txt NOTICE
%{_datadir}/appdata/google-droid-sans-mono.metainfo.xml

%package        -n google-droid-serif-fonts
Summary:        A contemporary serif typeface
Requires:       fontpackages-filesystem
Provides:       google-droid-naskh-fonts = %{version}-%{release}

%description    -n google-droid-serif-fonts
Droid Serif is a contemporary serif typeface family designed for comfortable reading on screen. Droid Serif is slightly
condensed to maximize the amount of text displayed on small screens.

%_font_pkg -n serif -f ??-google-droid-serif.conf DroidSerif*ttf DroidNaskh*ttf
%doc README.txt NOTICE
%{_datadir}/appdata/google-droid-serif.metainfo.xml

%package        -n google-droid-kufi-fonts
Summary:        An Arabic type designed for use in Google products such as Google ChromeOS and Android
Requires:       fontpackages-filesystem google-droid-kufi-fonts

%description    -n google-droid-kufi-fonts
Droid Arabic Kufi is an Arabic type designed for use in Google products. Designed to complement the Latin, Greek and Cyrillic
provided in the Droid Sans family, the Arabic matches the color, alignment and design detail of the Droid Sans allowing them
to be used together for multi-lingual typesetting.

%_font_pkg -n kufi -f ??-google-droid-kufi.conf DroidKufi*ttf
%{_datadir}/appdata/google-droid-kufi.metainfo.xml

%prep
%autosetup -p1

%build

%install
rm -f ${RPM_BUILD_ROOT}%{_fontdir}/DroidSansMono*ttf

mkdir -p %{buildroot}%{_fontdir}
chmod 755 %{buildroot}%{_fontdir}
install -m 0644 -p $(ls *ttf | grep -v DroidSansFallbackFull | grep -v DroidSansFallbackLegacy\
                    | grep -v DroidNaskh-Regular-SystemUI) %{buildroot}%{_fontdir}

mkdir -p %{buildroot}%{_fontconfig_templatedir}
mkdir -p %{buildroot}%{_fontconfig_confdir}
chmod 755 %{buildroot}%{_fontconfig_templatedir}
chmod 755 %{buildroot}%{_fontconfig_confdir}

install -m 0644 -p %{SOURCE2} %{buildroot}%{_fontconfig_templatedir}/65-google-droid-sans.conf
install -m 0644 -p %{SOURCE3} %{buildroot}%{_fontconfig_templatedir}/60-google-droid-sans-mono.conf
install -m 0644 -p %{SOURCE4} %{buildroot}%{_fontconfig_templatedir}/65-google-droid-serif.conf
install -m 0644 -p %{SOURCE5} %{buildroot}%{_fontconfig_templatedir}/65-google-droid-kufi.conf

for fontconf in 65-google-droid-sans.conf 60-google-droid-sans-mono.conf 65-google-droid-serif.conf \
                65-google-droid-kufi.conf ; do
  ln -s %{_fontconfig_templatedir}/$fontconf %{buildroot}%{_fontconfig_confdir}/$fontconf
done

mkdir -p %{buildroot}%{_datadir}/appdata

cp %{SOURCE6} %{buildroot}%{_datadir}/appdata/
cp %{SOURCE7} %{buildroot}%{_datadir}/appdata/
cp %{SOURCE8} %{buildroot}%{_datadir}/appdata/
cp %{SOURCE9} %{buildroot}%{_datadir}/appdata/

chmod 644 %{buildroot}%{_datadir}/appdata/google-droid-sans.metainfo.xml
chmod 644 %{buildroot}%{_datadir}/appdata/google-droid-sans-mono.metainfo.xml
chmod 644 %{buildroot}%{_datadir}/appdata/google-droid-serif.metainfo.xml
chmod 644 %{buildroot}%{_datadir}/appdata/google-droid-kufi.metainfo.xml

touch %{buildroot}%{_datadir}/appdata/google-droid-sans.metainfo.xml
touch %{buildroot}%{_datadir}/appdata/google-droid-sans-mono.metainfo.xml
touch %{buildroot}%{_datadir}/appdata/google-droid-serif.metainfo.xml
touch %{buildroot}%{_datadir}/appdata/google-droid-kufi.metainfo.xml

%changelog
* Tue Sep 17 2019 dongjian <dongjian13@huawei.com> - 20120715-15
- Package init
