=== modified file 'src/extension/internal/pdfinput/svg-builder.cpp' --- src/extension/internal/pdfinput/svg-builder.cpp 2014-02-11 13:56:11 +0000 +++ src/extension/internal/pdfinput/svg-builder.cpp 2014-02-25 18:51:44 +0000 @@ -1256,19 +1256,23 @@ Glib::ustring text_buffer; // Output all buffered glyphs + std::vector::iterator prev_iterator = _glyphs.end(); // will not have a real value until bottom of first loop while (1) { const SvgGlyph& glyph = (*i); - std::vector::iterator prev_iterator = i - 1; // Check if we need to make a new tspan - if (glyph.style_changed) { - new_tspan = true; - } else if ( i != _glyphs.begin() ) { - const SvgGlyph& prev_glyph = (*prev_iterator); - if ( !( ( glyph.dy == 0.0 && prev_glyph.dy == 0.0 && - glyph.text_position[1] == prev_glyph.text_position[1] ) || - ( glyph.dx == 0.0 && prev_glyph.dx == 0.0 && - glyph.text_position[0] == prev_glyph.text_position[0] ) ) ) { + if (i == _glyphs.end()) { + new_tspan = false; + } else { + if (glyph.style_changed) { new_tspan = true; + } else if ( i != _glyphs.begin() ) { + const SvgGlyph& prev_glyph = (*prev_iterator); + if ( !( ( glyph.dy == 0.0 && prev_glyph.dy == 0.0 && + glyph.text_position[1] == prev_glyph.text_position[1] ) || + ( glyph.dx == 0.0 && prev_glyph.dx == 0.0 && + glyph.text_position[0] == prev_glyph.text_position[0] ) ) ) { + new_tspan = true; + } } } @@ -1302,7 +1306,8 @@ Inkscape::GC::release(tspan_node); glyphs_in_a_row = 0; } - if ( i == _glyphs.end() ) { + if ( i == _glyphs.end()) { + // prev_iterator must exist because .end() cannot be .begin() sp_repr_css_attr_unref((*prev_iterator).style); break; } else { @@ -1354,6 +1359,7 @@ } glyphs_in_a_row++; + prev_iterator = i; ++i; } _container->appendChild(text_node);