#!/bin/bash

# =====================================
# Generate Fonts
# =====================================

python make_font.py -u *.svg
mkeot RichStyle.ttf > RichStyle.eot
mv -u RichStyle* ../src/usr/share/fonts/truetype/richstyle 
mv -u ../src/usr/share/fonts/truetype/richstyle/RichStyle.sfd ../

# =====================================
# Build Copyright Document
# =====================================

# Generate characters database
./get_char_db.sh > char_db.txt
sed -f ../input/Metadata_Graber.map char_db.txt > ../copyright.body
rm char_db.txt

# Generate characters database report
cd ../
cat "input/copyright.header" "copyright.body" "input/copyright.footer" > "copyright.web"
rm copyright.body
mv -u copyright.web src/usr/share/doc/fonts-richstyle

# =====================================
# Build Package
# =====================================

tar -cf fonts-richstyle_0.5.tar src/usr/share/doc/ SVGs/ input/
dpkg-deb -b src fonts-richstyle_0.5.deb

# =====================================
# Preview
# =====================================

chromium-browser src/usr/share/doc/fonts-richstyle/copyright.web
gdebi-gtk fonts-richstyle_0.5.deb

