diff --git a/src/sp-string.cpp b/src/sp-string.cpp
index b424ac3d8c318ee10e14af386b7c4b1f97fa886f..c116e8dd854b3f2f1dcd6d59eaf8b074cdb20d1a 100644 (file)
--- a/src/sp-string.cpp
+++ b/src/sp-string.cpp
-#define __SP_STRING_C__
-
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
SPString *string = SP_STRING(object);
string->string.clear();
SPString *string = SP_STRING(object);
string->string.clear();
- gchar const *xml_string = string->repr->content();
+
+ //XML Tree being used directly here while it shouldn't be.
+ gchar const *xml_string = string->getRepr()->content();
// see algorithms described in svg 1.1 section 10.15
if (object->xml_space.value == SP_XML_SPACE_PRESERVE) {
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
// see algorithms described in svg 1.1 section 10.15
if (object->xml_space.value == SP_XML_SPACE_PRESERVE) {
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
- if (c == 0xa || c == 0xd || c == '\t') c = ' ';
+ if ((c == 0xa) || (c == 0xd) || (c == '\t')) {
+ c = ' ';
+ }
string->string += c;
}
}
string->string += c;
}
}
bool whitespace = false;
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
bool whitespace = false;
for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) {
gunichar c = g_utf8_get_char(xml_string);
- if (c == 0xa || c == 0xd) continue;
- if (c == ' ' || c == '\t') whitespace = true;
- else {
- if (whitespace && (!string->string.empty() || SP_OBJECT_PREV(object) != NULL))
+ if ((c == 0xa) || (c == 0xd)) {
+ continue;
+ }
+ if ((c == ' ') || (c == '\t')) {
+ whitespace = true;
+ } else {
+ if (whitespace && (!string->string.empty() || (object->getPrev() != NULL))) {
string->string += ' ';
string->string += ' ';
+ }
string->string += c;
whitespace = false;
}
}
string->string += c;
whitespace = false;
}
}
- if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) // can't use SP_OBJECT_NEXT() when the SPObject tree is still being built
+ if (whitespace && SP_OBJECT_REPR(object)->next() != NULL) { // can't use SPObject::getNext() when the SPObject tree is still being built
string->string += ' ';
string->string += ' ';
+ }
}
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
}
object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}