summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-04-10 21:23:11 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-04-10 21:23:11 +0000
commit28ad8dcc8291ea4fecf59fd27c6d67e2778c540a (patch)
treed2407f7448e054b32744d9fc01a57746d8f07618 /src
parentgo wild adding % at the end of each latex line (pdf+latex output) (diff)
downloadinkscape-28ad8dcc8291ea4fecf59fd27c6d67e2778c540a.tar.gz
inkscape-28ad8dcc8291ea4fecf59fd27c6d67e2778c540a.zip
pdf+latex: fix newline bug due to changes in r10089
(bzr r10155)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/latex-text-renderer.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index a443a905a..417dbb9ff 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -266,10 +266,15 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
SPText *textobj = SP_TEXT (item);
SPStyle *style = item->style;
- gchar *str = sp_te_get_string_multiline(item);
- if (!str) {
+ gchar *strtext = sp_te_get_string_multiline(item);
+ if (!strtext) {
return;
}
+ // replace carriage return with double slash
+ gchar ** splitstr = g_strsplit(strtext, "\n", -1);
+ gchar *str = g_strjoinv("\\\\ ", splitstr);
+ g_free(strtext);
+ g_strfreev(splitstr);
// get position and alignment
// Align vertically on the baseline of the font (retreived from the anchor point)
@@ -361,8 +366,17 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
Inkscape::Text::Layout::iterator ln = li;
ln.nextStartOfSpan();
- Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln);
- os << spanstr;
+ Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln);
+ const gchar *spanstr = uspanstr.c_str();
+ if (!spanstr) {
+ continue;
+ }
+ // replace carriage return with double slash
+ gchar ** splitstr = g_strsplit(spanstr, "\n", -1);
+ gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr);
+ os << spanstr_new;
+ g_strfreev(splitstr);
+ g_free(spanstr_new);
if (is_italic) { os << "}"; } // italic end
if (is_bold) { os << "}"; } // bold end
@@ -389,16 +403,6 @@ Flowing in rectangle is possible, not in arb shape.
SPFlowtext *flowtext = SP_FLOWTEXT(item);
SPStyle *style = item->style;
- gchar *strtext = sp_te_get_string_multiline(item);
- if (!strtext) {
- return;
- }
- // replace carriage return with double slash
- gchar ** splitstr = g_strsplit(strtext, "\n", -1);
- gchar *str = g_strjoinv("\\\\ ", splitstr);
- g_free(strtext);
- g_strfreev(splitstr);
-
SPItem *frame_item = flowtext->get_frame(NULL);
if (!frame_item || !SP_IS_RECT(frame_item)) {
g_warning("LaTeX export: non-rectangular flowed text shapes are not supported, skipping text.");
@@ -500,8 +504,17 @@ Flowing in rectangle is possible, not in arb shape.
Inkscape::Text::Layout::iterator ln = li;
ln.nextStartOfSpan();
- Glib::ustring spanstr = sp_te_get_string_multiline (item, li, ln);
- os << spanstr;
+ Glib::ustring uspanstr = sp_te_get_string_multiline (item, li, ln);
+ const gchar *spanstr = uspanstr.c_str();
+ if (!spanstr) {
+ continue;
+ }
+ // replace carriage return with double slash
+ gchar ** splitstr = g_strsplit(spanstr, "\n", -1);
+ gchar *spanstr_new = g_strjoinv("\\\\ ", splitstr);
+ os << spanstr_new;
+ g_strfreev(splitstr);
+ g_free(spanstr_new);
if (is_italic) { os << "}"; } // italic end
if (is_bold) { os << "}"; } // bold end