# Template file for 'dina-font'
pkgname=dina-font
version=2.93
revision=3
create_wrksrc=yes
hostmakedepends="bdftopcf font-util unzip"
depends="font-util"
short_desc="Monospace bitmap font, primarily aimed at programmers"
maintainer="Lee Wang <lee.wang.gretzky@gmail.com>"
license="custom:Dina"
homepage="http://www.donationcoder.com/Software/Jibz/Dina/index.html"
distfiles="http://ftp.osuosl.org/pub/gentoo/distfiles/dina-${version}.zip"
checksum=47792817b7716577727a488952b9892b16966a45dc3ba52e026d59b9d9e20695
font_dirs="/usr/share/fonts/X11/misc"

_ex_pt() {
	_pt=${1%.bdf}
	_pt=${_pt#*-}
	echo $_pt
}

do_install() {
	cd BDF
	sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf
	for i in Dina_i400-*.bdf; do
		bdftopcf -t -o DinaItalic$(_ex_pt $i).pcf $i
	done
	for i in Dina_i700-*.bdf; do
		bdftopcf -t -o DinaBoldItalic$(_ex_pt $i).pcf $i
	done
	for i in Dina_r400-*.bdf; do
		bdftopcf -t -o DinaMedium$(_ex_pt $i).pcf $i
	done
	for i in Dina_r700-*.bdf; do
		bdftopcf -t -o DinaBold$(_ex_pt $i).pcf $i
	done
	for i in *.pcf; do
		gzip "$i"
	done

	vmkdir usr/share/fonts/X11/misc
	install -m644 *.pcf.gz ${DESTDIR}/usr/share/fonts/X11/misc
	vlicense ../LICENSE
}
