summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheppitak Karoonboonyanan <thep@linux.thai.net>2004-10-02 03:27:29 +0000
committerTheppitak Karoonboonyanan <tkaroonb@src.gnome.org>2004-10-02 03:27:29 +0000
commit922f0deebf3927ca9168da41db8be423b37fb489 (patch)
tree52f050d724766b550399a14443b0b52070e1e4b1
parent28e4c860f283c5165a550bc6d72cbdebc4a4b420 (diff)
downloadpango-922f0deebf3927ca9168da41db8be423b37fb489.tar.gz
Make Thai module prefer OpenType tables, if available, to PUA
2004-10-02 Theppitak Karoonboonyanan <thep@linux.thai.net> Make Thai module prefer OpenType tables, if available, to PUA substitutions. (#153927) * modules/thai/thai-ot.[ch]: Merge get_gsub_ruleset() and get_gpos_ruleset() into an exported function thai_ot_get_ruleset(). Rearrange thai_ot_shape() to call it properly. * modules/thai/thai-fc.c: Try OT ruleset before PUA glyph sets.
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLog.pre-1-1013
-rw-r--r--ChangeLog.pre-1-813
-rw-r--r--modules/thai/thai-fc.c7
-rw-r--r--modules/thai/thai-ot.c128
-rw-r--r--modules/thai/thai-ot.h3
6 files changed, 100 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d5bd3a8..29be21d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-10-02 Theppitak Karoonboonyanan <thep@linux.thai.net>
+
+ Make Thai module prefer OpenType tables, if available, to PUA
+ substitutions. (#153927)
+
+ * modules/thai/thai-ot.[ch]:
+ Merge get_gsub_ruleset() and get_gpos_ruleset() into an exported
+ function thai_ot_get_ruleset(). Rearrange thai_ot_shape() to call
+ it properly.
+
+ * modules/thai/thai-fc.c:
+ Try OT ruleset before PUA glyph sets.
+
2004-09-25 Tor Lillqvist <tml@iki.fi>
* pango/pango.def: Add the new pango_renderer_* symbols.
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 6d5bd3a8..29be21d5 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,16 @@
+2004-10-02 Theppitak Karoonboonyanan <thep@linux.thai.net>
+
+ Make Thai module prefer OpenType tables, if available, to PUA
+ substitutions. (#153927)
+
+ * modules/thai/thai-ot.[ch]:
+ Merge get_gsub_ruleset() and get_gpos_ruleset() into an exported
+ function thai_ot_get_ruleset(). Rearrange thai_ot_shape() to call
+ it properly.
+
+ * modules/thai/thai-fc.c:
+ Try OT ruleset before PUA glyph sets.
+
2004-09-25 Tor Lillqvist <tml@iki.fi>
* pango/pango.def: Add the new pango_renderer_* symbols.
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 6d5bd3a8..29be21d5 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,16 @@
+2004-10-02 Theppitak Karoonboonyanan <thep@linux.thai.net>
+
+ Make Thai module prefer OpenType tables, if available, to PUA
+ substitutions. (#153927)
+
+ * modules/thai/thai-ot.[ch]:
+ Merge get_gsub_ruleset() and get_gpos_ruleset() into an exported
+ function thai_ot_get_ruleset(). Rearrange thai_ot_shape() to call
+ it properly.
+
+ * modules/thai/thai-fc.c:
+ Try OT ruleset before PUA glyph sets.
+
2004-09-25 Tor Lillqvist <tml@iki.fi>
* pango/pango.def: Add the new pango_renderer_* symbols.
diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c
index e67c05c5..f2760aa2 100644
--- a/modules/thai/thai-fc.c
+++ b/modules/thai/thai-fc.c
@@ -34,6 +34,7 @@
#include "pangofc-font.h"
#include "thai-shaper.h"
+#include "thai-ot.h"
/* No extra fields needed */
typedef PangoEngineShape ThaiEngineFc;
@@ -152,8 +153,10 @@ thai_get_font_info (PangoFont *font)
font_info = g_new (ThaiFontInfo, 1);
font_info->font = font;
- /* detect font set by determining availibility of glyphs */
- if (contain_glyphs(font, tis620_2))
+ /* detect font set by determining availibility of OT ruleset & glyphs */
+ if (thai_ot_get_ruleset (font))
+ font_info->font_set = THAI_FONT_TIS;
+ else if (contain_glyphs(font, tis620_2))
font_info->font_set = THAI_FONT_TIS_WIN;
else if (contain_glyphs(font, tis620_1))
font_info->font_set = THAI_FONT_TIS_MAC;
diff --git a/modules/thai/thai-ot.c b/modules/thai/thai-ot.c
index 33fdce3f..e02a50cf 100644
--- a/modules/thai/thai-ot.c
+++ b/modules/thai/thai-ot.c
@@ -44,70 +44,62 @@ maybe_add_gpos_feature (PangoOTRuleset *ruleset,
}
}
-static PangoOTRuleset *
-get_gsub_ruleset (FT_Face face)
+PangoOTRuleset *
+thai_ot_get_ruleset (PangoFont *font)
{
- PangoOTInfo *info = pango_ot_info_get (face);
- GQuark ruleset_quark = g_quark_from_string ("thai-gsub-ruleset");
- PangoOTRuleset *ruleset;
+ PangoFcFont *fc_font;
+ FT_Face face;
+ PangoOTInfo *info;
+ PangoOTRuleset *ruleset = NULL;
- if (!info)
- return NULL;
+ g_return_if_fail (font != NULL);
- ruleset = g_object_get_qdata (G_OBJECT (info), ruleset_quark);
+ fc_font = PANGO_FC_FONT (font);
+ face = pango_fc_font_lock_face (fc_font);
+ g_assert (face != NULL);
- if (!ruleset)
+ info = pango_ot_info_get (face);
+ if (info != NULL)
{
- PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i');
- guint script_index;
+ static GQuark ruleset_quark = 0;
- ruleset = pango_ot_ruleset_new (info);
+ if (!ruleset_quark)
+ ruleset_quark = g_quark_from_string ("thai-ot-ruleset");
- 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);
- }
-
- g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset,
- (GDestroyNotify)g_object_unref);
+ ruleset = g_object_get_qdata (G_OBJECT (info), ruleset_quark);
+ if (!ruleset)
+ {
+ PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i');
+ guint script_index;
+
+ 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);
+ }
+
+ 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);
+ }
+
+ g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset,
+ (GDestroyNotify)g_object_unref);
+ }
}
- return ruleset;
-}
-
-
-static PangoOTRuleset *
-get_gpos_ruleset (FT_Face face)
-{
- PangoOTInfo *info = pango_ot_info_get (face);
- GQuark ruleset_quark = g_quark_from_string ("thai-gpos-ruleset");
- PangoOTRuleset *ruleset;
-
- if (!info)
- return NULL;
-
- ruleset = g_object_get_qdata (G_OBJECT (info), ruleset_quark);
-
- if (!ruleset)
- {
- PangoOTTag thai_tag = FT_MAKE_TAG ('t', 'h', 'a', 'i');
- guint script_index;
-
- ruleset = pango_ot_ruleset_new (info);
-
- 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);
- }
-
- g_object_set_qdata_full (G_OBJECT (info), ruleset_quark, ruleset,
- (GDestroyNotify)g_object_unref);
- }
+ pango_fc_font_unlock_face (fc_font);
return ruleset;
}
@@ -117,27 +109,20 @@ void
thai_ot_shape (PangoFont *font,
PangoGlyphString *glyphs)
{
- FT_Face face;
- PangoOTRuleset *gsub_ruleset, *gpos_ruleset;
- PangoFcFont *fc_font;
+ PangoOTRuleset *ot_ruleset;
g_return_if_fail (font != NULL);
g_return_if_fail (glyphs != NULL);
- fc_font = PANGO_FC_FONT (font);
- face = pango_fc_font_lock_face (fc_font);
- g_assert (face != NULL);
-
- gsub_ruleset = get_gsub_ruleset (face);
- gpos_ruleset = get_gpos_ruleset (face);
+ ot_ruleset = thai_ot_get_ruleset (font);
- if (gsub_ruleset != NULL || gpos_ruleset != NULL)
+ if (ot_ruleset != NULL)
{
gint i;
PangoOTBuffer *buffer;
/* prepare ot buffer */
- buffer = pango_ot_buffer_new (fc_font);
+ buffer = pango_ot_buffer_new (PANGO_FC_FONT (font));
for (i = 0; i < glyphs->num_glyphs; i++)
{
pango_ot_buffer_add_glyph (buffer,
@@ -146,18 +131,11 @@ thai_ot_shape (PangoFont *font,
glyphs->log_clusters[i]);
}
- /* do gsub processing */
- if (gsub_ruleset != NULL)
- pango_ot_ruleset_substitute (gsub_ruleset, buffer);
-
- /* do gpos processing */
- if (gpos_ruleset != NULL)
- pango_ot_ruleset_position (gpos_ruleset, buffer);
+ pango_ot_ruleset_substitute (ot_ruleset, buffer);
+ pango_ot_ruleset_position (ot_ruleset, buffer);
pango_ot_buffer_output (buffer, glyphs);
pango_ot_buffer_destroy (buffer);
}
-
- pango_fc_font_unlock_face (fc_font);
}
diff --git a/modules/thai/thai-ot.h b/modules/thai/thai-ot.h
index 43f79ef8..4e195e8c 100644
--- a/modules/thai/thai-ot.h
+++ b/modules/thai/thai-ot.h
@@ -10,6 +10,9 @@
#include "pango-ot.h"
+PangoOTRuleset *
+thai_ot_get_ruleset (PangoFont *font);
+
void
thai_ot_shape (PangoFont *font,
PangoGlyphString *glyphs);