# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=ttf-droid
pkgver=20121017
pkgrel=0
pkgdesc="General-purpose fonts released by Google as part of Android."
url="http://code.google.com/android/"
arch="noarch"
license="Apache"
depends="fontconfig"
depends_dev=""
makedepends="$depends_dev"
install=""
subpackages="$pkgname-nonlatin"
# added fontconfig configuration from:
# https://github.com/bohoomil/fontconfig-ultimate/tree/master/fontconfig_patches/fonts-settings
source="http://dev.alpinelinux.org/archive/android-fonts/android-fonts-4.2.2_r1.2.tar.gz
	http://www.cosmix.org/software/files/DroidSansMonoSlashed.zip
	http://www.cosmix.org/software/files/DroidSansMonoDotted.zip
	45-droid.conf
	65-ttf-droid-sans.conf
	65-ttf-droid-serif.conf
	90-tt-droid.conf"

_builddir="$srcdir"

build() {
	cd "$_builddir"
}

package() {
	mkdir -p "$pkgdir"/usr/share/fonts/$pkgname \
		"$pkgdir"/etc/fonts/conf.avail \
		"$pkgdir"/etc/fonts/conf.d

	local fonts="DroidSerif-Bold.ttf DroidSerif-BoldItalic.ttf
		DroidSerif-Italic.ttf DroidSerif-Regular.ttf DroidSans-Bold.ttf
		DroidSans.ttf DroidSansMono.ttf"

	for i in $fonts; do
		install -m644 "$srcdir"/"$i" \
			"$pkgdir"/usr/share/fonts/$pkgname/ || return 1
	done

	for j in "$srcdir"/*.conf; do
		install -m644 "$j" \
			"$pkgdir"/etc/fonts/conf.avail/ || return 1
		cd "$pkgdir"/etc/fonts/conf.d
		ln -sf /etc/fonts/conf.avail/${j##*/}
	done
}

nonlatin() {
	pkgdesc="General-purpose fonts released by Google as part of Android. Non-Latin language support"
	local fonts="DroidKufi-Bold.ttf DroidKufi-Regular.ttf DroidNaskh-Bold.ttf
		DroidNaskh-Regular-SystemUI.ttf DroidNaskh-Regular.ttf
		DroidSansArabic.ttf DroidSansArmenian.ttf
		DroidSansDevanagari-Regular.ttf DroidSansEthiopic-Bold.ttf
		DroidSansEthiopic-Regular.ttf DroidSansFallback.ttf
		DroidSansFallbackFull.ttf DroidSansFallbackLegacy.ttf
		DroidSansGeorgian.ttf DroidSansHebrew-Bold.ttf
		DroidSansHebrew-Regular.ttf DroidSansJapanese.ttf
		DroidSansTamil-Bold.ttf DroidSansTamil-Regular.ttf
		DroidSansThai.ttf"

	mkdir -p "$subpkgdir"/usr/share/fonts/$subpkgname

	for k in $fonts; do
		install -m644 "$srcdir"/"$k" \
			"$subpkgdir"/usr/share/fonts/$subpkgname/ || return 1
	done
}

md5sums="452f913d7a2e20531e6b1fd5a853cb2d  android-fonts-4.2.2_r1.2.tar.gz
4df780cb87f2931233123117feac5e2c  DroidSansMonoSlashed.zip
76a1c759e328ac15fd0d33ee9a4b3723  DroidSansMonoDotted.zip
9770abd2fdec8ea017a9f470675bbbee  45-droid.conf
fed88344a324212a8f942fa82b1d2262  65-ttf-droid-sans.conf
8bbfbb6498aa4bfbcbf92c54fe9dcc34  65-ttf-droid-serif.conf
c508aafa4130028a67cf3c085d0dbef1  90-tt-droid.conf"
sha256sums="06d48cbaa60b4c99e590f8d35d259304baa742852e6077c50be49c523c316b10  android-fonts-4.2.2_r1.2.tar.gz
71768814dc4de0ea6248d09a2d2285bd47e9558f82945562eb78487c71348107  DroidSansMonoSlashed.zip
43421e46a771a739177065025fc400db220465a3ca6fa51f27153c68787650e4  DroidSansMonoDotted.zip
67ea88143fe8602f85c3e944505104aacf140eb52d46317933306dca0e0a43cc  45-droid.conf
cf97dd67780b65931dd5f10dabba961c9e11315c0e743177f8ad17269ca00769  65-ttf-droid-sans.conf
6256741621cb377b8d786e130fec11eb58bf245f486a0219bf9c7f15b4db805c  65-ttf-droid-serif.conf
ee7219ba1e75e71fe688fbb6941a40d27300d34776332b4561a0d020ec0e6c41  90-tt-droid.conf"
sha512sums="63ebea1be1dc1335ccc019b7d72aa54376985a93a0ce83a0c496895a77974c3ba440bf9a4d7196aa1c9d82b967895587ee5512ca7a74370e92fbe913778f974a  android-fonts-4.2.2_r1.2.tar.gz
e279c650e18f5e3db462c016fd93516442e5bfbe92580e51b6759cfc19e3f81fbd7e262b1a521ecce6c5c4aa3c8e0687d3b00e1ecb46784a090b9fd92d01aa25  DroidSansMonoSlashed.zip
cc891348632480dbf52f1d515059416bddf8433103904e4e6954b52089f7b736ed6b2c917d0f4d3f32348805a939aea1e5e014271c6aaf672c5800021039ffe3  DroidSansMonoDotted.zip
96ddb50da19f4219544384417f9b8491e3e02ee1d922f475b2bcf13c38256d5ae0fc10b81e4d10ad0b6553430bf156e82ca2a7811b8e2a9c92bde2058e85c517  45-droid.conf
07d4ab208c1c1dd4fe04f113daa5cb6361cf042eedade643f714b91ab77d3e1fa39f72db7b63cfcb8b69343e2f258920206d0f2ba204574f57292088e3a6e126  65-ttf-droid-sans.conf
5257da5537202e742afb168dda000b41873cde45e49807546c3c09aca92fe2c83264a19c2f1835e449ef9c943bf0fdfa1d4020ec93d9b4ff9e505dc4cb7e2464  65-ttf-droid-serif.conf
5ab9cb21e871be887060620061bafaf826cafca71fac8f58d6e63ea5be3af282ab138fbecc38ca3d4c48d58720bec407e179f804747b6c35c69b825d06ef035a  90-tt-droid.conf"
