Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYves Combe <ycombe@src.gnome.org>2005-08-29 13:21:09 (GMT)
committer Yves Combe <ycombe@src.gnome.org>2005-08-29 13:21:09 (GMT)
commit781cd5af24e3241ae7a7a8203df20df14723a20a (patch)
tree20dbb812e3b392f8e3cff45f9d7bc7c06e90a037 /src
parenta20481d48ce29f35da563176baa45e8aee99e748 (diff)
fix horizontal space replacing 'x' overwrite by black background.
Diffstat (limited to 'src')
-rw-r--r--src/boards/reading.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/boards/reading.c b/src/boards/reading.c
index a1ea8e5..57cbaf3 100644
--- a/src/boards/reading.c
+++ b/src/boards/reading.c
@@ -1,6 +1,6 @@
/* gcompris - reading.c
*
- * Time-stamp: <2005/08/29 09:26:18 yves>
+ * Time-stamp: <2005/08/29 15:09:51 yves>
*
* Copyright (C) 2000 Bruno Coudoin
*
@@ -73,8 +73,10 @@ static LettersItem toDeleteFocus;
gint current_x;
gint current_y;
gint numberOfLine;
+gint font_size;
gint interline;
+
static void start_board (GcomprisBoard *agcomprisBoard);
static void pause_board (gboolean pause);
static void end_board (void);
@@ -187,9 +189,10 @@ static void start_board (GcomprisBoard *agcomprisBoard)
gcomprisBoard->maxlevel = 9;
gcompris_bar_set(GCOMPRIS_BAR_LEVEL);
- interline = (int) (1.5*PANGO_PIXELS(pango_font_description_get_size (pango_font_description_from_string (gcompris_skin_font_board_medium))));
+ font_size = PANGO_PIXELS(pango_font_description_get_size (pango_font_description_from_string (gcompris_skin_font_board_medium)));
+ interline = (int) (1.5*font_size);
- g_warning ("Font to display words have size %d", interline);
+ g_warning ("Font to display words have size %d", font_size);
/* Default mode */
currentMode=MODE_VERTICAL;
@@ -426,10 +429,6 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent)
if(textToFindIndex>=0)
textToFindIndex--;
- /* fill up the overword with X */
-
- overword = g_strnfill (g_utf8_strlen(word,-1),'x');
-
previousFocus.rootItem = \
GNOME_CANVAS_GROUP( gnome_canvas_item_new (parent,
gnome_canvas_group_get_type (),
@@ -451,18 +450,32 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent)
"fill_color", "black",
NULL);
+
+ PangoAttrList *pango_list = pango_attr_list_new ();
+
+ PangoAttribute *bg_color = pango_attr_background_new (0xFF,
+ 0xFF,
+ 0xFF);
+
+ bg_color->start_index = 0;
+ bg_color->end_index = g_utf8_strlen(word,-1) + 1;
+
+ pango_attr_list_insert (pango_list,
+ bg_color);
+
previousFocus.overwriteItem = \
gnome_canvas_item_new (GNOME_CANVAS_GROUP(previousFocus.rootItem),
gnome_canvas_text_get_type (),
- "text", overword,
+ "text", word,
"font-desc", pango_font_description_from_string (gcompris_skin_font_board_medium),
"x", (double) 0,
"y", (double) 0,
"anchor", anchor,
"fill_color", "black",
+ "attributes", pango_list,
NULL);
+
gnome_canvas_item_hide(previousFocus.overwriteItem);
- g_free(overword);
// Calculate the next spot
if(currentMode==MODE_VERTICAL)
@@ -485,7 +498,7 @@ static gboolean reading_create_item(GnomeCanvasGroup *parent)
current_x = BASE_X1;
numberOfLine--;
}
- current_x += x2-x1 + 12;
+ current_x += x2-x1 + font_size;
}
return (TRUE);