diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 00bd8fa4d8df9e00b2f09492381cd60b99cdd275..e343dbf338a62d404c7c2f6c12679d7acc532dcb 100644 (file)
last_delta_pos = delta_pos;
// Append the character to the text buffer
- if (0 != glyph.code[0]) {
- text_buffer.append((char *)&glyph.code, 1);
+ if ( !glyph.code.empty() ) {
+ text_buffer.append(1, glyph.code[0]);
}
glyphs_in_a_row++;
return;
}
// Allow only one space in a row
- if ( is_space && _glyphs[_glyphs.size() - 1].code_size == 1 &&
- _glyphs[_glyphs.size() - 1].code[0] == 32 ) {
+ if ( is_space && (_glyphs[_glyphs.size() - 1].code.size() == 1) &&
+ (_glyphs[_glyphs.size() - 1].code[0] == 32) ) {
Geom::Point delta(dx, dy);
_text_position += delta;
return;
_text_position += delta;
// Convert the character to UTF-8 since that's our SVG document's encoding
- static UnicodeMap *u_map = NULL;
- if ( u_map == NULL ) {
- GooString *enc = new GooString("UTF-8");
- u_map = globalParams->getUnicodeMap(enc);
- u_map->incRefCnt();
- delete enc;
- }
- int code_size = 0;
- for ( int i = 0 ; i < uLen ; i++ ) {
- code_size += u_map->mapUnicode(u[i], (char *)&new_glyph.code[code_size], sizeof(new_glyph.code) - code_size);
+ {
+ gunichar2 uu[8] = {0};
+
+ for (int i = 0; i < uLen; i++) {
+ uu[i] = u[i];
+ }
+
+ gchar *tmp = g_utf16_to_utf8(uu, uLen, NULL, NULL, NULL);
+ if ( tmp && *tmp ) {
+ new_glyph.code = tmp;
+ } else {
+ new_glyph.code.clear();
+ }
+ g_free(tmp);
}
- new_glyph.code_size = code_size;
// Copy current style if it has changed since the previous glyph
if (_invalidated_style || _glyphs.size() == 0 ) {
@@ -1536,7 +1539,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
}
png_write_row(png_ptr, (png_bytep)buffer);
}
- delete buffer;
+ delete [] buffer;
} else if (color_map) {
image_stream = new ImageStream(str, width,
color_map->getNumPixelComps(),
@@ -1575,7 +1578,7 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
png_write_row(png_ptr, (png_bytep)buffer);
}
}
- delete buffer;
+ delete [] buffer;
} else { // A colormap must be provided, so quit
png_destroy_write_struct(&png_ptr, &info_ptr);