diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-07-04 09:44:01 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-07-04 09:44:01 +0000 |
| commit | 0df291b7bdfe888cb07e35a75eab2c5eb183fef1 (patch) | |
| tree | ac677c227c943adc6cdb1459c8f34f5799da0751 | |
| parent | Export links to pdf. Fixes https://gitlab.com/inkscape/inbox/issues/583 (diff) | |
| download | inkscape-0df291b7bdfe888cb07e35a75eab2c5eb183fef1.tar.gz inkscape-0df291b7bdfe888cb07e35a75eab2c5eb183fef1.zip | |
Fix link export code
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 10 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 6 |
2 files changed, 10 insertions, 6 deletions
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<SPObject*> l(a->childList(false)); - ctx->tagBegin(a->href); + if (a->href) + ctx->tagBegin(a->href); for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); ++x){ SPItem *item = dynamic_cast<SPItem*>(*x); if (item) { renderer->renderItem(ctx, item); } } - ctx->tagEnd(); + if (a->href) + ctx->tagEnd(); } static void sp_symbol_render(SPSymbol *symbol, CairoRenderContext *ctx) |
