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 | |
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')
-rw-r--r-- | modules/arabic/arabic-fc.c | 7 | ||||
-rw-r--r-- | modules/basic/basic-fc.c | 60 | ||||
-rw-r--r-- | modules/basic/basic-win32.c | 114 | ||||
-rw-r--r-- | modules/basic/basic-x.c | 49 | ||||
-rw-r--r-- | modules/hangul/hangul-fc.c | 9 | ||||
-rw-r--r-- | modules/hebrew/hebrew-fc.c | 8 | ||||
-rw-r--r-- | modules/indic/indic-fc.c | 40 | ||||
-rw-r--r-- | modules/indic/indic-ot-class-tables.c | 2 | ||||
-rw-r--r-- | modules/indic/indic-ot.h | 21 | ||||
-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 |
12 files changed, 147 insertions, 261 deletions
diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c index fd425d2e..d3e2fcd9 100644 --- a/modules/arabic/arabic-fc.c +++ b/modules/arabic/arabic-fc.c @@ -35,9 +35,8 @@ typedef PangoEngineShapeClass ArabicEngineFcClass ; #define SCRIPT_ENGINE_NAME "ArabicScriptEngineFc" #define RENDER_TYPE PANGO_RENDER_TYPE_FC -static PangoEngineRange arabic_ranges[] = { - /* Language characters */ - { 0x060c, 0x06f9, "*" }, /* Arabic */ +static PangoEngineScriptInfo arabic_scripts[] = { + { PANGO_SCRIPT_ARABIC, "*" }, }; static PangoEngineInfo script_engines[] = { @@ -45,7 +44,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, - arabic_ranges, G_N_ELEMENTS(arabic_ranges) + arabic_scripts, G_N_ELEMENTS(arabic_scripts) } }; diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c index 6de50e8c..6fb28ecf 100644 --- a/modules/basic/basic-fc.c +++ b/modules/basic/basic-fc.c @@ -36,35 +36,35 @@ typedef PangoEngineShapeClass BasicEngineFcClass; #define SCRIPT_ENGINE_NAME "BasicScriptEngineFc" #define RENDER_TYPE PANGO_RENDER_TYPE_FC -static PangoEngineRange basic_ranges[] = { - /* Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, - * IPA Extensions - */ - { 0x0000, 0x02af, "*" }, - { 0x0380, 0x058f, "*" }, /* Greek, Cyrillic, Armenian */ - { 0x10a0, 0x10ff, "*" }, /* Georgian */ - { 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */ - { 0x1e00, 0x1fff, "*" }, /* Latin Extended Additional, Greek Extended */ - - /* General Punctuation, Superscripts and Subscripts, Currency Symbols, - * Combining Marks for Symbols, Letterlike Symbols, Number Forms, - * Arrows, Mathematical Operators, Miscellaneous Technical, - * Control Pictures, Optical Character Recognition, Enclosed Alphanumerics, - * Box Drawing, Block Elements, Geometric Shapes, Miscellaneous Symbols, - * Dingbats, Braille Patterns, CJK Radicals Supplement, Kangxi Radicals, - * Ideographic Description Characters, CJK Symbols and Punctuation, - * Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, - * Bopomofo Extended, Enclosed CJK Letters and Months, CJK Compatibility, - * CJK Unified Ideographs Extension A, CJK Unified Ideographs - */ - { 0x2000, 0x3029, "*" }, /* Gap for Hangul diacritics */ - { 0x3030, 0x9fff, "*" }, - { 0xa000, 0xa4c6, "*" }, /* Yi */ - { 0xe000, 0xf7ee, "*" }, /* HKSCS-1999 */ - { 0xf900, 0xfa2d, "*" }, /* CJK Compatibility Ideographs */ - { 0xfe30, 0xfe6b, "*" }, /* CJK Compatibility Forms and Small Form Variants */ - { 0xff00, 0xffe3, "*" }, /* Halfwidth and Fullwidth Forms (partly) */ - { 0x0000, 0xffff, "" }, +static PangoEngineScriptInfo basic_scripts[] = { + { PANGO_SCRIPT_ARMENIAN, "*" }, + { PANGO_SCRIPT_BOPOMOFO, "*" }, + { PANGO_SCRIPT_CHEROKEE, "*" }, + { PANGO_SCRIPT_COPTIC, "*" }, + { PANGO_SCRIPT_CYRILLIC, "*" }, + { PANGO_SCRIPT_DESERET, "*" }, + { PANGO_SCRIPT_ETHIOPIC, "*" }, + { PANGO_SCRIPT_GEORGIAN, "*" }, + { PANGO_SCRIPT_GOTHIC, "*" }, + { PANGO_SCRIPT_GREEK, "*" }, + { PANGO_SCRIPT_HAN, "*" }, + { PANGO_SCRIPT_HIRAGANA, "*" }, + { PANGO_SCRIPT_KATAKANA, "*" }, + { PANGO_SCRIPT_LATIN, "*" }, + { PANGO_SCRIPT_OGHAM, "*" }, + { PANGO_SCRIPT_OLD_ITALIC, "*" }, + { PANGO_SCRIPT_RUNIC, "*" }, + { PANGO_SCRIPT_CANADIAN_ABORIGINAL, "*" }, + { PANGO_SCRIPT_YI, "*" }, + { PANGO_SCRIPT_BRAILLE, "*" }, + { PANGO_SCRIPT_CYPRIOT, "*" }, + { PANGO_SCRIPT_LIMBU, "*" }, + { PANGO_SCRIPT_OSMANYA, "*" }, + { PANGO_SCRIPT_SHAVIAN, "*" }, + { PANGO_SCRIPT_LINEAR_B, "*" }, + { PANGO_SCRIPT_UGARITIC, "*" }, + + { PANGO_SCRIPT_COMMON, "" } }; static PangoEngineInfo script_engines[] = { @@ -72,7 +72,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, - basic_ranges, G_N_ELEMENTS(basic_ranges) + basic_scripts, G_N_ELEMENTS(basic_scripts) } }; diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c index 82c8b88c..52e720ee 100644 --- a/modules/basic/basic-win32.c +++ b/modules/basic/basic-win32.c @@ -126,89 +126,47 @@ static int nscripts; #endif #ifdef HAVE_USP10_H -static PangoEngineRange uniscribe_ranges[] = { +static PangoEngineScriptInfo uniscribe_scripts[] = { /* We claim to cover everything ;-) */ - { 0x0020, 0xffee, "*" } + { PANGO_SCRIPT_COMMON, "" }, }; #endif -static PangoEngineRange basic_ranges[] = { +static PangoEngineScriptInfo basic_scripts[] = { /* Those characters that can be rendered legibly without Uniscribe. * I am not certain this list is correct. */ - - /* Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B, - * IPA Extensions - */ - { 0x0020, 0x02af, "*" }, - - /* Spacing Modifier Letters */ - { 0x02b0, 0x02ff, "" }, - - /* Not covered: Combining Diacritical Marks */ - - /* Greek, Cyrillic, Armenian */ - { 0x0380, 0x058f, "*" }, - - /* Hebrew */ - { 0x0591, 0x05f4, "*" }, - - /* Arabic */ - { 0x060c, 0x06f9, "" }, - - /* Not covered: Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, - * Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala - */ - - /* Thai */ - { 0x0e01, 0x0e5b, "" }, - - /* Not covered: Lao, Tibetan, Myanmar */ - - /* Georgian */ - { 0x10a0, 0x10ff, "*" }, - - /* Not covered: Hangul Jamo */ - - /* Ethiopic, Cherokee, Unified Canadian Aboriginal Syllabics, Ogham, - * Runic */ - { 0x1200, 0x16ff, "*" }, - - /* Not covered: Khmer, Mongolian */ - - /* Latin Extended Additional, Greek Extended */ - { 0x1e00, 0x1fff, "*" }, - - /* General Punctuation, Superscripts and Subscripts, Currency - * Symbols, Combining Marks for Symbols, Letterlike Symbols, Number - * Forms, Arrows, Mathematical Operators, Miscellaneous Technical, - * Control Pictures, Optical Character Recognition, Enclosed - * Alphanumerics, Box Drawing, Block Elements, Geometric Shapes, - * Miscellaneous Symbols, Dingbats, Braille Patterns, CJK Radicals - * Supplement, Kangxi Radicals, Ideographic Description Characters, - * CJK Symbols and Punctuation, Hiragana, Katakana, Bopomofo, Hangul - * Compatibility Jamo, Kanbun, Bopomofo Extended, Enclosed CJK - * Letters and Months, CJK Compatibility, CJK Unified Ideographs - * Extension A, CJK Unified Ideographs, Yi Syllables, Yi Radicals - */ - { 0x2000, 0xa4c6, "*" }, - - /* Hangul Syllables */ - { 0xac00, 0xd7a3, "kr" }, - - /* Not covered: Private Use */ - - /* CJK Compatibility Ideographs (partly) */ - { 0xf900, 0xfa0b, "kr" }, - - /* Not covered: CJK Compatibility Ideographs (partly), Alphabetic - * Presentation Forms, Arabic Presentation Forms-A, Combining Half - * Marks, CJK Compatibility Forms, Small Form Variants, Arabic - * Presentation Forms-B, Specials - */ - - /* Halfwidth and Fullwidth Forms */ - { 0xff00, 0xffed, "*" } + { PANGO_SCRIPT_ARMENIAN, "*" }, + { PANGO_SCRIPT_BOPOMOFO, "*" }, + { PANGO_SCRIPT_CHEROKEE, "*" }, + { PANGO_SCRIPT_COPTIC, "*" }, + { PANGO_SCRIPT_CYRILLIC, "*" }, + { PANGO_SCRIPT_DESERET, "*" }, + { PANGO_SCRIPT_ETHIOPIC, "*" }, + { PANGO_SCRIPT_GEORGIAN, "*" }, + { PANGO_SCRIPT_GOTHIC, "*" }, + { PANGO_SCRIPT_GREEK, "*" }, + { PANGO_SCRIPT_HAN, "*" }, + { PANGO_SCRIPT_HANGUL, "*" }, + { PANGO_SCRIPT_HIRAGANA, "*" }, + { PANGO_SCRIPT_KATAKANA, "*" }, + { PANGO_SCRIPT_LATIN, "*" }, + { PANGO_SCRIPT_OGHAM, "*" }, + { PANGO_SCRIPT_OLD_ITALIC, "*" }, + { PANGO_SCRIPT_RUNIC, "*" }, + { PANGO_SCRIPT_THAI, "*" }, + { PANGO_SCRIPT_CANADIAN_ABORIGINAL, "*" }, + { PANGO_SCRIPT_YI, "*" }, + { PANGO_SCRIPT_BRAILLE, "*" }, + { PANGO_SCRIPT_CYPRIOT, "*" }, + { PANGO_SCRIPT_LIMBU, "*" }, + { PANGO_SCRIPT_OSMANYA, "*" }, + { PANGO_SCRIPT_SHAVIAN, "*" }, + { PANGO_SCRIPT_LINEAR_B, "*" }, + { PANGO_SCRIPT_UGARITIC, "*" }, + + /* Claim to handle everything as a fallback */ + { PANGO_SCRIPT_COMMON, "" } }; static PangoEngineInfo script_engines[] = { @@ -1189,8 +1147,8 @@ PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, { init_uniscribe (); - script_engines[0].ranges = basic_ranges; - script_engines[0].n_ranges = G_N_ELEMENTS (basic_ranges); + script_engines[0].scripts = basic_scripts; + script_engines[0].n_scripts = G_N_ELEMENTS (basic_scripts); #ifdef HAVE_USP10_H if (have_uniscribe) diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index 9b9431a2..d0ba9c48 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -83,6 +83,7 @@ struct _CharCache CharsetOrdering *ordering; MaskTable *mask_tables[256]; GIConv converters[MAX_CHARSETS]; + PangoCoverage *coverage; }; struct _CharCachePointer @@ -115,25 +116,8 @@ static PangoGlyph conv_euctw (CharCache *cache, #include "tables-big.i" -static PangoEngineRange basic_ranges[] = { - /* Language characters */ - { 0x0000, 0x02af, "*" }, - { 0x02b0, 0x02ff, "" }, - { 0x0380, 0x058f, "*" }, - { 0x0591, 0x05f4, "" }, /* Hebrew */ - { 0x060c, 0x06f9, "" }, /* Arabic */ - { 0x0e01, 0x0e5b, "" }, /* Thai */ - { 0x10a0, 0x10ff, "*" }, /* Georgian */ - { 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */ - { 0x1e00, 0x1fff, "*" }, - { 0x2000, 0x33ff, "*" }, - { 0x3400, 0x9fa5, "*" }, /* Unihan */ - { 0xa000, 0xa4c6, "*" }, /* Yi */ - { 0xac00, 0xd7a3, "" }, - { 0xe000, 0xf7ee, "*" }, /* HKSCS-1999 */ - { 0xf900, 0xfa2d, "*" }, /* CJK Compatibility Ideographs */ - { 0xfe30, 0xfe6b, "*" }, /* CJK Compatibility Forms and Small Form Variants */ - { 0xff00, 0xffee, "*" } /* Halfwidth and Fullwidth Forms */ +static PangoEngineScriptInfo basic_scripts[] = { + { PANGO_SCRIPT_COMMON, "" }, }; static PangoEngineInfo script_engines[] = { @@ -141,7 +125,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, PANGO_RENDER_TYPE_X, - basic_ranges, G_N_ELEMENTS(basic_ranges) + basic_scripts, G_N_ELEMENTS(basic_scripts) } }; @@ -684,31 +668,24 @@ basic_engine_shape (PangoEngineShape *engine, } } -static PangoCoverage * -basic_engine_get_coverage (PangoEngineShape *engine, - PangoFont *font, - PangoLanguage *lang) +static PangoCoverageLevel +basic_engine_covers (PangoEngineShape *engine, + PangoFont *font, + PangoLanguage *lang, + gunichar wc) { CharCache *cache = get_char_cache (font, lang); - PangoCoverage *result = pango_coverage_new (); - gunichar wc; + char buf[6]; - for (wc = 0; wc < 65536; wc++) - { - char buf[6]; + g_unichar_to_utf8 (wc, buf); - g_unichar_to_utf8 (wc, buf); - if (find_char (cache, font, wc, buf)) - pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - } - - return result; + return find_char (cache, font, wc, buf) ? PANGO_COVERAGE_EXACT : PANGO_COVERAGE_NONE; } static void basic_engine_x_class_init (PangoEngineShapeClass *class) { - class->get_coverage = basic_engine_get_coverage; + class->covers = basic_engine_covers; class->script_shape = basic_engine_shape; } diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c index 94216695..c64d6de7 100644 --- a/modules/hangul/hangul-fc.c +++ b/modules/hangul/hangul-fc.c @@ -36,11 +36,8 @@ typedef PangoEngineShapeClass HangulEngineFcClass ; #define SCRIPT_ENGINE_NAME "HangulScriptEngineFc" #define RENDER_TYPE PANGO_RENDER_TYPE_FC -static PangoEngineRange hangul_ranges[] = { - /* Language characters */ - { 0x1100, 0x11ff, "*" }, /* Hangul Jamo */ - { 0x302e, 0x302f, "*" }, /* Hangul Tone Marks */ - { 0xac00, 0xd7a3, "*" }, /* Hangul Syllables */ +static PangoEngineScriptInfo hangul_scripts[] = { + { PANGO_SCRIPT_HANGUL, "*" } }; static PangoEngineInfo script_engines[] = { @@ -48,7 +45,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, - hangul_ranges, G_N_ELEMENTS(hangul_ranges) + hangul_scripts, G_N_ELEMENTS(hangul_scripts) } }; diff --git a/modules/hebrew/hebrew-fc.c b/modules/hebrew/hebrew-fc.c index 01a7f2e3..7e257f96 100644 --- a/modules/hebrew/hebrew-fc.c +++ b/modules/hebrew/hebrew-fc.c @@ -33,10 +33,8 @@ typedef PangoEngineShapeClass HebrewEngineFcClass ; #define MAX_CLUSTER_CHRS 20 -static PangoEngineRange hebrew_ranges[] = { - /* Language characters */ - { 0x0591, 0x05f4, "*" }, /* Hebrew */ - { 0xfb1d, 0xfb4f, "*" } /* Hebrew presentation forms */ +static PangoEngineScriptInfo hebrew_scripts[] = { + { PANGO_SCRIPT_HEBREW, "*" } }; #define SCRIPT_ENGINE_NAME "HebrewScriptEngineFc" @@ -47,7 +45,7 @@ static PangoEngineInfo script_engines[] = { SCRIPT_ENGINE_NAME, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, - hebrew_ranges, G_N_ELEMENTS(hebrew_ranges) + hebrew_scripts, G_N_ELEMENTS(hebrew_scripts) } }; diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c index f70fadfb..68b28662 100644 --- a/modules/indic/indic-fc.c +++ b/modules/indic/indic-fc.c @@ -52,12 +52,10 @@ struct _PangoIndicInfo #define ENGINE_SUFFIX "ScriptEngineFc" #define RENDER_TYPE PANGO_RENDER_TYPE_FC -#define INDIC_ENGINE_INFO(script) {#script ENGINE_SUFFIX, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, script##_ranges, G_N_ELEMENTS(script##_ranges)} +#define INDIC_ENGINE_INFO(script) {#script ENGINE_SUFFIX, PANGO_ENGINE_TYPE_SHAPE, RENDER_TYPE, script##_scripts, G_N_ELEMENTS(script##_scripts)} #define PANGO_INDIC_INFO(script) {OT_TAG_##script, &script##_class_table, "pango-indic-" #script "-GSUB-ruleset", "pango-indic-" #script "-GPOS-rulsest"} -#define INDIC_SCRIPT_RANGE(script) {SCRIPT_RANGE_##script, "*"} - #define OT_TAG_deva FT_MAKE_TAG('d','e','v','a') #define OT_TAG_beng FT_MAKE_TAG('b','e','n','g') #define OT_TAG_guru FT_MAKE_TAG('g','u','r','u') @@ -68,40 +66,40 @@ struct _PangoIndicInfo #define OT_TAG_knda FT_MAKE_TAG('k','n','d','a') #define OT_TAG_mlym FT_MAKE_TAG('m','l','y','m') -static PangoEngineRange deva_ranges[] = { - INDIC_SCRIPT_RANGE(deva), /* Devanagari */ +static PangoEngineScriptInfo deva_scripts[] = { + { PANGO_SCRIPT_DEVANAGARI, "*" } }; -static PangoEngineRange beng_ranges[] = { - INDIC_SCRIPT_RANGE(beng), /* Bengali */ +static PangoEngineScriptInfo beng_scripts[] = { + {PANGO_SCRIPT_BENGALI, "*" } }; -static PangoEngineRange guru_ranges[] = { - INDIC_SCRIPT_RANGE(guru), /* Gurmukhi */ +static PangoEngineScriptInfo guru_scripts[] = { + { PANGO_SCRIPT_GURMUKHI, "*" } }; -static PangoEngineRange gujr_ranges[] = { - INDIC_SCRIPT_RANGE(gujr), /* Gujarati */ +static PangoEngineScriptInfo gujr_scripts[] = { + { PANGO_SCRIPT_GUJARATI, "*" } }; -static PangoEngineRange orya_ranges[] = { - INDIC_SCRIPT_RANGE(orya), /* Oriya */ +static PangoEngineScriptInfo orya_scripts[] = { + { PANGO_SCRIPT_ORIYA, "*" } }; -static PangoEngineRange taml_ranges[] = { - INDIC_SCRIPT_RANGE(taml), /* Tamil */ +static PangoEngineScriptInfo taml_scripts[] = { + { PANGO_SCRIPT_TAMIL, "*" } }; -static PangoEngineRange telu_ranges[] = { - INDIC_SCRIPT_RANGE(telu), /* Telugu */ +static PangoEngineScriptInfo telu_scripts[] = { + { PANGO_SCRIPT_TELUGU, "*" } }; -static PangoEngineRange knda_ranges[] = { - INDIC_SCRIPT_RANGE(knda), /* Kannada */ +static PangoEngineScriptInfo knda_scripts[] = { + { PANGO_SCRIPT_KANNADA, "*" } }; -static PangoEngineRange mlym_ranges[] = { - INDIC_SCRIPT_RANGE(mlym), /* Malayalam */ +static PangoEngineScriptInfo mlym_scripts[] = { + { PANGO_SCRIPT_MALAYALAM, "*" } }; static PangoEngineInfo script_engines[] = { diff --git a/modules/indic/indic-ot-class-tables.c b/modules/indic/indic-ot-class-tables.c index cc18a9be..c4acf4ce 100644 --- a/modules/indic/indic-ot-class-tables.c +++ b/modules/indic/indic-ot-class-tables.c @@ -213,7 +213,7 @@ static const IndicOTSplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x #define TAML_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT) #define TELU_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3) #define KNDA_SCRIPT_FLAGS (SF_MATRAS_AFTER_BASE | 3) -#define MLYM_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT) +#define MLYM_SCRIPT_FLAGS (SF_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT) /* * Indic Class Tables diff --git a/modules/indic/indic-ot.h b/modules/indic/indic-ot.h index caf229d4..9730db53 100644 --- a/modules/indic/indic-ot.h +++ b/modules/indic/indic-ot.h @@ -138,27 +138,6 @@ enum indic_glyph_property_ }; /* - * Per-script character ranges - */ -#define SCRIPT_RANGE_deva 0x0900, 0x0970 - -#define SCRIPT_RANGE_beng 0x0980, 0x09FA - -#define SCRIPT_RANGE_guru 0x0A00, 0x0A74 - -#define SCRIPT_RANGE_gujr 0x0A80, 0x0AEF - -#define SCRIPT_RANGE_orya 0x0B00, 0x0B70 - -#define SCRIPT_RANGE_taml 0x0B80, 0x0BF2 - -#define SCRIPT_RANGE_telu 0x0C00, 0x0C6F - -#define SCRIPT_RANGE_knda 0x0C80, 0x0CEF - -#define SCRIPT_RANGE_mlym 0x0D00, 0x0D6F - -/* * Macros to test the charClass flags for various things. */ #define IS_VM_ABOVE(charClass) ((charClass & CF_CLASS_MASK) == CC_MODIFYING_MARK_ABOVE) 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 */ |