summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaggety <inigohuguet@hotmail.com>2017-11-14 17:49:50 +0100
committerPierre GRANDIN <pgrandin@users.noreply.github.com>2017-11-14 08:49:50 -0800
commitacba9e675bed05c63c17d2993cc6f05766028696 (patch)
tree25e635c6acc943545cbfa798337b8ba9dc08e3d9
parent3f26accd04c0f9733f2c8bf7bf58235e2d47a734 (diff)
downloadnavit-acba9e675bed05c63c17d2993cc6f05766028696.tar.gz
Fix:core:Wrong default png size with ksvgtopng (#371)
During building svg icons are converted to png with various predefined sizes, and also one png with the size embedded into the svg. If using ksvgtopng to make the conversion, the size was not read fine from the svg if property "width" appears more than once, even if the second is in a different tag than <svg>. Now, the first "width" property is read, and since <svg> tag is the root tag, the first "width" property will be owed by it.
-rw-r--r--navit/icons/CMakeLists.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/navit/icons/CMakeLists.txt b/navit/icons/CMakeLists.txt
index 6d40f2a92..040f0ee5e 100644
--- a/navit/icons/CMakeLists.txt
+++ b/navit/icons/CMakeLists.txt
@@ -20,7 +20,8 @@ macro(convert_to_png IMAGE_INPUT IMAGE_OUTPUT SCALE)
set (NEW_SCALE ${SCALE})
if (${SCALE} EQUAL 0)
file(STRINGS ${IMAGE_INPUT} NEW_SCALE_LINE REGEX "[^-]width=\"[0-9pxt.]*\"")
- string(REGEX REPLACE ".*width=\"([0-9]*).*" "\\1" NEW_SCALE ${NEW_SCALE_LINE})
+ string(REGEX MATCH "width=\"([0-9]*)[pxt]*\"" NEW_SCALE_LINE ${NEW_SCALE_LINE})
+ set(NEW_SCALE ${CMAKE_MATCH_1})
endif()
set(COMMAND_ARGS ${NEW_SCALE} ${NEW_SCALE} ${IMAGE_INPUT} ${IMAGE_OUTPUT})
elseif(${IMAGE_CONVERTER_${FILE_TYPE}} MATCHES "inkscape")