1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/bin/bash
# Subsetting DejaVu fonts to create a display-math-only font
# The DejaVu fonts include math display variants outside of the Unicode range,
# and it is currently hard to access them from matplotlib. The subset.py script
# in `tools` has been modified to move the math display variants found in DejaVu
# fonts into a new TTF font with these variants in the Unicode range.
# This bash script calls the subset.py scripts with the appropriate options to
# generate the new font files `DejaVuSansDisplay.ttf` and
# `DejaVuSerifDisplay.ttf`:
mpldir=$(dirname $0)/../
# test that fontforge is installed
python -c 'import fontforge' 2> /dev/null
if [ $? != 0 ]; then
echo "The python installation at $(which python) does not have fontforge"
echo "installed. Please install it before using subset.py."
exit 1
fi
FONTDIR=$mpldir/lib/matplotlib/mpl-data/fonts/ttf/
python $mpldir/tools/subset.py --move-display --subset=dejavu-ext $FONTDIR/DejaVuSans.ttf \
$FONTDIR/DejaVuSansDisplay.ttf
python $mpldir/tools/subset.py --move-display --subset=dejavu-ext $FONTDIR/DejaVuSerif.ttf \
$FONTDIR/DejaVuSerifDisplay.ttf
|