support otf fonts and symlinks to font dirs

This commit is contained in:
Jaromil 2014-05-11 22:24:25 +02:00
parent 94fd016d9a
commit fc31cc4db9
1 changed files with 20 additions and 1 deletions

21
test
View File

@ -32,12 +32,16 @@ cp $DIR/css/jquery.sidr.dark.css test/css
fonts=('Arial' 'Arial Black' 'Comic Sans MS' 'Courier New' 'Georgia' 'Impact' 'Monaco' 'Lucida Grande')
fonts+=('Book Antiqua' 'Tahoma' 'Times New Roman' 'Trebuchet MS' 'Verdana' 'Geneva' 'New York')
custom_fonts=()
total_fonts=${#fonts}
# string match case insensitive
unsetopt CASE_GLOB
# if there are custom fonts add them
{ test -d fonts } && {
notice "Indexing custom fonts"
rm -f test/css/custom.fonts.css
mkdir -p test/fonts
ttf=`find fonts -name '*.ttf'`
ttf=`find -L fonts -iname '*.ttf'`
for f in ${(f)ttf}; do
ffile=`basename "$f"`
cp "$f" test/css/"$ffile"
@ -46,7 +50,22 @@ custom_fonts=()
@font-face { font-family: '${ffile%.ttf}';
src: url('$ffile') format('truetype'); }
EOF
total_fonts=$(( $total_fonts + 1 ))
done
otf=`find -L fonts -iname '*.otf'`
for f in ${(f)otf}; do
ffile=`basename "$f"`
cp "$f" test/css/"$ffile"
custom_fonts+=("${ffile%.otf}")
cat <<EOF >> test/css/custom.fonts.css
@font-face { font-family: '${ffile%.otf}';
src: url('$ffile') format('opentype'); }
EOF
total_fonts=$(( $total_fonts + 1 ))
done
act "$total_fonts custom fonts indexed"
}
fonts=($custom_fonts $fonts)