summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: faf6706)
raw | patch | inline | side by side (parent: faf6706)
author | Johan Engelen <goejendaagh@zonnet.nl> | |
Thu, 25 Feb 2010 19:03:16 +0000 (20:03 +0100) | ||
committer | Johan Engelen <goejendaagh@zonnet.nl> | |
Thu, 25 Feb 2010 19:03:16 +0000 (20:03 +0100) |
src/extension/internal/latex-text-renderer.cpp | patch | blob | history |
diff --git a/src/extension/internal/latex-text-renderer.cpp b/src/extension/internal/latex-text-renderer.cpp
index 825291e8c6b6115be282731eca3c7e0b1551b971..78b17a000e095119a8766d906b379a1a3f42992b 100644 (file)
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());