? 336090.patch
? compile
? depcomp
? fspot-logo.svg
? rsvg-convert
? doc/rsvg.interfaces
? doc/rsvg.prerequisites
? doc/tmpl/rsvg-cairo.sgml
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/librsvg/Makefile.am,v
retrieving revision 1.86
diff -u -p -u -p -r1.86 Makefile.am
--- Makefile.am	5 Feb 2006 21:06:00 -0000	1.86
+++ Makefile.am	26 Mar 2006 15:02:14 -0000
@@ -99,7 +99,6 @@ LDADDS =				\
 	$(LIBGSF_LIBS)			\
 	$(LIBCROCO_LIBS)		\
 	$(LIBRSVG_LIBS) 		\
-	$(POPT_LIBS)			\
 	$(top_builddir)/librsvg-2.la
 
 bin_SCRIPTS=rsvg
Index: configure.in
===================================================================
RCS file: /cvs/gnome/librsvg/configure.in,v
retrieving revision 1.143
diff -u -p -u -p -r1.143 configure.in
--- configure.in	16 Mar 2006 21:46:21 -0000	1.143
+++ configure.in	26 Mar 2006 15:02:15 -0000
@@ -8,14 +8,12 @@ GLIB_REQUIRED=2.0.0
 LIBXML_REQUIRED=2.4.7
 CAIRO_REQUIRED=1.0.2
 PANGOFT2_REQUIRED=1.2.0
-POPT_REQUIRED=1.5
 
 AC_SUBST(GDK_PIXBUF_REQUIRED)
 AC_SUBST(GLIB_REQUIRED)
 AC_SUBST(CAIRO_REQUIRED)
 AC_SUBST(LIBXML_REQUIRED)
 AC_SUBST(PANGOFT2_REQUIRED)
-AC_SUBST(POPT_REQUIRED)
 
 dnl ===========================================================================
 
@@ -93,13 +91,6 @@ PKG_CHECK_MODULES(LIBRSVG, \
 	freetype2)
 AC_SUBST(LIBRSVG_LIBS)
 AC_SUBST(LIBRSVG_CFLAGS)
-
-dnl ===========================================================================
-
-AC_CHECK_LIB(popt, poptParseArgvString, [POPT_LIBS="-lpopt"],
-AC_MSG_ERROR([popt 1.5 or newer is required to build librsvg.
-You can download the latest version from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/]))
-AC_SUBST(POPT_LIBS)
 
 dnl ===========================================================================
 
Index: rsvg-convert.c
===================================================================
RCS file: /cvs/gnome/librsvg/rsvg-convert.c,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 rsvg-convert.c
--- rsvg-convert.c	19 Mar 2006 16:39:40 -0000	1.12
+++ rsvg-convert.c	26 Mar 2006 15:02:15 -0000
@@ -31,7 +31,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <popt.h>
 
 #include "rsvg.h"
 #include "rsvg-cairo.h"
@@ -110,14 +109,14 @@ rsvg_cairo_write_func (void *closure,
 }
 
 int
