diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index cab71e94a601f14bd53176c41ee29af8a09cf624..be098b7e9ede655f0999ee55b5c2a2842cec9922 100644 (file)
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
Inkscape::Text::Layout::iterator
sp_te_get_position_by_coords (SPItem const *item, NR::Point &i_p)
{
- NR::Matrix im=sp_item_i2d_affine (item);
+ NR::Matrix im (sp_item_i2d_affine (item));
im = im.inverse();
NR::Point p = i_p * im;
@@ -270,6 +270,9 @@ static Inkscape::XML::Node* duplicate_node_without_children(Inkscape::XML::Docum
case Inkscape::XML::COMMENT_NODE:
return xml_doc->createComment(old_node->content());
+ case Inkscape::XML::PI_NODE:
+ return xml_doc->createPI(old_node->name(), old_node->content());
+
case Inkscape::XML::DOCUMENT_NODE:
return NULL; // this had better never happen
}
@@ -395,7 +398,7 @@ Inkscape::Text::Layout::iterator sp_te_insert_line (SPItem *item, Inkscape::Text
// TODO
// I think the only case to put here is arbitrary gaps, which nobody uses yet
}
- item->updateRepr(SP_OBJECT_REPR(item),SP_OBJECT_WRITE_EXT);
+ item->updateRepr();
unsigned char_index = layout->iteratorToCharIndex(position);
te_update_layout_now(item);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -517,7 +520,7 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch
}
}
- item->updateRepr(SP_OBJECT_REPR(item),SP_OBJECT_WRITE_EXT);
+ item->updateRepr();
unsigned char_index = layout->iteratorToCharIndex(position);
te_update_layout_now(item);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -945,7 +948,7 @@ sp_te_adjust_kerning_screen (SPItem *item, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- NR::Matrix t = sp_item_i2doc_affine(item);
+ NR::Matrix t (sp_item_i2doc_affine(item));
factor = factor / NR::expansion(t);
by = factor * by;
@@ -967,7 +970,7 @@ sp_te_adjust_rotation_screen(SPItem *text, Inkscape::Text::Layout::iterator cons
// divide increment by zoom
// divide increment by matrix expansion
gdouble factor = 1 / desktop->current_zoom();
- NR::Matrix t = sp_item_i2doc_affine(text);
+ NR::Matrix t (sp_item_i2doc_affine(text));
factor = factor / NR::expansion(t);
Inkscape::Text::Layout const *layout = te_get_layout(text);
if (layout == NULL) return;
@@ -1083,6 +1086,19 @@ sp_te_adjust_tspan_letterspacing_screen(SPItem *text, Inkscape::Text::Layout::it
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
}
+double
+sp_te_get_average_linespacing (SPItem *text)
+{
+ Inkscape::Text::Layout const *layout = te_get_layout(text);
+ if (!layout)
+ return 0;
+
+ unsigned line_count = layout->lineIndex(layout->end());
+ double all_lines_height = layout->characterAnchorPoint(layout->end())[NR::Y] - layout->characterAnchorPoint(layout->begin())[NR::Y];
+ double average_line_height = all_lines_height / (line_count == 0 ? 1 : line_count);
+ return average_line_height;
+}
+
void
sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator const &/*start*/, Inkscape::Text::Layout::iterator const &/*end*/, SPDesktop *desktop, gdouble by)
{
@@ -1111,7 +1127,7 @@ sp_te_adjust_linespacing_screen (SPItem *text, Inkscape::Text::Layout::iterator
gdouble zby = by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count));
// divide increment by matrix expansion
- NR::Matrix t = sp_item_i2doc_affine (SP_ITEM(text));
+ NR::Matrix t (sp_item_i2doc_affine (SP_ITEM(text)));
zby = zby / NR::expansion(t);
switch (style->line_height.unit) {
the repeated strings will be merged by another operator. */
static bool tidy_operator_inexplicable_spans(SPObject **item)
{
+ if (*item && sp_repr_is_meta_element((*item)->repr)) return false;
if (SP_IS_STRING(*item)) return false;
if (is_line_break_object(*item)) return false;
TextTagAttributes *attrs = attributes_for_object(*item);
for ( ; ; ) { // go up one item in the xml
test_item = SP_OBJECT_PARENT(test_item);
if (is_line_break_object(test_item)) break;
+ if (SP_IS_FLOWTEXT(test_item)) return false;
SPObject *next = SP_OBJECT_NEXT(test_item);
if (next) {
test_item = next;