diff --git a/test b/test index 9488c89..3d2e28a 100755 --- a/test +++ b/test @@ -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 <> 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)