summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2017-07-19 13:50:07 +0200
committerFlorian Pelz <pelzflorian@pelzflorian.de>2017-07-19 13:50:07 +0200
commitcd41a25206fcb2136134fbe2f4373f5e5f0af2d1 (patch)
treef5a835dcc2bd39acdc1cb698d14b806057d1f837
parentc6ec36e0f0e9fe19597fefb7b8dd7f4441350ba4 (diff)
Remove broken bidirectional text support in the hangman example.
-rw-r--r--bin/hangman/hangman.c45
1 files changed, 2 insertions, 43 deletions
diff --git a/bin/hangman/hangman.c b/bin/hangman/hangman.c
index 381c13e..7fd92fc 100644
--- a/bin/hangman/hangman.c
+++ b/bin/hangman/hangman.c
@@ -25,7 +25,6 @@ struct _GameData
gchar *used;
gint unichar_count;
PangoLogAttr *log_attrs;
- gunichar default_isolate;
};
typedef struct _GameData GameData;
@@ -177,36 +176,6 @@ get_log_attrs (const gchar *string,
}
static void
-append_underscore_for_char (GString *builder,
- gunichar chr,
- GameData *game_data)
-{
- switch (pango_unichar_direction (chr))
- {
- case PANGO_DIRECTION_LTR:
- case PANGO_DIRECTION_TTB_LTR:
- g_string_append_unichar (builder, 0x2066); /* ltr isolate */
- g_string_append_unichar (builder, '_');
- g_string_append_unichar (builder, 0x2069); /* pop */
- break;
- case PANGO_DIRECTION_RTL:
- case PANGO_DIRECTION_TTB_RTL:
- g_string_append_unichar (builder, 0x2067); /* rtl isolate */
- g_string_append_unichar (builder, '_');
- g_string_append_unichar (builder, 0x2069); /* pop */
- break;
- case PANGO_DIRECTION_WEAK_LTR:
- case PANGO_DIRECTION_WEAK_RTL:
- g_string_append_unichar (builder, '_');
- break;
- default:
- g_string_append_unichar (builder, game_data->default_isolate);
- g_string_append_unichar (builder, '_');
- g_string_append_unichar (builder, 0x2069); /* pop */
- }
-}
-
-static void
new_game (AppData *app_data)
{
GameData *game_data;
@@ -216,8 +185,6 @@ new_game (AppData *app_data)
gint byte_count, unichar_count;
PangoLogAttr *log_attrs;
- PangoDirection direction;
-
game_data = app_data->game_data;
game_data->state = 0;
@@ -236,12 +203,6 @@ new_game (AppData *app_data)
get_log_attrs (tmp, byte_count, unichar_count, &log_attrs);
game_data->log_attrs = log_attrs;
- direction = pango_find_base_dir (tmp, byte_count);
- if (direction == PANGO_DIRECTION_RTL)
- game_data->default_isolate = 0x2067; /* rtl isolate */
- else
- game_data->default_isolate = 0x2066; /* ltr isolate */
-
for (int i = 0; i < unichar_count; i++)
{
if (log_attrs[i].is_cursor_position)
@@ -253,7 +214,7 @@ new_game (AppData *app_data)
if (chr == 0x0020) /* if space */
g_string_append_unichar (builder, chr);
else
- append_underscore_for_char (builder, chr, game_data);
+ g_string_append_unichar (builder, '_');
}
tmp = g_utf8_next_char (tmp);
@@ -377,9 +338,7 @@ play_characters_in_string (const gchar *text,
}
/* No used character in grapheme cluster. */
- append_underscore_for_char (builder,
- g_utf8_get_char (tmp),
- game_data);
+ g_string_append_unichar (builder, '_');
}
after_cluster_check: