From: David Kastrup Date: Sat, 20 Apr 2013 10:29:31 +0000 (+0200) Subject: Add additional options grdp to scripts/auxiliar/make-regtest-pngs.sh X-Git-Tag: release/2.17.17-1~27^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4d996ed350b0a6bf1233ecde874e3e8cfb2b72ac;p=lilypond.git Add additional options grdp to scripts/auxiliar/make-regtest-pngs.sh This is for checking bitmap production at different resolution, the output from using poppler and libcairo on LilyPond's PDF, and the output for typical print bitmaps generated from LilyPond's PDF. --- diff --git a/scripts/auxiliar/make-regtest-pngs.sh b/scripts/auxiliar/make-regtest-pngs.sh index 5942e279da..e770cc2a67 100755 --- a/scripts/auxiliar/make-regtest-pngs.sh +++ b/scripts/auxiliar/make-regtest-pngs.sh @@ -14,22 +14,69 @@ # # -n means build a new regtest set - the PNGs go in the new-regtest-results # directory +# +# -p uses PDF and the poppler library via pdftocairo for generating bitmaps, +# simulating the output for Evince and other previewers using poppler. +# pdftocairo may be contained in the poppler-utils package. +# +# -r can be used for specifying a rendering resolution. This +# defaults to 101 for poppler and 300 for Ghostscript from PDF. +# +# -g uses Ghostscript for rendering a bitmap version from the PDF, +# simulating the output from printing PDF files on a GNU system, so +# use a resolution appropriate for print. Antialiasing is not enabled. +# +# -d changes the Ghostscript device used for creating PNG files +# (usually png16m, but with -g you might prefer fewer colors for size +# reasons, like png16). + +cpu_count=${CPU_COUNT:-1} +backend_opt='--png ${resolution:+=-dresolution=$resolution} ${gsdevice:+=-dpixmap-format=$gsdevice}' +resolution= +gsdevice= + +png_generate() +{ + : +} -cpu_count=1 +while getopts "j:onpr:g" opts; do + case $opts in j) + cpu_count=$OPTARG;; + + o) + file_loc="old-regtest-results";; -while getopts "j:on" opts; do - if [ "$opts" = "j" ]; then - cpu_count=$OPTARG - fi + p) + backend_opt="--pdf" + png_generate() + { + for i + do pdftocairo -png -r ${resolution:-101} -q "$i" && + rm "$i" + done + };; - if [ "$opts" = "o" ]; then - file_loc="old-regtest-results" - fi + n) + file_loc="new-regtest-results" + do_compare="y";; - if [ "$opts" = "n" ]; then - file_loc="new-regtest-results" - do_compare="y" - fi + r) + resolution=$OPTARG;; + g) + backend_opt="--pdf" + png_generate() + { + for i + do + gs -sDEVICE=${gsdevice:-png16m} -q -dNOPAUSE \ + -r${resolution:-300} -dNOPLATFONTS \ + -dTextAlphaBits=1 -dGraphicsAlphaBits=1 \ + -sOutputFile="${i%.pdf}-%d.png" "$i" -c quit && + rm "$i" + done + };; + esac done if [ -z "$file_loc" ]; then @@ -41,9 +88,10 @@ rm -rf $LILYPOND_BUILD_DIR/out-png-check/$file_loc mkdir -p $LILYPOND_BUILD_DIR/out-png-check/$file_loc cd $LILYPOND_BUILD_DIR/out-png-check/$file_loc ls $LILYPOND_GIT/input/regression/*.ly > dir.txt -$LILYPOND_BUILD_DIR/out/bin/lilypond --png --relocate \ +$LILYPOND_BUILD_DIR/out/bin/lilypond $(eval echo $backend_opt) --relocate \ -dinclude-settings=$LILYPOND_GIT/scripts/auxiliar/NoTagline.ly \ -djob-count=$cpu_count -dread-file-list "dir.txt" +png_generate *.pdf rm -rf dir.txt rm -rf *.log