Fix:Core:Also support rsvg-convert and inkscape for generating pngs out of svgs
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 4 Feb 2009 10:55:29 +0000 (10:55 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 4 Feb 2009 10:55:29 +0000 (10:55 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2002 ffa7fe5e-494d-0410-b361-a75ebd5db220

configure.in
navit/xpm/Makefile.am
navit/xpm/navit_svg2png

index 3fe972e..b19bb0b 100644 (file)
@@ -562,11 +562,12 @@ AC_ARG_ENABLE(svg2png-scaling, [  --enable-svg2png-scaling   enable conversion o
 AC_ARG_ENABLE(svg2png-scaling-flag, [  --enable-svg2png-scaling-flag   enable conversion of flag svgs to pngs with specified sizes], SVG2PNG_SCALES_FLAG=$enableval, SVG2PNG_SCALES_FLAG="")
 AC_ARG_ENABLE(svg2png-scaling-nav, [  --enable-svg2png-scaling-nav   enable conversion of nav svgs to pngs with specified sizes], SVG2PNG_SCALES_NAV=$enableval, SVG2PNG_SCALES_NAV="")
 if test "x${enable_svg2png}" = "xyes" ; then
-       AC_PATH_PROG([KSVGTOPNG], [ksvgtopng], [])
-       if test ! -x "$KSVGTOPNG"; then
-           enable_svg2png="no"
-        fi
+       AC_PATH_PROGS([SVG2PNG], [ksvgtopng ksvgtopng4 rsvg-convert inkscape], [none])
+       if test "x${SVG2PNG}" = "xnone"; then
+               enable_svg2png="no"
+       fi
 fi
+AC_SUBST(SVG2PNG)
 AC_SUBST(SVG2PNG_SCALES)
 AC_SUBST(SVG2PNG_SCALES_FLAG)
 AC_SUBST(SVG2PNG_SCALES_NAV)
index 75a1d1d..d2106be 100644 (file)
@@ -200,7 +200,7 @@ endif
 
 if USE_SVG2PNG
 %.png:$(srcdir)/*.svg
-       SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "$@"
+       SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "@SVG2PNG@" "$@"
 xpm_DATA += $(addsuffix .png,$(basename $(svgs)))
 xsize=$(firstword $(subst x, ,$(scale)))
 ysize=$(lastword $(subst x, ,$(scale)))
index 90a521a..a36e5a2 100755 (executable)
@@ -1,6 +1,23 @@
 #! /bin/bash
+
+function svgtopng
+{
+       case $svgtopng in
+       *ksvgtopng|*ksvgtopng4)
+               $svgtopng $*
+               ;;
+       *rsvg-convert)
+               $svgtopng --width=$1 --height=$2 --output $4 $3
+               ;;
+       *inkscape)
+               $svgtopng --without-gui --export-width=$1 --export-height=$2 --export-png=$4 $3
+               ;;
+       esac
+}
+
 ulimit -t 5
-png=$1
+svgtopng=$1
+png=$2
 if [[ "$png" = *_[1-9]*_[1-9]*.png ]]; 
 then
         svg=${png%_*_*.png};
@@ -29,11 +46,11 @@ else
                then
                        h=$(grep 'height="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*height="//' -e 's/[pxt]*".*//')
                fi
-               ksvgtopng $w $h $svg.svg $png
+               svgtopng $w $h $svg.svg $png
        elif [ -f $svg.svgz ]
        then
                gzip -dc <$svg.svgz >$svg.svg
-               ksvgtopng $w $h $svg.svg $png
+               svgtopng $w $h $svg.svg $png
                rm -f $svg.svg
        fi
 fi