-main (int argc, const char **argv)
+main (int argc, char **argv)
 {
-	poptContext popt_context;
-	double x_zoom = 1.0;
-	double y_zoom = 1.0;
-	double zoom = 1.0;
-	double dpi_x = -1.0;
-	double dpi_y = -1.0;
+	GOptionContext *goption_context;
+	char * x_zoom = "1.0";
+	char * y_zoom = "1.0";
+	char * zoom = NULL;
+	char * dpi_x = NULL;
+	char * dpi_y = NULL;
 	int width  = -1;
 	int height = -1;
 	int bVersion = 0;
@@ -126,37 +125,44 @@ main (int argc, const char **argv)
 	int keep_aspect_ratio = FALSE;
 	char * base_uri = NULL;
 	gboolean using_stdin = FALSE;
+	char **args = NULL;
 
-	struct poptOption options_table[] = {
-		{ "dpi-x",   'd',  POPT_ARG_DOUBLE, &dpi_x,    0, N_("pixels per inch [optional; defaults to 90dpi]"), N_("<float>") },
-		{ "dpi-y",   'p',  POPT_ARG_DOUBLE, &dpi_y,    0, N_("pixels per inch [optional; defaults to 90dpi]"), N_("<float>") },
-		{ "x-zoom",  'x',  POPT_ARG_DOUBLE, &x_zoom,   0, N_("x zoom factor [optional; defaults to 1.0]"), N_("<float>") },
-		{ "y-zoom",  'y',  POPT_ARG_DOUBLE, &y_zoom,   0, N_("y zoom factor [optional; defaults to 1.0]"), N_("<float>") },
-		{ "zoom",    'z',  POPT_ARG_DOUBLE, &zoom,     0, N_("zoom factor [optional; defaults to 1.0]"), N_("<float>") },
-		{ "width",   'w',  POPT_ARG_INT,    &width,    0, N_("width [optional; defaults to the SVG's width]"), N_("<int>") },
-		{ "height",  'h',  POPT_ARG_INT,    &height,   0, N_("height [optional; defaults to the SVG's height]"), N_("<int>") },		
-		{ "format",  'f',  POPT_ARG_STRING, &format,   0, N_("save format [optional; defaults to 'png']"), N_("[png, pdf, ps, svg]") },
-		{ "output",  'o',  POPT_ARG_STRING, &output,   0, N_("output filename [optional; defaults to stdout]"), NULL },
-		{ "keep-aspect-ratio", 'a', POPT_ARG_NONE, &keep_aspect_ratio, 0, N_("whether to preserve the aspect ratio [optional; defaults to FALSE]"), NULL },
-		{ "version", 'v',  POPT_ARG_NONE,   &bVersion, 0, N_("show version information"), NULL },
-		{ "base-uri", 'b', POPT_ARG_STRING, &base_uri, 0, N_("base uri"), NULL },
-		POPT_AUTOHELP
-		POPT_TABLEEND
+	GOptionEntry options_table[] = {
+		{ "dpi-x",   'd',  0, G_OPTION_ARG_STRING, &dpi_x,    N_("pixels per inch [optional; defaults to 90dpi]"), N_("<float>") },
+		{ "dpi-y",   'p',  0, G_OPTION_ARG_STRING, &dpi_y,    N_("pixels per inch [optional; defaults to 90dpi]"), N_("<float>") },
+		{ "x-zoom",  'x',  0, G_OPTION_ARG_STRING, &x_zoom,   N_("x zoom factor [optional; defaults to 1.0]"), N_("<float>") },
+		{ "y-zoom",  'y',  0, G_OPTION_ARG_STRING, &y_zoom,   N_("y zoom factor [optional; defaults to 1.0]"), N_("<float>") },
+		{ "zoom",    'z',  0, G_OPTION_ARG_STRING, &zoom,     N_("zoom factor [optional; defaults to 1.0]"), N_("<float>") },
+		{ "width",   'w',  0, G_OPTION_ARG_INT,    &width,    N_("width [optional; defaults to the SVG's width]"), N_("<int>") },
+		{ "height",  'h',  0, G_OPTION_ARG_INT,    &height,   N_("height [optional; defaults to the SVG's height]"), N_("<int>") },		
+		{ "format",  'f',  0, G_OPTION_ARG_STRING, &format,   N_("save format [optional; defaults to 'png']"), N_("[png, pdf, ps, svg]") },
+		{ "output",  'o',  0, G_OPTION_ARG_STRING, &output,   N_("output filename [optional; defaults to stdout]"), NULL },
+		{ "keep-aspect-ratio", 'a', 0, G_OPTION_ARG_NONE, &keep_aspect_ratio, N_("whether to preserve the aspect ratio [optional; defaults to FALSE]"), NULL },
+		{ "version", 'v',  0, G_OPTION_ARG_NONE,   &bVersion, N_("show version information"), NULL },
+		{ "base-uri", 'b', 0, G_OPTION_ARG_STRING, &base_uri, N_("base uri"), NULL },
+		{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, N_("[FILE...]") },
+		{ NULL }
 	};
-	int c, i;
-	const char * const *args;
+	int i;
 	gint n_args = 0;
 	RsvgHandle *rsvg;
 	cairo_surface_t *surface = NULL;
 	cairo_t *cr = NULL;
 	RsvgDimensionData dimensions;
 	FILE * output_file = stdout;
+	GError *error = NULL;
 
-	popt_context = poptGetContext ("rsvg-cairo", argc, argv, options_table, 0);
-	poptSetOtherOptionHelp (popt_context, _("[OPTIONS...]"));
+	goption_context = g_option_context_new (_("- SVG Converter"));
+	g_option_context_add_main_entries (goption_context, options_table, "rsvg-convert");
+	g_option_context_set_help_enabled (goption_context, TRUE);
+
+	if (!g_option_context_parse (goption_context, &argc, &argv, &error)) {
+		g_error_free (error);
+		g_option_context_free (goption_context);
+		exit(1);
+	}
 
-	c = poptGetNextOpt (popt_context);
-	args = poptGetArgs (popt_context);
+	g_option_context_free (goption_context);
 
 	if (bVersion != 0)
 		{
@@ -186,14 +192,17 @@ main (int argc, const char **argv)
 	else if (n_args > 1 && (!format || !strcmp (format, "png"))) 
 		{
 			fprintf (stderr, _("Multiple SVG files are only allowed for PDF, PS and SVG output.\n"));
+			fclose (output_file);
 			exit (1);
 		}
 
-	if (zoom != 1.0)
+	if ((zoom && *zoom))
 		x_zoom = y_zoom = zoom;
 
 	rsvg_init ();
-	rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
+
+	if ((dpi_x && *dpi_x) && (dpi_y && *dpi_y))
+		rsvg_set_default_dpi_x_y (g_ascii_strtod (dpi_x, NULL), g_ascii_strtod (dpi_y, NULL));
 
 	for(i = 0; i < n_args; i++) 
 		{
@@ -204,6 +213,8 @@ main (int argc, const char **argv)
 			
 			if(!rsvg) {
 				fprintf (stderr, _("Error reading SVG.\n"));
+				fclose (output_file);
+				rsvg_term ();
 				exit (1);
 			}
 
@@ -217,17 +228,22 @@ main (int argc, const char **argv)
 				{
 					struct RsvgSizeCallbackData size_data;
 
+					double zoom_x = 1.0, zoom_y = 1.0;
+
+					zoom_x = g_ascii_strtod (x_zoom, NULL);
+					zoom_y = g_ascii_strtod (y_zoom, NULL);
+
 					rsvg_handle_get_dimensions (rsvg, &dimensions);
 					/* if both are unspecified, assume user wants to zoom the image in at least 1 dimension */
 					if (width == -1 && height == -1)
 						{
 							size_data.type = RSVG_SIZE_ZOOM;
-							size_data.x_zoom = x_zoom;
-							size_data.y_zoom = y_zoom;
+							size_data.x_zoom = zoom_x;
+							size_data.y_zoom = zoom_y;
 							size_data.keep_aspect_ratio = keep_aspect_ratio;
 						}
 					/* if both are unspecified, assume user wants to resize image in at least 1 dimension */
-					else if (x_zoom == 1.0 && y_zoom == 1.0)
+					else if (zoom_x == 1.0 && zoom_y == 1.0)
 						{
 							/* if one parameter is unspecified, assume user wants to keep the aspect ratio */
 							if (width == -1 || height == -1)
@@ -249,8 +265,8 @@ main (int argc, const char **argv)
 						{
 							/* assume the user wants to zoom the image, but cap the maximum size */
 							size_data.type = RSVG_SIZE_ZOOM_MAX;
-							size_data.x_zoom = x_zoom;
-							size_data.y_zoom = y_zoom;
+							size_data.x_zoom = zoom_x;
+							size_data.y_zoom = zoom_y;
 							size_data.width = width;
 							size_data.height = height;
 							size_data.keep_aspect_ratio = keep_aspect_ratio;
@@ -279,6 +295,9 @@ main (int argc, const char **argv)
 					else 
 						{
 							fprintf (stderr, _("Unknown output format."));
+							g_object_unref (G_OBJECT(rsvg));
+							fclose (output_file);
+							rsvg_term ();
 							exit (1);
 						}
 
@@ -307,8 +326,7 @@ main (int argc, const char **argv)
 	cairo_surface_destroy (surface);
 
 	fclose (output_file);
-
-	poptFreeContext (popt_context);
+	
 	rsvg_term();
 
 	return 0;
Index: test-display.c
===================================================================
RCS file: /cvs/gnome/librsvg/test-display.c,v
retrieving revision 1.42
diff -u -p -u -p -r1.42 test-display.c
--- test-display.c	5 Feb 2006 16:57:05 -0000	1.42
+++ test-display.c	26 Mar 2006 15:02:16 -0000
@@ -22,7 +22,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <popt.h>
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
@@ -670,11 +669,12 @@ int 
 main (int argc, char **argv)
 {
 	GError * err = NULL;
-	poptContext popt_context;
-	double x_zoom = 1.0;
-	double y_zoom = 1.0;
-	double dpi_x = -1.0;
-	double dpi_y = -1.0;
+	GOptionContext *goption_context;
+	char *x_zoom = "1.0";
+	char *y_zoom = "1.0";
+	double zoom_x, zoom_y;
+	char *dpi_x = NULL;
+	char *dpi_y = NULL;
 	int width  = -1;
 	int height = -1;
 	int bVersion = 0;
@@ -686,41 +686,47 @@ main (int argc, char **argv)
 	int from_stdin = 0;
 	ViewerCbInfo info;
 
+	char **args;
+	gint n_args = 0;
+
 	struct RsvgSizeCallbackData size_data;
 
-	struct poptOption options_table[] = 
+	GOptionEntry options_table[] = 
 		{
 #ifdef ENABLE_XEMBED
-			{ "xid",         'i',  POPT_ARG_INT,    &xid,         0, N_("XWindow ID [for X11 embedding]"), N_("<int>") },
+			{ "xid",         'i',  0, G_OPTION_ARG_INT,    &xid,         N_("XWindow ID [for X11 embedding]"), N_("<int>") },
 #endif
-			{ "stdin",       's',  POPT_ARG_NONE,   &from_stdin,  0, N_("Read from stdin instead of a file"), NULL },
-			{ "dpi-x",       'd',  POPT_ARG_DOUBLE, &dpi_x,       0, N_("Set the # of Pixels Per Inch"), N_("<float>") },
-			{ "dpi-y",       'p',  POPT_ARG_DOUBLE, &dpi_y,       0, N_("Set the # of Pixels Per Inch"), N_("<float>") },
-			{ "x-zoom",      'x',  POPT_ARG_DOUBLE, &x_zoom,      0, N_("Set the x zoom factor"), N_("<float>") },
-			{ "y-zoom",      'y',  POPT_ARG_DOUBLE, &y_zoom,      0, N_("Set the y zoom factor"), N_("<float>") },
-			{ "width",       'w',  POPT_ARG_INT,    &width,       0, N_("Set the image's width"), N_("<int>") },
-			{ "height",      'h',  POPT_ARG_INT,    &height,      0, N_("Set the image's height"), N_("<int>") },
-			{ "bg-color",    'b',  POPT_ARG_STRING, &bg_color,    0, N_("Set the image background color (default: transparent)"), N_("<string>") },
-			{ "base-uri",    'u',  POPT_ARG_STRING, &base_uri,    0, N_("Set the base URI (default: none)"), N_("<string>") },
-			{ "keep-aspect", 'k',  POPT_ARG_NONE,   &bKeepAspect, 0, N_("Preserve the image's aspect ratio"), NULL },
-			{ "version",     'v',  POPT_ARG_NONE,   &bVersion,    0, N_("Show version information"), NULL },
-			POPT_AUTOHELP
-			POPT_TABLEEND
+			{ "stdin",       's',  0, G_OPTION_ARG_NONE,   &from_stdin,  N_("Read from stdin instead of a file"), NULL },
+			{ "dpi-x",       'd',  0, G_OPTION_ARG_STRING, &dpi_x,       N_("Set the # of Pixels Per Inch"), N_("<float>") },
+			{ "dpi-y",       'p',  0, G_OPTION_ARG_STRING, &dpi_y,       N_("Set the # of Pixels Per Inch"), N_("<float>") },
+			{ "x-zoom",      'x',  0, G_OPTION_ARG_STRING, &x_zoom,      N_("Set the x zoom factor"), N_("<float>") },
+			{ "y-zoom",      'y',  0, G_OPTION_ARG_STRING, &y_zoom,      N_("Set the y zoom factor"), N_("<float>") },
+			{ "width",       'w',  0, G_OPTION_ARG_INT,    &width,       N_("Set the image's width"), N_("<int>") },
+			{ "height",      'h',  0, G_OPTION_ARG_INT,    &height,      N_("Set the image's height"), N_("<int>") },
+			{ "bg-color",    'b',  0, G_OPTION_ARG_STRING, &bg_color,    N_("Set the image background color (default: transparent)"), N_("<string>") },
+			{ "base-uri",    'u',  0, G_OPTION_ARG_STRING, &base_uri,    N_("Set the base URI (default: none)"), N_("<string>") },
+			{ "keep-aspect", 'k',  0, G_OPTION_ARG_NONE,   &bKeepAspect, N_("Preserve the image's aspect ratio"), NULL },
+			{ "version",     'v',  0, G_OPTION_ARG_NONE,   &bVersion,    N_("Show version information"), NULL },
+			{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, N_("[FILE...]") },
+			{ NULL }
 		};
-	int c;
-	const char * const *args;
-	gint n_args = 0;
     
 	info.pixbuf = NULL;
 	info.svg_bytes = NULL;
 	info.window = NULL;
 	info.popup_menu = NULL;
 
-	popt_context = poptGetContext ("rsvg-view", argc, (const char **)argv, options_table, 0);
-	poptSetOtherOptionHelp (popt_context, _("[OPTIONS...] [file.svg]"));
-	
-	c = poptGetNextOpt (popt_context);
-	args = poptGetArgs (popt_context);
+	goption_context = g_option_context_new (_("- SVG Viewer"));
+	g_option_context_add_main_entries (goption_context, options_table, "rsvg-view");
+	g_option_context_set_help_enabled (goption_context, TRUE);
+
+	if (!g_option_context_parse (goption_context, &argc, &argv, &err)) {
+		g_error_free (err);
+		g_option_context_free (goption_context);
+		exit(1);
+	}
+
+	g_option_context_free (goption_context);
 	
 	if (bVersion != 0)
 		{
@@ -736,8 +742,7 @@ main (int argc, char **argv)
   
 	if ((!from_stdin) && (n_args != 1))
 		{
-			poptPrintHelp (popt_context, stderr, 0);
-			poptFreeContext (popt_context);
+			fprintf (stderr, _("No arguments specified and not reading from stdin."));
 			return 1;
 		}
 	
@@ -745,17 +750,21 @@ main (int argc, char **argv)
 	gtk_init (&argc, &argv) ;
 	rsvg_init ();
 
-	rsvg_set_default_dpi_x_y (dpi_x, dpi_y);
+	if ((dpi_x && *dpi_x) && (dpi_y && *dpi_y))
+		rsvg_set_default_dpi_x_y (g_ascii_strtod (dpi_x, NULL), g_ascii_strtod (dpi_y, NULL));
 	
+	zoom_x = g_ascii_strtod (x_zoom, NULL);
+	zoom_y = g_ascii_strtod (y_zoom, NULL);
+
 	/* if both are unspecified, assume user wants to zoom the pixbuf in at least 1 dimension */
 	if (width == -1 && height == -1)
 		{
 			size_data.type = RSVG_SIZE_ZOOM;
-			size_data.x_zoom = x_zoom;
-			size_data.y_zoom = y_zoom;
+			size_data.x_zoom = zoom_x;
+			size_data.y_zoom = zoom_y;
 		}
 	/* if both are unspecified, assume user wants to resize pixbuf in at least 1 dimension */
-	else if (x_zoom == 1.0 && y_zoom == 1.0)
+	else if (zoom_x == 1.0 && zoom_y == 1.0)
 		{
 			size_data.type = RSVG_SIZE_WH;
 			size_data.width = width;
@@ -765,8 +774,8 @@ main (int argc, char **argv)
 	else
 		{
 			size_data.type = RSVG_SIZE_ZOOM_MAX;
-			size_data.x_zoom = x_zoom;
-			size_data.y_zoom = y_zoom;
+			size_data.x_zoom = zoom_x;
+			size_data.y_zoom = zoom_y;
 			size_data.width = width;
 			size_data.height = height;
 		}
@@ -795,7 +804,6 @@ main (int argc, char **argv)
 						{
 							g_critical (_("Error reading\n"));
 							g_byte_array_free (info.svg_bytes, TRUE);
-							poptFreeContext (popt_context);
 							fclose(stdin);
 							
 							return 1;
@@ -811,14 +819,10 @@ main (int argc, char **argv)
 	if(!info.svg_bytes || !info.svg_bytes->len)
 		{
 			g_critical (_("Couldn't open %s\n"), args[0]);
-			poptFreeContext (popt_context);
-
 			return 1;
 		}
 
 	info.base_uri = base_uri;
-
-	poptFreeContext (popt_context);
 
 	info.pixbuf = rsvg_pixbuf_from_data_with_size_data (info.svg_bytes->data, info.svg_bytes->len, &size_data, base_uri, &err);
 
Index: test-performance.c
===================================================================
RCS file: /cvs/gnome/librsvg/test-performance.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 test-performance.c
--- test-performance.c	25 Sep 2004 15:47:32 -0000	1.4
+++ test-performance.c	26 Mar 2006 15:02:16 -0000
@@ -28,55 +28,54 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <popt.h>
 
 #include "rsvg.h"
+#include "rsvg-private.h"
 
 int
-main (int argc, const char **argv)
+main (int argc, char **argv)
 {
 	int         i, count = 10;
 	GTimer     *timer;
 
-	poptContext popt_context;
-	double x_zoom = 1.0;
-	double y_zoom = 1.0;
-	double dpi = -1.0;
+	GOptionContext *goption_context;
+	char *x_zoom = "1.0";
+	char *y_zoom = "1.0";
+	double zoom_x, zoom_y;
+	char *dpi = NULL;
 	int width  = -1;
 	int height = -1;
-	int bVersion = 0;
-
-	struct poptOption options_table[] = {
-		{ "dpi"   ,  'd',  POPT_ARG_DOUBLE, NULL, 0, "pixels per inch", "<float>" },
-		{ "x-zoom",  'x',  POPT_ARG_DOUBLE, NULL, 0, "x zoom factor", "<float>" },
-		{ "y-zoom",  'y',  POPT_ARG_DOUBLE, NULL, 0, "y zoom factor", "<float>" },
-		{ "width",   'w',  POPT_ARG_INT,    NULL, 0, "width", "<int>" },
-		{ "height",  'h',  POPT_ARG_INT,    NULL, 0, "height", "<int>" },
-		{ "count",   'c',  POPT_ARG_INT,    NULL, 0, "number of times to render the SVG", "<int>" },
-		{ "version", 'v',  POPT_ARG_NONE,   NULL, 0, "show version information", NULL },
-		POPT_AUTOHELP
-		POPT_TABLEEND
-	};
-	int c;
-	const char * const *args;
+	int version = 0;
+	char **args;
 	gint n_args = 0;
 	GdkPixbuf *pixbuf;
+	GError *error;
 
-	options_table[0].arg = &dpi;
-	options_table[1].arg = &x_zoom;
-	options_table[2].arg = &y_zoom;
-	options_table[3].arg = &width;
-	options_table[4].arg = &height;
-	options_table[5].arg = &count;
-	options_table[6].arg = &bVersion;
+	GOptionEntry options_table[] = {
+		{ "dpi"   ,  'd',  0, G_OPTION_ARG_STRING, &dpi,     "pixels per inch", "<float>" },
+		{ "x-zoom",  'x',  0, G_OPTION_ARG_STRING, &x_zoom,  "x zoom factor", "<float>" },
+		{ "y-zoom",  'y',  0, G_OPTION_ARG_STRING, &y_zoom,  "y zoom factor", "<float>" },
+		{ "width",   'w',  0, G_OPTION_ARG_INT,    &width,   "width", "<int>" },
+		{ "height",  'h',  0, G_OPTION_ARG_INT,    &height,  "height", "<int>" },
+		{ "count",   'c',  0, G_OPTION_ARG_INT,    &count,   "number of times to render the SVG", "<int>" },
+		{ "version", 'v',  0, G_OPTION_ARG_NONE,   &version, "show version information", NULL },
+		{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args, NULL, N_("[FILE...]") },
+		{ NULL }
+	};
 
-	popt_context = poptGetContext ("test-performance", argc, argv, options_table, 0);
-	poptSetOtherOptionHelp(popt_context, "[OPTIONS...] file.svg");
+	goption_context = g_option_context_new (_("- SVG Performance test"));
+	g_option_context_add_main_entries (goption_context, options_table, "test-performance");
+	g_option_context_set_help_enabled (goption_context, TRUE);
+
+	if (!g_option_context_parse (goption_context, &argc, &argv, &error)) {
+		g_error_free (error);
+		g_option_context_free (goption_context);
+		exit(1);
+	}
 
-	c = poptGetNextOpt (popt_context);
-	args = poptGetArgs (popt_context);
+	g_option_context_free (goption_context);
 
-	if (bVersion != 0)
+	if (version != 0)
 		{
 			g_print ("test-performance version %s\n", VERSION);
 			return 0;
@@ -88,28 +87,33 @@ main (int argc, const char **argv)
 
 	if (n_args != 1)
 		{
-			poptPrintHelp (popt_context, stderr, 0);
-			poptFreeContext (popt_context);
+			fprintf (stderr, _("No files specified."));
 			return 1;
 		}
 
 	rsvg_init ();
 
+	if(dpi && *dpi)
+		rsvg_set_default_dpi (g_ascii_strtod (dpi, NULL));
+
 	fprintf (stdout, "File '%s'\n", args[0]);
 
+	zoom_x = g_ascii_strtod (x_zoom, NULL);
+	zoom_y = g_ascii_strtod (y_zoom, NULL);
+
 	timer = g_timer_new ();
 	g_timer_start (timer);
 
 	for (i = 0; i < count; i++) {
 		/* if both are unspecified, assume user wants to zoom the pixbuf in at least 1 dimension */
 		if (width == -1 && height == -1)
-			pixbuf = rsvg_pixbuf_from_file_at_zoom (args[0], x_zoom, y_zoom, NULL);
+			pixbuf = rsvg_pixbuf_from_file_at_zoom (args[0], zoom_x, zoom_y, NULL);
 		/* if both are unspecified, assume user wants to resize pixbuf in at least 1 dimension */
-		else if (x_zoom == 1.0 && y_zoom == 1.0)
+		else if (zoom_y == 1.0 && zoom_y == 1.0)
 			pixbuf = rsvg_pixbuf_from_file_at_size (args[0], width, height, NULL);
 		else
 			/* assume the user wants to zoom the pixbuf, but cap the maximum size */
-			pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max (args[0], x_zoom, y_zoom,
+			pixbuf = rsvg_pixbuf_from_file_at_zoom_with_max (args[0], zoom_x, zoom_y,
 									 width, height, NULL);
 		
 		g_object_unref (pixbuf);
