From 8251e4eda751a127b4a4d811f0f9c15d7bbf0f09 Mon Sep 17 00:00:00 2001 From: Theppitak Karoonboonyanan Date: Fri, 8 Oct 2004 06:14:51 +0000 Subject: Return NULL if ruleset is empty, to indicate the lack of OT features. 2004-10-08 Theppitak Karoonboonyanan * 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. --- ChangeLog | 9 +++++++++ ChangeLog.pre-1-10 | 9 +++++++++ ChangeLog.pre-1-8 | 9 +++++++++ modules/thai/thai-fc.c | 16 ++++++++-------- modules/thai/thai-ot.c | 44 ++++++++++++++++++++++++++++++-------------- 5 files changed, 65 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index e38f2f61..67fc87a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-10-08 Theppitak Karoonboonyanan + + * 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. + 2004-10-07 Theppitak Karoonboonyanan * modules/thai/thai-shaper.c (groups, group1_map, group2_map): diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index e38f2f61..67fc87a0 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,12 @@ +2004-10-08 Theppitak Karoonboonyanan + + * 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. + 2004-10-07 Theppitak Karoonboonyanan * modules/thai/thai-shaper.c (groups, group1_map, group2_map): diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index e38f2f61..67fc87a0 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,12 @@ +2004-10-08 Theppitak Karoonboonyanan + + * 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. + 2004-10-07 Theppitak Karoonboonyanan * modules/thai/thai-shaper.c (groups, group1_map, group2_map): 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; + } } } -- cgit v1.2.1