summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-04-10 21:55:40 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-04-10 21:55:40 +0000
commit102bcf0bf771f0fc40d8f63ee9c727256b2d70f1 (patch)
treedc03d6a734bd1975bb9447461169626402626989 /src
parentpdf+latex: fix newline bug due to changes in r10089 (diff)
downloadinkscape-102bcf0bf771f0fc40d8f63ee9c727256b2d70f1.tar.gz
inkscape-102bcf0bf771f0fc40d8f63ee9c727256b2d70f1.zip
pdf+latex:
* use textit instead of itshape, use textbf instead of bfseries; this improves kerning * add textsl (slanted) for oblique font shapes (e.g. Arial) (bzr r10156)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/latex-text-renderer.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 417dbb9ff..98142632d 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -345,7 +345,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
li != le; li.nextStartOfSpan())
{
SPStyle const &spanstyle = *(sp_te_style_at_position (item, li));
- bool is_bold = false, is_italic = false;
+ bool is_bold = false, is_italic = false, is_oblique = false;
if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 ||
spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 ||
@@ -356,12 +356,17 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER)
{
is_bold = true;
- os << "{\\bfseries{}";
+ os << "\\textbf{";
}
if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC)
{
is_italic = true;
- os << "{\\itshape{}";
+ os << "\\textit{";
+ }
+ if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE)
+ {
+ is_oblique = true;
+ os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so...
}
Inkscape::Text::Layout::iterator ln = li;
@@ -378,6 +383,7 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
g_strfreev(splitstr);
g_free(spanstr_new);
+ if (is_oblique) { os << "}"; } // oblique end
if (is_italic) { os << "}"; } // italic end
if (is_bold) { os << "}"; } // bold end
}
@@ -483,7 +489,7 @@ Flowing in rectangle is possible, not in arb shape.
li != le; li.nextStartOfSpan())
{
SPStyle const &spanstyle = *(sp_te_style_at_position (item, li));
- bool is_bold = false, is_italic = false;
+ bool is_bold = false, is_italic = false, is_oblique = false;
if (spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_500 ||
spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_600 ||
@@ -494,12 +500,17 @@ Flowing in rectangle is possible, not in arb shape.
spanstyle.font_weight.computed == SP_CSS_FONT_WEIGHT_BOLDER)
{
is_bold = true;
- os << "{\\bfseries{}";
+ os << "\\textbf{";
}
if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_ITALIC)
{
is_italic = true;
- os << "{\\itshape{}";
+ os << "\\textit{";
+ }
+ if (spanstyle.font_style.computed == SP_CSS_FONT_STYLE_OBLIQUE)
+ {
+ is_oblique = true;
+ os << "\\textsl{"; // this is an accurate choice if the LaTeX chosen font matches the font in Inkscape. Gives bad results when it is not so...
}
Inkscape::Text::Layout::iterator ln = li;
@@ -516,6 +527,7 @@ Flowing in rectangle is possible, not in arb shape.
g_strfreev(splitstr);
g_free(spanstr_new);
+ if (is_oblique) { os << "}"; } // oblique end
if (is_italic) { os << "}"; } // italic end
if (is_bold) { os << "}"; } // bold end
}