summaryrefslogtreecommitdiff
path: root/modules/thai/thai-fc.c
diff options
context:
space:
mode:
authorTheppitak Karoonboonyanan <thep@linux.thai.net>2004-10-09 05:37:47 +0000
committerTheppitak Karoonboonyanan <tkaroonb@src.gnome.org>2004-10-09 05:37:47 +0000
commit9b0aef862faa8959dce96825dff23a373442c03f (patch)
tree0f59230b1c8d41b662d6feeadee0ad964f050f6e /modules/thai/thai-fc.c
parent8251e4eda751a127b4a4d811f0f9c15d7bbf0f09 (diff)
downloadpango-9b0aef862faa8959dce96825dff23a373442c03f.tar.gz
Explicitly handle dangling upper/lower marks by optionally using
2004-10-09 Theppitak Karoonboonyanan <thep@linux.thai.net> Explicitly handle dangling upper/lower marks by optionally using dottedcircle as base, rather than requiring it. * modules/thai/thai-shaper.h: Explicitly declare make_glyph and get_glyph functions for 8-bit and Unicode chars as separate functions. * modules/thai/thai-shaper.c (get_adjusted_glyphs_list): Rename function calls to the new ones. Conditionally use dottedcircle glyph as base for dangling upper/lower marks if available; simply expand width to that of inkrect otherwise. * modules/thai/thai-fc.c: Implement those new functions declared in thai-shaper.h. Remove 0x25cc from tis620_2 glyph set.
Diffstat (limited to 'modules/thai/thai-fc.c')
-rw-r--r--modules/thai/thai-fc.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c
index ac4c65be..324d3fbf 100644
--- a/modules/thai/thai-fc.c
+++ b/modules/thai/thai-fc.c
@@ -110,7 +110,7 @@ static int tis620_2[128] = {
0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
- 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0x25cc, 0, 0x0e3f,
+ 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f,
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
@@ -169,20 +169,32 @@ thai_get_font_info (PangoFont *font)
return font_info;
}
+static gint
+thai_get_glyph_index (ThaiFontInfo *font_info, gchar c)
+{
+ switch (font_info->font_set) {
+ case THAI_FONT_TIS: return (c & 0x80) ? tis620_0[c & 0x7f] : c;
+ case THAI_FONT_TIS_MAC: return (c & 0x80) ? tis620_1[c & 0x7f] : c;
+ case THAI_FONT_TIS_WIN: return (c & 0x80) ? tis620_2[c & 0x7f] : c;
+ default: return 0;
+ }
+}
+
+PangoGlyph
+thai_get_glyph_tis (ThaiFontInfo *font_info, gchar c)
+{
+ return pango_fc_font_get_glyph ((PangoFcFont *)font_info->font,
+ thai_get_glyph_index (font_info, c));
+}
+
PangoGlyph
-thai_make_glyph (ThaiFontInfo *font_info, unsigned int c)
+thai_make_glyph_tis (ThaiFontInfo *font_info, gchar c)
{
- int index;
+ gint index;
PangoGlyph result;
PangoFcFont *fc_font = (PangoFcFont *)font_info->font;
- switch (font_info->font_set) {
- case THAI_FONT_TIS: index = (c & 0x80) ? tis620_0[c & 0x7f] : c; break;
- case THAI_FONT_TIS_MAC: index = (c & 0x80) ? tis620_1[c & 0x7f] : c; break;
- case THAI_FONT_TIS_WIN: index = (c & 0x80) ? tis620_2[c & 0x7f] : c; break;
- default: index = 0; break;
- }
-
+ index = thai_get_glyph_index (font_info, c);
result = pango_fc_font_get_glyph (fc_font, index);
if (result)
return result;
@@ -191,9 +203,28 @@ thai_make_glyph (ThaiFontInfo *font_info, unsigned int c)
}
PangoGlyph
-thai_make_unknown_glyph (ThaiFontInfo *font_info, unsigned int c)
+thai_get_glyph_uni (ThaiFontInfo *font_info, gunichar uc)
+{
+ return pango_fc_font_get_glyph ((PangoFcFont *)font_info->font, uc);
+}
+
+PangoGlyph
+thai_make_glyph_uni (ThaiFontInfo *font_info, gunichar uc)
+{
+ PangoGlyph result;
+ PangoFcFont *fc_font = (PangoFcFont *)font_info->font;
+
+ result = pango_fc_font_get_glyph (fc_font, uc);
+ if (result)
+ return result;
+ else
+ return pango_fc_font_get_unknown_glyph (fc_font, uc);
+}
+
+PangoGlyph
+thai_make_unknown_glyph (ThaiFontInfo *font_info, gunichar uc)
{
- return pango_fc_font_get_unknown_glyph ((PangoFcFont *)font_info->font, c);
+ return pango_fc_font_get_unknown_glyph ((PangoFcFont *)font_info->font, uc);
}
static void