summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-10-30 17:06:17 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-10-30 17:06:17 +0000
commit3065e264e8e7a4b564b61c25d3897757bb0c8c91 (patch)
tree986f576c63e0a96266f9a520e9b7d552b7dbe183
parentUpdate the treeview in the objects-panel asynchronously, such that Inkscape s... (diff)
downloadinkscape-3065e264e8e7a4b564b61c25d3897757bb0c8c91.tar.gz
inkscape-3065e264e8e7a4b564b61c25d3897757bb0c8c91.zip
PDF+LaTeX export: escape ampersands
Fixes https://gitlab.com/inkscape/inbox/issues/1104
Diffstat (limited to '')
-rw-r--r--src/extension/internal/latex-text-renderer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index ad918d826..35cbb4544 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -21,10 +21,12 @@
#include <csignal>
#include <cerrno>
+#include <glibmm/i18n.h>
+#include <glibmm/regex.h>
+
#include "libnrtype/Layout-TNG.h"
#include <2geom/transforms.h>
#include <2geom/rect.h>
-#include <glibmm/i18n.h>
#include "object/sp-item.h"
#include "object/sp-item-group.h"
@@ -364,6 +366,10 @@ void LaTeXTextRenderer::sp_text_render(SPText *textobj)
Inkscape::Text::Layout::iterator ln = li;
ln.nextStartOfSpan();
Glib::ustring uspanstr = sp_te_get_string_multiline (textobj, li, ln);
+
+ // escape ampersands
+ uspanstr = Glib::Regex::create("&")->replace_literal(uspanstr, 0, "\\&", (Glib::RegexMatchFlags)0);
+
const gchar *spanstr = uspanstr.c_str();
if (!spanstr) {
continue;