diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 325b3b381e3132659c61bdd5ebe9d5705c0062d3..b45f8cbb607d3a67d6aac7f7f39bc2384364a0d1 100644 (file)
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
static void sp_text_init (SPText *text);
static void sp_text_release (SPObject *object);
-static void sp_text_build (SPObject *object, Document *document, Inkscape::XML::Node *repr);
+static void sp_text_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_text_set (SPObject *object, unsigned key, gchar const *value);
static void sp_text_child_added (SPObject *object, Inkscape::XML::Node *rch, Inkscape::XML::Node *ref);
static void sp_text_remove_child (SPObject *object, Inkscape::XML::Node *rch);
}
static void
-sp_text_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr)
+sp_text_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
{
sp_object_read_attr(object, "x");
sp_object_read_attr(object, "y");
GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getDefaultMetric());
+ char *trunc = "";
+ Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
+ if (layout && layout->inputTruncated()) {
+ trunc = _(" [truncated]");
+ }
+
char *ret = ( SP_IS_TEXT_TEXTPATH(item)
- ? g_strdup_printf(_("<b>Text on path</b> (%s, %s)"), n, xs->str)
- : g_strdup_printf(_("<b>Text</b> (%s, %s)"), n, xs->str) );
+ ? g_strdup_printf(_("<b>Text on path</b>%s (%s, %s)"), trunc, n, xs->str)
+ : g_strdup_printf(_("<b>Text</b>%s (%s, %s)"), trunc, n, xs->str) );
g_free(n);
return ret;
}
static void sp_text_snappoints(SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const */*snapprefs*/)
{
- // the baseline anchor of the first char
+ // Choose a point on the baseline for snapping from or to, with the horizontal position
+ // of this point depending on the text alignment (left vs. right)
Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
- if(layout != NULL) {
- int type = target ? int(Inkscape::SNAPTARGET_TEXT_BASELINE) : int(Inkscape::SNAPSOURCE_TEXT_BASELINE);
- p.push_back(std::make_pair(layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item), type));
+ if (layout != NULL && layout->outputExists()) {
+ boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
+ if (pt) {
+ int type = target ? int(Inkscape::SNAPTARGET_TEXT_BASELINE) : int(Inkscape::SNAPSOURCE_TEXT_BASELINE);
+ p.push_back(std::make_pair((*pt) * sp_item_i2d_affine(item), type));
+ }
}
}
SVGLength zero_length;
zero_length = 0.0;
- if (attributes.rotate.size() < index + 1) {
+ if (attributes.rotate.size() < index + 2) {
if (attributes.rotate.empty())
- attributes.rotate.resize(index + 1, zero_length);
+ attributes.rotate.resize(index + 2, zero_length);
else
- attributes.rotate.resize(index + 1, attributes.rotate.back());
+ attributes.rotate.resize(index + 2, attributes.rotate.back());
}
attributes.rotate[index] = mod360(attributes.rotate[index].computed + delta);
}