summaryrefslogtreecommitdiff
path: root/modules/thai/thai-shaper.c
diff options
context:
space:
mode:
authorTheppitak Karoonboonyanan <thep@linux.thai.net>2004-10-16 17:10:51 +0000
committerTheppitak Karoonboonyanan <tkaroonb@src.gnome.org>2004-10-16 17:10:51 +0000
commit2c7859e70f161414803f21d2055f5c37a3f8033f (patch)
tree015770b34373783f178ba5b08a2d015e7649e8bd /modules/thai/thai-shaper.c
parent5b8260d5d2851de6cf823647fa52f126941d28b5 (diff)
downloadpango-2c7859e70f161414803f21d2055f5c37a3f8033f.tar.gz
Merge from HEAD.merged-HEAD-1pango-1-4
2004-10-16 Theppitak Karoonboonyanan <thep@linux.thai.net> Merge from HEAD. * modules/thai/thai-ot.[ch] (thai_ot_get_ruleset), modules/thai/thai-fc.c (thai_get_font_info): Prefer OpenType to PUA substitutions. * modules/thai/thai-shaper.c (groups, group1_map, group2_map): Remove unused data for XTIS. * modules/thai/thai-shaper.[ch] (enum ThaiFontSet, get_glyphs_list), modules/thai/thai-fc.c (thai_get_font_info, thai_make_glyph): Remove THAI_FONT_ISO10646 font set. * modules/thai/thai-fc.c (tis620_1): Fix the PUA glyph table. * modules/thai/thai-shaper.h (thai_{get,make}_glyph_{tis,uni}), modules/thai/thai-shaper.c (get_adjusted_glyphs_list), modules/thai/thai-fc.c (thai_{get,make}_glyph_{tis,uni}, tis620_2): Explicitly handle dangling upper/lower marks with dottedcircle and fails gracefully if the glyph is not available. * modules/thai/thai-shaper.[ch] (thai_get_glyph_tis, thai_make_glyph_tis): Use guchar instead of gchar as argument type. Make *_tis functions wrappers to *_uni functions.
Diffstat (limited to 'modules/thai/thai-shaper.c')
-rw-r--r--modules/thai/thai-shaper.c172
1 files changed, 68 insertions, 104 deletions
diff --git a/modules/thai/thai-shaper.c b/modules/thai/thai-shaper.c
index 3a0b4d88..7c036e9a 100644
--- a/modules/thai/thai-shaper.c
+++ b/modules/thai/thai-shaper.c
@@ -83,41 +83,6 @@
#define char_class(wc) TAC_char_class[(unsigned int)(wc)]
#define is_char_type(wc, mask) (char_type_table[ucs2tis ((wc))] & (mask))
-/* All combining marks for Thai fall in the range U+0E30-U+0E50,
- * so we confine our data tables to that range, and use
- * default values for characters outside those ranges.
- */
-
-/* Map from code point to group used for rendering with XTIS fonts
- * (0 == base character)
- */
-static const char groups[32] = {
- 0, 1, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 2,
- 2, 2, 2, 2, 2, 2, 1, 0
-};
-
-/* Map from code point to index within group 1
- * (0 == no combining mark from group 1)
- */
-static const char group1_map[32] = {
- 0, 1, 0, 0, 2, 3, 4, 5,
- 6, 7, 8, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* Map from code point to index within group 2
- * (0 == no combining mark from group 2)
- */
-static const char group2_map[32] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1,
- 2, 3, 4, 5, 6, 7, 1, 0
-};
-
static const gint char_type_table[256] = {
/* 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, A, B, C, D, E, F */
@@ -316,6 +281,12 @@ add_glyph (ThaiFontInfo *font_info,
glyphs->glyphs[index].geometry.y_offset = 0;
}
+static PangoGlyph
+get_null_base_glyph (ThaiFontInfo *font_info)
+{
+ return thai_get_glyph_uni (font_info, 0x25cc);
+}
+
static gint
get_adjusted_glyphs_list (ThaiFontInfo *font_info,
gunichar *cluster,
@@ -328,18 +299,17 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
case 1:
if (is_char_type (cluster[0], BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone))
{
- if (font_info->font_set == THAI_FONT_TIS)
- glyph_lists[0] = thai_make_glyph (font_info, 0x20);
- else
- glyph_lists[0] = thai_make_glyph (font_info, 0xDD);
- glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- return 2;
+ gint n;
+ glyph_lists[0] = get_null_base_glyph (font_info);
+ n = glyph_lists[0] ? 1 : 0;
+ glyph_lists[n++] =
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ return n;
}
else
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
return 1;
}
break;
@@ -349,36 +319,36 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[1], SaraAm))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info, 0xED);
- glyph_lists[2] = thai_make_glyph (font_info, 0xD2);
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info, 0xED);
+ glyph_lists[2] = thai_make_glyph_tis (font_info, 0xD2);
return 3;
}
else if (is_char_type (cluster[0], UpTailCons) &&
is_char_type (cluster[1], SaraAm))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info, 0xD2);
+ glyph_lists[2] = thai_make_glyph_tis (font_info, 0xD2);
return 3;
}
else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
is_char_type (cluster[1], AboveVowel))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
return 2;
}
else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) &&
is_char_type (cluster[1], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftdown_tone_ad (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -386,8 +356,8 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[1], AboveVowel))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftleft_av (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -395,8 +365,8 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[1], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftdownleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -404,41 +374,40 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[1], BelowVowel|BelowDiac))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
return 2;
}
else if (is_char_type (cluster[0], BotTailCons) &&
is_char_type (cluster[1], BelowVowel|BelowDiac))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info,
shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table));
return 2;
}
else if (is_char_type (cluster[0], SpltTailCons) &&
is_char_type (cluster[1], BelowVowel|BelowDiac))
{
- glyph_lists[0] = thai_make_glyph (font_info,
+ glyph_lists[0] = thai_make_glyph_tis (font_info,
tailcutcons (ucs2tis (cluster[0]), shaping_table));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
return 2;
}
else
{
- if (font_info->font_set == THAI_FONT_TIS)
- glyph_lists[0] = thai_make_glyph (font_info, 0x20);
- else
- glyph_lists[0] = thai_make_glyph (font_info, 0xDD);
- glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- return 3;
+ gint n;
+ glyph_lists[0] = get_null_base_glyph (font_info);
+ n = glyph_lists[0] ? 1 : 0;
+ glyph_lists[n++] =
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[n++] =
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
+ return n;
}
break;
@@ -448,11 +417,11 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], SaraAm))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info, 0xED);
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info, 0xED);
glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- glyph_lists[3] = thai_make_glyph (font_info, 0xD2);
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
+ glyph_lists[3] = thai_make_glyph_tis (font_info, 0xD2);
return 4;
}
else if (is_char_type (cluster[0], UpTailCons) &&
@@ -460,12 +429,12 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], SaraAm))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = thai_make_glyph_tis (font_info,
shiftleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[3] = thai_make_glyph (font_info, 0xD2);
+ glyph_lists[3] = thai_make_glyph_tis (font_info, 0xD2);
return 4;
}
else if (is_char_type (cluster[0], UpTailCons) &&
@@ -473,10 +442,10 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftleft_av (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = thai_make_glyph_tis (font_info,
shiftleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -485,10 +454,10 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- glyph_lists[2] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
+ glyph_lists[2] = thai_make_glyph_tis (font_info,
shiftdownleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -497,11 +466,11 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
glyph_lists[2] =
- thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -509,11 +478,11 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[1], BelowVowel) &&
is_char_type (cluster[2], AboveDiac|Tone))
{
- glyph_lists[0] = thai_make_glyph (font_info,
+ glyph_lists[0] = thai_make_glyph_tis (font_info,
tailcutcons (ucs2tis (cluster[0]), shaping_table));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- glyph_lists[2] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
+ glyph_lists[2] = thai_make_glyph_tis (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -522,21 +491,21 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
is_char_type (cluster[2], AboveDiac|Tone))
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
- glyph_lists[1] = thai_make_glyph (font_info,
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = thai_make_glyph_tis (font_info,
shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = thai_make_glyph_tis (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
else
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[1]));
glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[2]));
+ thai_make_glyph_tis (font_info, ucs2tis (cluster[2]));
return 3;
}
break;
@@ -577,11 +546,6 @@ get_glyphs_list (ThaiFontInfo *font_info,
*/
return get_adjusted_glyphs_list (font_info, cluster,
num_chrs, glyph_lists, &Win_shape_table);
-
- case THAI_FONT_ISO10646:
- for (i=0; i < num_chrs; i++)
- glyph_lists[i] = thai_make_glyph (font_info, cluster[i]);
- return num_chrs;
}
return 0; /* Quiet GCC */
@@ -602,7 +566,7 @@ add_cluster (ThaiFontInfo *font_info,
{
g_assert (num_chrs == 1);
add_glyph (font_info, glyphs, cluster_start,
- thai_make_glyph (font_info, cluster[0]),
+ thai_make_glyph_uni (font_info, cluster[0]),
FALSE);
}
else