librsvg r1150 - trunk
- From: doml svn gnome org
- To: svn-commits-list gnome org
- Subject: librsvg r1150 - trunk
- Date: Wed, 20 Feb 2008 16:14:35 +0000 (GMT)
Author: doml
Date: Wed Feb 20 16:14:35 2008
New Revision: 1150
URL: http://svn.gnome.org/viewvc/librsvg?rev=1150&view=rev
Log:
2008-02-20 Dominic Lachowicz <domlachowicz gmail com>
* Fixes last bug @ below url. Text inside of text and tspan nodes
now gets coalesced, so that we can pass it all to a single PangoLayout.
This fixes some rendering bugs.
Modified:
trunk/ChangeLog
trunk/rsvg-base.c
Modified: trunk/rsvg-base.c
==============================================================================
--- trunk/rsvg-base.c (original)
+++ trunk/rsvg-base.c Wed Feb 20 16:14:35 2008
@@ -704,6 +704,38 @@
if (!ch || !len)
return;
+ if (ctx->priv->currentnode)
+ {
+ if (!strcmp ("tspan", ctx->priv->currentnode->type->str) ||
+ !strcmp ("text", ctx->priv->currentnode->type->str))
+ {
+ guint i;
+
+ /* find the last CHARS node in the text or tspan node, so that we
+ can coalesce the text, and thus avoid screwing up the Pango layouts */
+ self = NULL;
+ for (i = 0; i < ctx->priv->currentnode->children->len; i++) {
+ RsvgNode *node = g_ptr_array_index (ctx->priv->currentnode->children, i);
+ if (!strcmp (node->type->str, "RSVG_NODE_CHARS")) {
+ self = (RsvgNodeChars*)node;
+ }
+ }
+
+ if (self != NULL) {
+ if (!g_utf8_validate ((char *) ch, len, NULL)) {
+ char *utf8;
+ utf8 = rsvg_make_valid_utf8 ((char *) ch, len);
+ g_string_append (self->contents, utf8);
+ g_free (utf8);
+ } else {
+ g_string_append_len (self->contents, (char *)ch, len);
+ }
+
+ return;
+ }
+ }
+ }
+
self = g_new (RsvgNodeChars, 1);
_rsvg_node_init (&self->super);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]