summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2010-02-25 19:03:16 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2010-02-25 19:03:16 +0000
commit1a16023189984da1735d6b2ea640af683443a136 (patch)
tree3ea16e8a0957a27b10a5c5826e76507ae10d8a56 /src
parentremove whitespace (diff)
downloadinkscape-1a16023189984da1735d6b2ea640af683443a136.tar.gz
inkscape-1a16023189984da1735d6b2ea640af683443a136.zip
fix 2 bugs
(bzr r9101.1.22)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/latex-text-renderer.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 825291e8c..78b17a000 100644
--- a/src/extension/internal/latex-text-renderer.cpp
+++ b/src/extension/internal/latex-text-renderer.cpp
@@ -251,32 +251,28 @@ LaTeXTextRenderer::sp_text_render(SPItem *item)
SPStyle *style = SP_OBJECT_STYLE (SP_OBJECT(item));
gchar *str = sp_te_get_string_multiline(item);
+ if (!str) {
+ return;
+ }
// get position and alignment
// Align vertically on the baseline of the font (retreived from the anchor point)
- // Align horizontally on boundingbox
- Geom::Coord pos_x;
+ // Align horizontally on anchorpoint
gchar *alignment = NULL;
- Geom::OptRect bbox = item->getBounds(transform());
- Geom::Interval bbox_x = (*bbox)[Geom::X];
switch (style->text_anchor.computed) {
case SP_CSS_TEXT_ANCHOR_START:
- pos_x = bbox_x.min();
alignment = "[lb]";
break;
case SP_CSS_TEXT_ANCHOR_END:
- pos_x = bbox_x.max();
alignment = "[rb]";
break;
case SP_CSS_TEXT_ANCHOR_MIDDLE:
default:
- pos_x = bbox_x.middle();
alignment = "[b]";
break;
}
Geom::Point anchor = textobj->attributes.firstXY() * transform();
- // If we want to align horizontally on bbox: Geom::Point pos(pos_x, anchor[Geom::Y]);
- Geom::Point pos(anchor[Geom::X], anchor[Geom::Y]);
+ Geom::Point pos(anchor);
// determine color (for now, use rgb color model as it is most native to Inkscape)
bool has_color = false; // if the item has no color set, don't force black color
@@ -393,6 +389,10 @@ LaTeXTextRenderer::setupDocument(SPDocument *doc, bool pageBoundingBox, SPItem *
} else {
sp_item_invoke_bbox(base, d, sp_item_i2d_affine(base), TRUE, SPItem::RENDERING_BBOX);
}
+ if (!d) {
+ g_message("LaTeXTextRenderer: could not retrieve boundingbox.");
+ return false;
+ }
// scale all coordinates, such that the width of the image is 1, this is convenient for scaling the image in LaTeX
double scale = 1/(d->width());