From 94fd016d9a0d56333ec9b0f0963e882d901f8189 Mon Sep 17 00:00:00 2001 From: Jaromil Date: Sun, 11 May 2014 22:00:46 +0200 Subject: [PATCH] support for custom font family tests --- test | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 103 insertions(+), 11 deletions(-) diff --git a/test b/test index abf5822..9488c89 100755 --- a/test +++ b/test @@ -25,6 +25,32 @@ source ${DIR}/render source # Main mkdir -p test +mkdir -p test/css +# side menu stylesheet +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=() + +# if there are custom fonts add them +{ test -d fonts } && { + rm -f test/css/custom.fonts.css + mkdir -p test/fonts + ttf=`find fonts -name '*.ttf'` + for f in ${(f)ttf}; do + ffile=`basename "$f"` + cp "$f" test/css/"$ffile" + custom_fonts+=("${ffile%.ttf}") + cat <> test/css/custom.fonts.css + @font-face { font-family: '${ffile%.ttf}'; + src: url('$ffile') format('truetype'); } +EOF + done +} + +fonts=($custom_fonts $fonts) + # render all HTML views htmls=(`find views -type f -name '*.html'`) for src in $htmls; do @@ -40,6 +66,7 @@ for src in $htmls; do cat <> $dst + @@ -71,17 +98,73 @@ cat <> $dst
-

Design test

-

Font size

- +

Design test

+EOF -

Font family

-" +} + + +cat <> $dst +

Brand font family

+EOF +font-family_select brand-font-family >> $dst + +cat <> $dst +

Header font family

+EOF +font-family_select header-font-family >> $dst + +cat <> $dst +

Body font family

+EOF +font-family_select body-font-family >> $dst + +cat <> $dst +

Navigation Font family

+EOF +font-family_select nav-font-family >> $dst + + +cat <> $dst
@@ -94,7 +177,17 @@ cat <> $dst }); }); \$('#h1size').change(function() { \$('h1').css('font-size', \$('#h1size').val() + "em" ); }) -\$('#headerfamily').change(function(){ \$('h1').css('font-family', \$('#headerfamily').val() ); }) +\$('#h2size').change(function() { \$('h2').css('font-size', \$('#h2size').val() + "em" ); }) + +\$('#brand-font-family').change(function(){ \$('.navbar .brand').css('font-family', \$('#brand-font-family').val() ); }) + +\$('#header-font-family').change(function(){ \$('h1').css('font-family', \$('#header-font-family').val() ); }) +\$('#header-font-family').change(function(){ \$('h2').css('font-family', \$('#header-font-family').val() ); }) + +\$('#body-font-family').change(function(){ \$('body').css('font-family', \$('#body-font-family').val() ); }) + +\$('#nav-font-family').change(function(){ \$('nav div div ul li a').css('font-family', \$('#nav-font-family').val() ); }) + EOF @@ -116,4 +209,3 @@ done mkdir -p test/js cp $DIR/js/jquery.min.js test/js cp $DIR/js/jquery.sidr.js test/js -cp $DIR/css/jquery.sidr.dark.css test/css