From 0df291b7bdfe888cb07e35a75eab2c5eb183fef1 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 4 Jul 2019 11:44:01 +0200 Subject: Fix link export code --- src/extension/internal/cairo-render-context.cpp | 10 ++++++---- src/extension/internal/cairo-renderer.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 99f667813..c801821c8 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -753,15 +753,17 @@ CairoRenderContext::popLayer() } } void CairoRenderContext::tagBegin(const char* l){ - char link[1000] = "uri='"; - if(strlen(l)<990) - strcat(link, l); - strcat(link, "'"); +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 4) + char* link = g_strdup_printf("uri='%s'", l); cairo_tag_begin(_cr, CAIRO_TAG_LINK, link); + g_free(link); +#endif } void CairoRenderContext::tagEnd(){ +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 4) cairo_tag_end(_cr, CAIRO_TAG_LINK); +#endif } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 6dc3ca4be..c5477e3c2 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -386,14 +386,16 @@ static void sp_anchor_render(SPAnchor *a, CairoRenderContext *ctx) //TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); std::vector l(a->childList(false)); - ctx->tagBegin(a->href); + if (a->href) + ctx->tagBegin(a->href); for(std::vector::const_iterator x = l.begin(); x!= l.end(); ++x){ SPItem *item = dynamic_cast(*x); if (item) { renderer->renderItem(ctx, item); } } - ctx->tagEnd(); + if (a->href) + ctx->tagEnd(); } static void sp_symbol_render(SPSymbol *symbol, CairoRenderContext *ctx) -- cgit v1.2.3