diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-09-23 23:11:59 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-09-23 23:11:59 +0000 |
commit | 0f36f55ee0e7c9bf224fabbaf31843b3868f213c (patch) | |
tree | a8446856f4dce9b792f5e2ca1c3f9d25bbc40b76 /modules/thai | |
parent | 8fa8e29cd61c802c6b100b3cca800784e3a9de20 (diff) | |
download | pango-0f36f55ee0e7c9bf224fabbaf31843b3868f213c.tar.gz |
Modules now declare a list of scripts that they cover instead of a list of
Tue Sep 23 18:03:57 2003 Owen Taylor <otaylor@redhat.com>
* pango/pango-engines.[ch] pango/pango-engines-private.h:
Modules now declare a list of scripts that they cover instead of a
list of code point ranges. Also, there is now a ->covers() virtual
function that allows a module to decide live whether the font
covers a particular codepoint; remove old get_coverage() method.
* pango/pango-fontset.[ch]: Add a foreach() function to
iterate over all the fonts in a fontset (with a true
return stopping iteration).
* pango/pango-context.c: Complete rewrite using script-run
information to improve language tags. Switch to an approach
where we handle one run at a time rather than computing
information for each character individually then later
breaking the result into runs.
* pango/pango-fontset.[ch]: Switch over to using
pango-impl-utils.h.
* modules/basic/basic-x.c pango/pangox-fontmap.c: Adapt to
the change from get_coverage => covers.
* pango/pango-modules.h pango/modules.c: Switch PangoMap
over to being based on script rather than being based
on codepoint. Remove the no longer needed pango_map_get_entry().
* pango/modules.c: Handle new script-based modules.
* pango/pango-fc-fontmap.c pango/pango-win32-fontmap.c
pango/pang-fontmap.[ch]: Add a shape_engine_type field
to PangoFontmapClass, pango_font_map_get_shape_engine_type();
this allows generic code to find a shaper for a particular
fontmap.
* pango/pango-script.[ch]: Add pango_script_get_sample_language(),
pango_language_includes_script(); functions for determining
the relationship between scripts and language.
* tools/gen-script-for-lang.c: Modify to spit out a
useful table.
* pango/pango-script-lang-table.h: Version of table
generated from current fontconfig data.
* pango/pangox.c: Remove complicated code to compute
coverages; no longer useful now that we just have
the basic shaper as a legacy thing.
* modules/*/*.c: Adapt to identifying shape engines
by language range.
* modules/thai/thai-fc.c modules/thai/thai-shaper.[ch]:
Remove now unused "has_glyph" function and XTIS support.
* modules/thai/thai-fc.c: Handle non-Thai characters
as well, since the Thai module now gets spaces,
punctuation, and so forth.
Diffstat (limited to 'modules/thai')
-rw-r--r-- | modules/thai/thai-fc.c | 14 | ||||
-rw-r--r-- | modules/thai/thai-shaper.c | 72 | ||||
-rw-r--r-- | modules/thai/thai-shaper.h | 12 |
3 files changed, 39 insertions, 59 deletions
diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c index 9a9839a9..65351ac1 100644 --- a/modules/thai/thai-fc.c +++ b/modules/thai/thai-fc.c @@ -44,8 +44,8 @@ typedef PangoEngineShapeClass ThaiEngineFcClass ; /* We handle the range U+0e01 to U+0e5b exactly */ -static PangoEngineRange thai_ranges[] = { - { 0x0e01, 0x0e5b, "*" }, /* Thai */ +static PangoEngineScriptInfo thai_scripts[] = { + { PANGO_SCRIPT_THAI, "*" } }; static PangoEngineInfo script_engines[] = { @@ -53,7 +53,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, - thai_ranges, G_N_ELEMENTS(thai_ranges) + thai_scripts, G_N_ELEMENTS(thai_scripts) } }; @@ -196,14 +196,6 @@ thai_make_unknown_glyph (ThaiFontInfo *font_info, unsigned int c) return pango_fc_font_get_unknown_glyph ((PangoFcFont *)font_info->font, c); } -/* Unused; used only for X backend and XTIS encoding - */ -gboolean -thai_has_glyph (ThaiFontInfo *font_info, PangoGlyph glyph) -{ - return TRUE; -} - static void thai_engine_fc_class_init (PangoEngineShapeClass *class) { 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); diff --git a/modules/thai/thai-shaper.h b/modules/thai/thai-shaper.h index b745da86..8055ce85 100644 --- a/modules/thai/thai-shaper.h +++ b/modules/thai/thai-shaper.h @@ -1,10 +1,7 @@ #ifndef __THAI_SHAPER_H__ #define __THAI_SHAPER_H__ -#ifdef HAVE_X -#include "pangox.h" -#endif - +#define isthai(wc) (wc >= 0xE00 && wc < 0xE80) #define ucs2tis(wc) (unsigned int)((unsigned int)(wc) - 0x0E00 + 0xA0) #define tis2uni(c) ((gunichar)(c) - 0xA0 + 0x0E00) @@ -14,7 +11,6 @@ typedef struct _ThaiFontInfo ThaiFontInfo; */ typedef enum { THAI_FONT_NONE, - THAI_FONT_XTIS, THAI_FONT_TIS, THAI_FONT_TIS_MAC, THAI_FONT_TIS_WIN, @@ -30,9 +26,6 @@ struct _ThaiFontInfo { PangoFont *font; ThaiFontSet font_set; -#ifdef HAVE_X - PangoXSubfont subfont; /* For X backend */ -#endif }; /* @@ -47,9 +40,6 @@ thai_make_glyph (ThaiFontInfo *font_info, unsigned int c); PangoGlyph thai_make_unknown_glyph (ThaiFontInfo *font_info, unsigned int c); -gboolean -thai_has_glyph (ThaiFontInfo *font_info, PangoGlyph glyph); - /* * Public functions */ |