<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - cairo_write_func_t isn't called when a call to cairo_show_page/cairo_copy_page is done"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=14945#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - cairo_write_func_t isn't called when a call to cairo_show_page/cairo_copy_page is done"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=14945">bug 14945</a>
              from <span class="vcard"><a class="email" href="mailto:oliver.terbu@zuehlke.com" title="oliver.terbu@zuehlke.com">oliver.terbu@zuehlke.com</a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=14945#c1">comment #1</a>)
<span class="quote">> I guess it should be possible, by having a defs element before each page.</span >

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!

  ...
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>