X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=gfx%2Fluma%2Frender-svg.sh;h=8c697feeaa918f2ae4b18cd6428c551e20094a85;hb=HEAD;hp=ee220def61578d1f92652f7a9ba07515d4454913;hpb=abc94a4a536553880a2b4fc0ee8c6e565e2e1312;p=xonotic%2Fmediasource.git diff --git a/gfx/luma/render-svg.sh b/gfx/luma/render-svg.sh index ee220de..8c697fe 100755 --- a/gfx/luma/render-svg.sh +++ b/gfx/luma/render-svg.sh @@ -8,14 +8,14 @@ # the svg files are rendered at a large size and then scaled down. # # DEPENDENCIES -# rsvg-convert (librsvg) -# convert (imagemagick) +# rsvg-convert (librsvg 2.39.0) +# convert (imagemagick 6.8.6-9) # # USAGE # ./render-svg.sh DATADIR [SVGFILE...] # # USAGE EXAMPLES -# Single file: ./render-svg.sh ~/.xonotic/data gfx/menu/luminos/cursor.svg +# Single file: ./render-svg.sh ~/.xonotic/data gfx/menu/luma/cursor.svg # All files: ./render-svg.sh ~/.xonotic/data $(find . -name "*.svg") @@ -36,7 +36,9 @@ for svg in "$@"; do dir="$data/${svg%/*}" tga="$data/${svg%.*}.tga" - if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ "$svg" -nt "$tga" ]; then + # IF source file has extension .svg AND it exists AND + # destination file does NOT exist, OR source file is newer than destination file + if [ "$ext" = "svg" ] && [ -f "$svg" ] && [ ! -f "$tga" -o "$svg" -nt "$tga" ]; then echo "Rendering $tga" w=$(identify -format "%w" "$svg") @@ -44,6 +46,16 @@ for svg in "$@"; do scale=$(echo "s=sqrt($maxPixels/$w/$h);if(s>$maxScale)s=$maxScale;s" | bc) mkdir -p "$dir" - rsvg-convert -z "$scale" "$svg" | convert - -scale "$w" "$tga" + # -auto-orient works around an inversion regression present in imagemagick 6.9.11-60 + rsvg-convert -z "$scale" "$svg" | convert - -auto-orient -scale "$w" "$tga" + else + printf "NOT rendering source $svg because " + if [ ! "$ext" = "svg" ]; then + printf "file extension is not \".svg\"\n" + elif [ ! -f "$svg" ]; then + printf "file not found\n" + else + printf "$svg is not newer than $tga\n" + fi fi done