Sometime ago, talking in #cairo, Carl Worth tell me that the cairo_write_func_t used in cairo_svg_surface_create_for_stream must be called when a call to cairo_show_page/cairo_copy_page or cairo_surface_show_page/cairo_surface_copy_page is called, but this isn't what actually happen. The cairo_write_func_t is only called when the surface is destroyed, what's a problem, since some applications only destroy the surface when it's terminate, so we can't send progress throw the stream.
I guess it should be possible, by having a defs element before each page.
(In reply to comment #1) > I guess it should be possible, by having a defs element before each page. I ran into the same issue. Can you please explain your solution and how to implement it? cairo_status_t writeSvg(void *closure, const unsigned char *data, unsigned int length) { ... } ... void main() { cairo_surface_t *surface=0; cairo_t *cr=0; surface = cairo_svg_surface_create_for_stream(writeSvg, &truncated, 390, 60); cr = cairo_create(surface); cairo_set_source_rgb(cr, 0, 0, 0); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr, 40.0); cairo_move_to(cr, 10.0, 50.0); cairo_show_text(cr, "Hello World."); cairo_show_page(cr); // writeSvg not invoked here! cairo_move_to(cr, 10.0, 50.0); cairo_show_text(cr, "Knowledge is Power."); cairo_surface_destroy(surface); cairo_destroy(cr); // writeSvg invoked here! ... }
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/250.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.