mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
bce367d60b
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
130 lines
4.6 KiB
Diff
130 lines
4.6 KiB
Diff
From 61431fec37ed855db7284c6737cb3777577cc904 Mon Sep 17 00:00:00 2001
|
|
From: Hans Breuer <hans@breuer.org>
|
|
Date: Fri, 16 Aug 2013 20:54:12 +0200
|
|
Subject: [PATCH 18/24] Bug 683700 - vdx full of errors
|
|
|
|
Ensure message_error strings are linefeed-terminated.
|
|
Plus fixes merged from master:
|
|
|
|
cairo: don't screw cairo's matrix by scaling with 0
|
|
Seen with the VDX attached to bug 683700 - maybe there is also something wrong with the import?
|
|
|
|
vdx: UTF-8 safe variant to remove last newline
|
|
With the VDX attached to bug 683700 scrambled text appeared. Now corrected with the UTF-8 safe variant to search and replace "\n".
|
|
---
|
|
plug-ins/cairo/diacairo-renderer.c | 23 ++++++-----------------
|
|
plug-ins/vdx/vdx-import.c | 21 +++++++++++++++++++--
|
|
plug-ins/vdx/vdx-xml.c | 2 +-
|
|
3 files changed, 26 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
|
|
index 137411e..57f6184 100644
|
|
--- a/plug-ins/cairo/diacairo-renderer.c
|
|
+++ b/plug-ins/cairo/diacairo-renderer.c
|
|
@@ -572,9 +572,14 @@ _ellipse(DiaRenderer *self,
|
|
DIAG_NOTE(g_message("%s_ellipse %fx%f center @ %f,%f",
|
|
fill ? "fill" : "draw", width, height, center->x, center->y));
|
|
|
|
+ /* avoid screwing cairo context - I'd say restore should fix it again, but it doesn't
|
|
+ * (dia.exe:3152): DiaCairo-WARNING **: diacairo-renderer.c:254, invalid matrix (not invertible)
|
|
+ */
|
|
+ if (!(width > 0. && height > 0.))
|
|
+ return;
|
|
+
|
|
cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);
|
|
|
|
-#if 1
|
|
cairo_save (renderer->cr);
|
|
/* don't create a line from the current point to the beginning
|
|
* of the ellipse */
|
|
@@ -584,22 +589,6 @@ _ellipse(DiaRenderer *self,
|
|
cairo_scale (renderer->cr, width / 2., height / 2.);
|
|
cairo_arc (renderer->cr, 0., 0., 1., 0., 2 * G_PI);
|
|
cairo_restore (renderer->cr);
|
|
-#else
|
|
- /* FIXME: how to make a perfect ellipse from a bezier ? */
|
|
- co = sqrt(pow(width,2)/4 + pow(height,2)/4);
|
|
-
|
|
- cairo_new_path (renderer->cr);
|
|
- cairo_move_to (renderer->cr,
|
|
- center->x, center->y - height/2);
|
|
- cairo_curve_to (renderer->cr,
|
|
- center->x + co, center->y - height/2,
|
|
- center->x + co, center->y + height/2,
|
|
- center->x, center->y + height/2);
|
|
- cairo_curve_to (renderer->cr,
|
|
- center->x - co, center->y + height/2,
|
|
- center->x - co, center->y - height/2,
|
|
- center->x, center->y - height/2);
|
|
-#endif
|
|
|
|
if (fill)
|
|
cairo_fill (renderer->cr);
|
|
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
|
|
index ffefa58..7da0c05 100644
|
|
--- a/plug-ins/vdx/vdx-import.c
|
|
+++ b/plug-ins/vdx/vdx-import.c
|
|
@@ -1737,7 +1737,7 @@ plot_nurbs(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
|
|
}
|
|
if (n % 4 || ! n)
|
|
{
|
|
- message_error(_("Invalid NURBS formula"));
|
|
+ message_error(_("Invalid NURBS formula\n"));
|
|
g_debug("Invalid NURBS formula");
|
|
return 0;
|
|
}
|
|
@@ -2066,7 +2066,7 @@ plot_image(const struct vdx_Geom *Geom, const struct vdx_XForm *XForm,
|
|
}
|
|
else
|
|
{
|
|
- message_error(_("Couldn't handle foreign object type %s"),
|
|
+ message_error(_("Couldn't handle foreign object type %s\n"),
|
|
ForeignData->ForeignType ? ForeignData->ForeignType
|
|
: "Unknown");
|
|
return 0;
|
|
@@ -2398,12 +2398,29 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
|
|
}
|
|
}
|
|
|
|
+#if 0 /* this is not utf-8 safe - see bug 683700 */
|
|
/* Remove trailing line breaks */
|
|
while (tprop->text_data[0] &&
|
|
isspace(tprop->text_data[strlen(tprop->text_data)-1]))
|
|
{
|
|
tprop->text_data[strlen(tprop->text_data)-1] = 0;
|
|
}
|
|
+#else
|
|
+ {
|
|
+ char *s = tprop->text_data;
|
|
+ char *srep = NULL;
|
|
+ while ( (s = g_utf8_strchr(s, -1, '\n')) != NULL ) {
|
|
+ srep = s;
|
|
+ s = g_utf8_next_char(s);
|
|
+ if (*s)
|
|
+ srep = NULL;
|
|
+ else
|
|
+ break;
|
|
+ }
|
|
+ if (srep)
|
|
+ *srep = '\0';
|
|
+ }
|
|
+#endif
|
|
|
|
/* Other standard text properties */
|
|
tprop->attr.alignment = alignment;
|
|
diff --git a/plug-ins/vdx/vdx-xml.c b/plug-ins/vdx/vdx-xml.c
|
|
index 1fdac65..1c9567d 100644
|
|
--- a/plug-ins/vdx/vdx-xml.c
|
|
+++ b/plug-ins/vdx/vdx-xml.c
|
|
@@ -3341,7 +3341,7 @@ vdx_read_object(xmlNodePtr cur, VDXDocument *theDoc, void *p)
|
|
return s;
|
|
}
|
|
|
|
- message_error(_("Can't decode object %s"), (char*)cur->name);
|
|
+ message_error(_("Can't decode object %s\n"), (char*)cur->name);
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
1.8.4.4
|
|
|