Hi,
I'm a newbie using inkscape to annotate a floor plan I've created with cairo. I'm having a few little problems when I try to do this. The first problem is that the size of the objects in my floor plan change when I change the page format. For example, if I generate a square intended to print as 1" on a side, it initially is the correct size when I open the svg file with inkscape. However, after I pick a page format (eg: US Letter), the size of the square changes significantly. I'm not sure if this is newbie ignorance or a bug in cairo or inkscape. Below is some C code that generates an svg file with a 1" square as an example. How can I make objects print at their original size without simply manually rescaling everything after setting the page format?
Thanks,
David
// compile like this: // g++ -Wall -c -g `pkg-config --cflags gtk+-2.0` -o cairosvg.o cairosvg.cpp // g++ -g -o cairosvg cairosvg.o `pkg-config --libs gtk+-2.0`
#include <gtk/gtk.h> #include <glib.h> #include <gtk/gtk.h> #include <gdk/gdk.h> #include <cairo/cairo-svg.h>
int main(int argc, char *argv[]) {
cairo_surface_t *surface;
surface = cairo_svg_surface_create("foo.svg", 100, 100);
cairo_t *cr; cr = cairo_create (surface); cairo_surface_destroy(surface);
cairo_rectangle (cr, 0.0, 0.0, 100, 100); cairo_clip (cr);
cairo_move_to(cr, 10, 10); cairo_line_to(cr, 10, 82); cairo_line_to(cr, 82, 82); cairo_line_to(cr, 82, 10); cairo_close_path(cr); cairo_set_source_rgb(cr, 0,1,0); cairo_set_line_width (cr, 0.1); cairo_stroke(cr);
cairo_move_to(cr, 46,46); cairo_show_text(cr, "X");
cairo_show_page (cr); cairo_destroy (cr);
return 0;
}
_________________________________________________________________ More photos, more messages, more storage�get 2GB with Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migr...
On 5/27/07, David L <idht4n@...9...> wrote:
I'm having a few little problems when I try to do this. The first problem is that the size of the objects in my floor plan change when I change the page format.
This will most likely be fixed if you remove the viewBox attribute from the root svg tag.
I'm having a few little problems when I try to do this. The first
problem
is that the size of the objects in my floor plan change when I change the page format.
This will most likely be fixed if you remove the viewBox attribute from the root svg tag.
I removed the viewbox from the svg file... the 1 inch square became a 0.8 inch square. But the size no longer changes when the page format changes. I can just change the scale in my cairo output to correct for this rescaling, but I still don't understand exactly what's going on. Is this a bug or an intended behavior? It seems odd that objects are resized when the page format changes.
Thanks...
David
_________________________________________________________________ Make every IM count. Download Messenger and join the i�m Initiative now. It�s free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07
On 5/30/07, David L <idht4n@...9...> wrote:
understand exactly what's going on. Is this a bug or an intended behavior? It seems odd that objects are resized when the page format changes.
Yes it's a bug. Inkscape never uses viewBox itself and its support for this attribute is quite poor.
participants (2)
-
bulia byak
-
David L