|
|
|
@ -230,9 +230,19 @@ class Imtex {
@@ -230,9 +230,19 @@ class Imtex {
|
|
|
|
|
// width_pt, height_pt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cairo_surface_t * surface = cairo_svg_surface_create_for_stream(cairo_stream_to_buffer_func, (void *)&bufer, width_pt, height_pt);
|
|
|
|
|
std::string bufer {}; |
|
|
|
|
cairo_surface_t * surface = cairo_svg_surface_create_for_stream(cairo_stream_to_buffer_func, (void *)&bufer, width_pt, height_pt); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// uncomment this to dump all the svgs in a folder
|
|
|
|
|
static int i = 0; |
|
|
|
|
i++; |
|
|
|
|
std::ostringstream ss {}; |
|
|
|
|
ss << "svg/" << i << ".svg"; |
|
|
|
|
cairo_surface_t * surface = cairo_svg_surface_create(ss.str().c_str(), width_pt, height_pt); |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
cairo_surface_t * surface = cairo_svg_surface_create("testfil.svg", width_pt, height_pt); |
|
|
|
|
// the render context
|
|
|
|
|
cairo_t * cairo = cairo_create(surface); |
|
|
|
|
|
|
|
|
|
cairo_scale (cairo, option_zoom, option_zoom); |
|
|
|
@ -250,9 +260,6 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
@@ -250,9 +260,6 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
|
|
|
|
|
unsigned long sd_len; |
|
|
|
|
const unsigned char * data; |
|
|
|
|
|
|
|
|
|
cairo_surface_get_mime_data(surface, CAIRO_MIME_TYPE_URI, &data, &sd_len); |
|
|
|
|
std::string bufer {data, data + sd_len}; |
|
|
|
|
spdlog::info("{} svg? \n\n {}", itex, bufer); |
|
|
|
|
|
|
|
|
|
cairo_surface_destroy(surface); |
|
|
|
|
cairo_destroy (cairo); |
|
|
|
@ -261,9 +268,10 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
@@ -261,9 +268,10 @@ cairo_surface_get_mime_data (cairo_surface_t *surface,
|
|
|
|
|
|
|
|
|
|
g_object_unref (doc); |
|
|
|
|
|
|
|
|
|
spdlog::info("{} svg again? \n\n {}", itex, bufer); |
|
|
|
|
|
|
|
|
|
return mathml; |
|
|
|
|
// bufer contains svg
|
|
|
|
|
// mathml contains mathml
|
|
|
|
|
return bufer; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|