[tbo] Do not load empty text objects
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tbo] Do not load empty text objects
- Date: Sat, 30 Mar 2013 11:25:08 +0000 (UTC)
commit af7954ea4d0e8d487f6afd196792a816a55b63db
Author: Daniel Garcia Moreno <danigm wadobo com>
Date: Sat Mar 30 12:24:20 2013 +0100
Do not load empty text objects
src/comic-load.c | 9 ++++++++-
src/tbo-object-text.c | 4 ++++
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/comic-load.c b/src/comic-load.c
index bb608db..01609af 100644
--- a/src/comic-load.c
+++ b/src/comic-load.c
@@ -270,7 +270,14 @@ text (GMarkupParseContext *context,
if (CURRENT_TEXT)
{
char *text2 = g_strndup (text, text_len);
- tbo_object_text_set_text (CURRENT_TEXT, g_strstrip (text2));
+
+ gchar *text3 = g_strstrip (text2);
+ if (strlen(text3)) {
+ tbo_object_text_set_text (CURRENT_TEXT, text3);
+ } else {
+ tbo_frame_del_obj (CURRENT_FRAME, CURRENT_TEXT);
+ CURRENT_TEXT = NULL;
+ }
g_free (text2);
}
}
diff --git a/src/tbo-object-text.c b/src/tbo-object-text.c
index 55b3e0e..fe7cc4c 100644
--- a/src/tbo-object-text.c
+++ b/src/tbo-object-text.c
@@ -42,6 +42,10 @@ draw (TboObjectBase *self, Frame *frame, cairo_t *cr)
int w;
int h;
+ if (!strlen(text)) {
+ return;
+ }
+
gdk_cairo_set_source_color (cr, textobj->font_color);
layout = pango_cairo_create_layout (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]