diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index b9583545fb3ed237f0b336769b625aa775e5f11f..8b414239a708d9c8e5a8a537491aeef07518801e 100644 (file)
*
* Authors:
* miklos erdelyi
*
* Authors:
* miklos erdelyi
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2007 Authors
*
*
* Copyright (C) 2007 Authors
*
*
*/
*
*/
-SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) {
+SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref)
+{
_is_top_level = true;
_doc = document;
_docname = docname;
_xref = xref;
_is_top_level = true;
_doc = document;
_docname = docname;
_xref = xref;
- _xml_doc = sp_document_repr_doc(_doc);
+ _xml_doc = _doc->getReprDoc();
_container = _root = _doc->rroot;
_root->setAttribute("xml:space", "preserve");
_init();
_container = _root = _doc->rroot;
_root->setAttribute("xml:space", "preserve");
_init();
last_delta_pos = delta_pos;
// Append the character to the text buffer
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++;
}
glyphs_in_a_row++;
return;
}
// Allow only one space 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;
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
_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);
- }
- new_glyph.code_size = 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);
+ }
// Copy current style if it has changed since the previous glyph
if (_invalidated_style || _glyphs.size() == 0 ) {
// Copy current style if it has changed since the previous glyph
if (_invalidated_style || _glyphs.size() == 0 ) {