summaryrefslogtreecommitdiff
path: root/modules/thai/thai-shaper.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/thai/thai-shaper.c')
-rw-r--r--modules/thai/thai-shaper.c121
1 files changed, 59 insertions, 62 deletions
diff --git a/modules/thai/thai-shaper.c b/modules/thai/thai-shaper.c
index 9822c28b..ef04b229 100644
--- a/modules/thai/thai-shaper.c
+++ b/modules/thai/thai-shaper.c
@@ -339,17 +339,17 @@ get_adjusted_glyphs_list (ThaiFontInfo *font_info,
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);
+ glyph_lists[0] = (*font_info->make_glyph) (font_info, 0x20);
else
- glyph_lists[0] = thai_make_glyph (font_info, 0x7F);
+ glyph_lists[0] = (*font_info->make_glyph) (font_info, 0x7F);
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
return 2;
}
else
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
return 1;
}
break;
@@ -359,36 +359,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);
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info, 0xED);
+ glyph_lists[2] = (*font_info->make_glyph) (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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info, 0xD2);
+ glyph_lists[2] = (*font_info->make_glyph) (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]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftdown_tone_ad (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -396,8 +396,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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftleft_av (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -405,8 +405,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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftdownleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
return 2;
}
@@ -414,40 +414,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]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (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]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info,
+ (*font_info->make_glyph) (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] = (*font_info->make_glyph) (font_info,
tailcutcons (ucs2tis (cluster[0]), shaping_table));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (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);
+ glyph_lists[0] = (*font_info->make_glyph) (font_info, 0x20);
else
- glyph_lists[0] = thai_make_glyph (font_info, 0x7F);
+ glyph_lists[0] = (*font_info->make_glyph) (font_info, 0x7F);
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
return 3;
}
break;
@@ -458,11 +458,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);
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info, 0xED);
glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- glyph_lists[3] = thai_make_glyph (font_info, 0xD2);
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
+ glyph_lists[3] = (*font_info->make_glyph) (font_info, 0xD2);
return 4;
}
else if (is_char_type (cluster[0], UpTailCons) &&
@@ -470,12 +470,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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftleft_tone_ad (0xED, shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = (*font_info->make_glyph) (font_info,
shiftleft_tone_ad (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[3] = thai_make_glyph (font_info, 0xD2);
+ glyph_lists[3] = (*font_info->make_glyph) (font_info, 0xD2);
return 4;
}
else if (is_char_type (cluster[0], UpTailCons) &&
@@ -483,10 +483,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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftleft_av (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = (*font_info->make_glyph) (font_info,
shiftleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -495,10 +495,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]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
- glyph_lists[2] = thai_make_glyph (font_info,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
+ glyph_lists[2] = (*font_info->make_glyph) (font_info,
shiftdownleft_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -507,11 +507,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]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
glyph_lists[2] =
- thai_make_glyph (font_info,
+ (*font_info->make_glyph) (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -519,11 +519,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] = (*font_info->make_glyph) (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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
+ glyph_lists[2] = (*font_info->make_glyph) (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
@@ -532,21 +532,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,
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
+ glyph_lists[1] = (*font_info->make_glyph) (font_info,
shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table));
- glyph_lists[2] = thai_make_glyph (font_info,
+ glyph_lists[2] = (*font_info->make_glyph) (font_info,
shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table));
return 3;
}
else
{
glyph_lists[0] =
- thai_make_glyph (font_info, ucs2tis (cluster[0]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[0]));
glyph_lists[1] =
- thai_make_glyph (font_info, ucs2tis (cluster[1]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[1]));
glyph_lists[2] =
- thai_make_glyph (font_info, ucs2tis (cluster[2]));
+ (*font_info->make_glyph) (font_info, ucs2tis (cluster[2]));
return 3;
}
break;
@@ -569,7 +569,7 @@ get_glyphs_list (ThaiFontInfo *font_info,
{
case THAI_FONT_NONE:
for (i=0; i < num_chrs; i++)
- glyph_lists[i] = thai_make_unknown_glyph (font_info, glyph_lists[i]);
+ glyph_lists[i] = (*font_info->make_unknown_glyph) (font_info, glyph_lists[i]);
return num_chrs;
case THAI_FONT_XTIS:
@@ -581,14 +581,14 @@ get_glyphs_list (ThaiFontInfo *font_info,
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);
+ glyph = (*font_info->make_glyph) (font_info, xtis_index);
if (pango_x_has_glyph (font_info->font, glyph)) {
glyph_lists[0] = glyph;
return 1;
}
for (i=0; i < num_chrs; i++)
glyph_lists[i] =
- thai_make_glyph (font_info,
+ (*font_info->make_glyph) (font_info,
0x100 * (cluster[i] - 0xe00 + 0x20) + 0x30);
return num_chrs;
@@ -612,7 +612,7 @@ get_glyphs_list (ThaiFontInfo *font_info,
case THAI_FONT_ISO10646:
for (i=0; i < num_chrs; i++)
- glyph_lists[i] = thai_make_glyph (font_info, cluster[i]);
+ glyph_lists[i] = (*font_info->make_glyph) (font_info, cluster[i]);
return num_chrs;
}
@@ -692,13 +692,12 @@ get_next_cluster(const char *text,
}
void
-thai_engine_shape (PangoFont *font,
+thai_engine_shape (ThaiFontInfo *font_info,
const char *text,
gint length,
PangoAnalysis *analysis,
PangoGlyphString *glyphs)
{
- ThaiFontInfo *font_info;
const char *p;
const char *log_cluster;
gunichar cluster[MAX_CLUSTER_CHRS];
@@ -706,8 +705,6 @@ thai_engine_shape (PangoFont *font,
pango_glyph_string_set_size (glyphs, 0);
- font_info = thai_get_font_info (font);
-
p = text;
while (p < text + length)
{