diff --git a/tools/Makefile.am b/tools/Makefile.am index b785a07a19..85ec53b527 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -58,6 +58,8 @@ if ENABLE_VECTOR_ICONS # Build tools which must be built for the host platform. #all-local: compute-svg-viewbox$(BUILD_EXEEXT) +#noinst_PROGRAMS = compute-svg-viewbox + #DISTCLEANFILES = compute-svg-viewbox$(BUILD_EXEEXT) endif diff --git a/tools/compute-svg-viewbox.c b/tools/compute-svg-viewbox.c index 1fcb08b1ed..a62df14aa7 100644 --- a/tools/compute-svg-viewbox.c +++ b/tools/compute-svg-viewbox.c @@ -21,15 +21,16 @@ int main (int argc, char **argv) { - RsvgHandle *handle; - RsvgPositionData position_data; - RsvgDimensionData dimension; + RsvgHandle *handle; + RsvgRectangle viewport = { 0.0, 0.0, 16.0, 16.0 }; + RsvgRectangle out_ink_rect; + RsvgRectangle out_logical_rect; - gchar *endptr; - gchar *path; - gchar *id; - gint prev_x; - gint prev_y; + gchar *endptr; + gchar *path; + gchar *id; + gint prev_x; + gint prev_y; if (argc != 5) { @@ -66,18 +67,18 @@ int main (int argc, char **argv) return 1; } - rsvg_handle_get_position_sub (handle, &position_data, id); - rsvg_handle_get_dimensions_sub (handle, &dimension, id); - if (dimension.width != dimension.height) + rsvg_handle_get_geometry_for_layer (handle, id, &viewport, &out_ink_rect, &out_logical_rect, NULL); + + if (out_ink_rect.width != out_ink_rect.height) { /* Right now, we are constraining all objects into square objects. */ - fprintf (stderr, "WARNING: object \"%s\" has unexpected size %dx%d [pos: (%d, %d)].\n", - id, dimension.width, dimension.height, - position_data.x, position_data.y); + fprintf (stderr, "WARNING: object \"%s\" has unexpected size %fx%f [pos: (%f, %f)].\n", + id, out_ink_rect.width, out_ink_rect.height, + out_ink_rect.x, out_ink_rect.y); } - printf ("viewBox=\"%d %d %d %d\"", - position_data.x + prev_x, position_data.y + prev_y, - dimension.width, dimension.height); + printf ("viewBox=\"%f %f %f %f\"", + out_ink_rect.x + prev_x, out_ink_rect.y + prev_y, + out_ink_rect.width, out_ink_rect.height); g_object_unref (handle); g_free (id); diff --git a/tools/extract-vector-icon.sh b/tools/extract-vector-icon.sh index 91fd2d0f06..3282276546 100755 --- a/tools/extract-vector-icon.sh +++ b/tools/extract-vector-icon.sh @@ -31,7 +31,7 @@ if [ "$#" != 2 ]; then fi fi -# The script is run from $(top_builddir)/icons/Symbolic/ +# The script is run from $(top_builddir)/icons/*/ compute_viewbox="$(pwd)/../../tools/compute-svg-viewbox" source="$1" id="$2"