# Maintainer: Roman Kyrylych <Roman.Kyrylycg@gmail.com>
# Contributor: Darwin Bautista <djclue917@gmail.com>

pkgname=font-mathematica
pkgver=6.0
pkgrel=1
pkgdesc="Mathematica fonts by Wolfram Research, Inc."
arch=('i686' 'x86_64')
url="http://support.wolfram.com/mathematica/systems/windows/general/latestfonts.html"
depends=('fontconfig' 'xorg-font-utils')
makedepends=('unzip')
conflicts=('ttf-mathematica')
replaces=('ttf-mathematica')
install=font.install
license=('custom')
source=(http://support.wolfram.com/mathematica/systems/windows/general/files/MathFonts_${pkgver}.zip
        license.txt)
md5sums=('f97df8a304d3c17c4137bb963f8cbe9e'
         '4d95629d78541826cb543764c8025c0b')

build() {
  cd ${startdir}/src/Fonts/

  # Install TrueType fonts
  mkdir -p ${startdir}/pkg/usr/share/fonts/TTF
  install -m644 TrueType/*.ttf ${startdir}/pkg/usr/share/fonts/TTF/

  # Install Type1 fonts
  mkdir -p ${startdir}/pkg/usr/share/fonts/Type1
  install -m644 Type1/*.pfa ${startdir}/pkg/usr/share/fonts/Type1/

  # Remove unnecessary Type1 fonts
  rm ${startdir}/pkg/usr/share/fonts/Type1/{UT*,cour*,c06*}

  # Remove SVG files
  rm -rf ${startdir}/pkg/usr/share/fonts/SVG

  # Install license
  install -D -m644 ${startdir}/src/license.txt ${startdir}/pkg/usr/share/licenses/${pkgname}/license.txt
}