#!/bin/sh
# url: http://pank.org/scripts/
# description: Microsoft Jhenghei font install script for Linux X
# comment: csh bash
# platform: linux

if ! which cabextract > /dev/null 2>&1 ; then
    echo Please intall cabextract first
    exit 1
fi

cd /tmp
if [ ! -f VistaFont_CHT.EXE ] ; then
    wget http://download.microsoft.com/download/7/6/b/76bd7a77-be02-47f3-8472-fa1de7eda62f/VistaFont_CHT.EXE
fi

cabextract VistaFont_CHT.EXE
mv msjh.ttf msjhbd.ttf /usr/share/fonts
fc-cache -fv

if fc-list | grep -q JhengHei ; then
    echo Install JhengHei font successfully.
else
    echo Install JhengHei font failed.
fi