diff options
Diffstat (limited to 'modules/thai/thai-shaper.c')
-rw-r--r-- | modules/thai/thai-shaper.c | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/modules/thai/thai-shaper.c b/modules/thai/thai-shaper.c index 4cd98283..5fcbc429 100644 --- a/modules/thai/thai-shaper.c +++ b/modules/thai/thai-shaper.c @@ -561,8 +561,6 @@ get_glyphs_list (ThaiFontInfo *font_info, gint num_chrs, PangoGlyph *glyph_lists) { - PangoGlyph glyph; - gint xtis_index; gint i; switch (font_info->font_set) @@ -572,26 +570,6 @@ get_glyphs_list (ThaiFontInfo *font_info, glyph_lists[i] = thai_make_unknown_glyph (font_info, glyph_lists[i]); return num_chrs; - case THAI_FONT_XTIS: - /* If we are rendering with an XTIS font, we try to find a precomposed - * glyph for the cluster. - */ - xtis_index = 0x100 * (cluster[0] - 0xe00 + 0x20) + 0x30; - if (cluster[1]) - xtis_index +=8 * group1_map[cluster[1] - 0xe30]; - if (cluster[2]) - xtis_index += group2_map[cluster[2] - 0xe30]; - glyph = thai_make_glyph (font_info, xtis_index); - if (thai_has_glyph (font_info, glyph)) { - glyph_lists[0] = glyph; - return 1; - } - for (i=0; i < num_chrs; i++) - glyph_lists[i] = - thai_make_glyph (font_info, - 0x100 * (cluster[i] - 0xe00 + 0x20) + 0x30); - return num_chrs; - case THAI_FONT_TIS: /* TIS620-0 + Wtt2.0 Extension */ @@ -629,11 +607,21 @@ add_cluster (ThaiFontInfo *font_info, PangoGlyph glyphs_list[MAX_GLYPHS]; gint num_glyphs; gint i; - - num_glyphs = get_glyphs_list(font_info, cluster, num_chrs, glyphs_list); - for (i=0; i<num_glyphs; i++) - add_glyph (font_info, glyphs, cluster_start, glyphs_list[i], - i == 0 ? FALSE : TRUE); + + if (!isthai (cluster[0])) + { + g_assert (num_chrs == 1); + add_glyph (font_info, glyphs, cluster_start, + thai_make_glyph (font_info, cluster[0]), + FALSE); + } + else + { + num_glyphs = get_glyphs_list(font_info, cluster, num_chrs, glyphs_list); + for (i=0; i<num_glyphs; i++) + add_glyph (font_info, glyphs, cluster_start, glyphs_list[i], + i == 0 ? FALSE : TRUE); + } } static gboolean @@ -669,16 +657,26 @@ get_next_cluster(const char *text, while (p < text + length && n_chars < 3) { gunichar current = g_utf8_get_char (p); - - if (n_chars == 0 || - is_wtt_composible ((gunichar)(cluster[n_chars - 1]), current) || - (n_chars == 1 && - is_char_type (cluster[0], Cons) && - is_char_type (current, SaraAm)) || - (n_chars == 2 && - is_char_type (cluster[0], Cons) && - is_char_type (cluster[1], Tone) && - is_char_type (current, SaraAm))) + + /* Non-thai characters get split into a single character cluster */ + if (!isthai (current)) + { + if (n_chars == 0) + { + cluster[n_chars++] = current; + p = g_utf8_next_char (p); + } + break; + } + else if (n_chars == 0 || + is_wtt_composible ((gunichar)(cluster[n_chars - 1]), current) || + (n_chars == 1 && + is_char_type (cluster[0], Cons) && + is_char_type (current, SaraAm)) || + (n_chars == 2 && + is_char_type (cluster[0], Cons) && + is_char_type (cluster[1], Tone) && + is_char_type (current, SaraAm))) { cluster[n_chars++] = current; p = g_utf8_next_char (p); |