diff options
author | Theppitak Karoonboonyanan <thep@linux.thai.net> | 2004-10-08 06:14:51 +0000 |
---|---|---|
committer | Theppitak Karoonboonyanan <tkaroonb@src.gnome.org> | 2004-10-08 06:14:51 +0000 |
commit | 8251e4eda751a127b4a4d811f0f9c15d7bbf0f09 (patch) | |
tree | df9eaa91ca0daafaff9d2b6ea175e8b76e4207d2 /modules/thai | |
parent | ce53f262f3375e068a3d36f162f721bd41a0a9f7 (diff) | |
download | pango-8251e4eda751a127b4a4d811f0f9c15d7bbf0f09.tar.gz |
Return NULL if ruleset is empty, to indicate the lack of OT features.
2004-10-08 Theppitak Karoonboonyanan <thep@linux.thai.net>
* modules/thai/thai-ot.c (thai_ot_get_ruleset): Return NULL if ruleset
is empty, to indicate the lack of OT features.
* modules/thai/thai-fc.c (tis620_1): Fix the PUA glyph table, after
actually checked with sample OSX (Jaguar) fonts. This actually turns
on PUA-based shaping with Thai OSX fonts in Pango.
Diffstat (limited to 'modules/thai')
-rw-r--r-- | modules/thai/thai-fc.c | 16 | ||||
-rw-r--r-- | modules/thai/thai-ot.c | 44 |
2 files changed, 38 insertions, 22 deletions
diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c index fd0808d4..ac4c65be 100644 --- a/modules/thai/thai-fc.c +++ b/modules/thai/thai-fc.c @@ -80,22 +80,22 @@ static int tis620_0[128] = { }; static int tis620_1[128] = { - 0x00ab, 0x00bb, 0x2026, 0xf88c, 0xf88f, 0xf892, 0xf895, 0xf898, - 0xf88b, 0xf88e, 0xf891, 0xf894, 0xf897, 0x201c, 0x201d, 0xf899, - /**/ 0, 0x2022, 0xf884, 0xf889, 0xf885, 0xf886, 0xf887, 0xf888, - 0xf88a, 0xf88d, 0xf890, 0xf893, 0xf896, 0x2018, 0x2019, 0, - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + /**/ 0, 0, 0, 0xf88c, 0xf88f, 0xf892, 0xf895, 0xf898, + 0xf88b, 0xf88e, 0xf891, 0xf894, 0xf897, 0, 0, 0xf899, + /**/ 0, 0, 0xf884, 0xf889, 0xf885, 0xf886, 0xf887, 0xf888, + 0xf88a, 0xf88d, 0xf890, 0xf893, 0xf896, 0, 0, 0, + /**/ 0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 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, 0xfeff, 0x200b, 0x2013, 0x2014, 0x0e3f, + 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x2122, 0x0e4f, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0, 0x0e4f, 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x00ae, 0x00a9, 0, 0, 0, 0 + 0x0e58, 0x0e59, 0, 0, 0, 0, 0, 0 }; static int tis620_2[128] = { diff --git a/modules/thai/thai-ot.c b/modules/thai/thai-ot.c index e335901a..bd57b9b9 100644 --- a/modules/thai/thai-ot.c +++ b/modules/thai/thai-ot.c @@ -9,7 +9,7 @@ #include "thai-ot.h" -static void +static gint maybe_add_gsub_feature (PangoOTRuleset *ruleset, PangoOTInfo *info, guint script_index, @@ -24,10 +24,12 @@ maybe_add_gsub_feature (PangoOTRuleset *ruleset, { pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GSUB, feature_index, property_bit); + return 1; } + return 0; } -static void +static gint maybe_add_gpos_feature (PangoOTRuleset *ruleset, PangoOTInfo *info, guint script_index, @@ -41,7 +43,9 @@ maybe_add_gpos_feature (PangoOTRuleset *ruleset, { pango_ot_ruleset_add_feature (ruleset, PANGO_OT_TABLE_GPOS, feature_index, property_bit); + return 1; } + return 0; } PangoOTRuleset * @@ -71,31 +75,43 @@ thai_ot_get_ruleset (PangoFont *font) { PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i'); guint script_index; + gint n = 0; ruleset = pango_ot_ruleset_new (info); if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GSUB, thai_tag, &script_index)) { - maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('c','c','m','p'), 0xFFFF); - maybe_add_gsub_feature (ruleset, info, script_index, - FT_MAKE_TAG ('l','i','g','a'), 0xFFFF); + n += maybe_add_gsub_feature (ruleset, info, script_index, + FT_MAKE_TAG ('c','c','m','p'), + 0xFFFF); + n += maybe_add_gsub_feature (ruleset, info, script_index, + FT_MAKE_TAG ('l','i','g','a'), + 0xFFFF); } if (pango_ot_info_find_script (info, PANGO_OT_TABLE_GPOS, thai_tag, &script_index)) { - maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('k','e','r','n'), 0xFFFF); - maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','a','r','k'), 0xFFFF); - maybe_add_gpos_feature (ruleset, info, script_index, - FT_MAKE_TAG ('m','k','m','k'), 0xFFFF); + n += maybe_add_gpos_feature (ruleset, info, script_index, + FT_MAKE_TAG ('k','e','r','n'), + 0xFFFF); + n += maybe_add_gpos_feature (ruleset, info, script_index, + FT_MAKE_TAG ('m','a','r','k'), + 0xFFFF); + n += maybe_add_gpos_feature (ruleset, info, script_index, + FT_MAKE_TAG ('m','k','m','k'), + 0xFFFF); } - g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, - (GDestroyNotify)g_object_unref); + if (n > 0) + g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset, + (GDestroyNotify)g_object_unref); + else + { + g_object_unref (ruleset); + ruleset = NULL; + } } } |