diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-02-29 15:44:50 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-02-29 15:44:50 +0000 |
commit | 25689428204726ab37e7389661cf2827263b9893 (patch) | |
tree | 38d9d9dcdec9163cb61599d21b3dead55ee6e021 /modules/indic | |
parent | 309373b42cd6f03fe45e129e586d18bf11076be6 (diff) | |
download | pango-25689428204726ab37e7389661cf2827263b9893.tar.gz |
Rework opentype interfaces and other changes to make GPOS work for Arabic.
Sun Feb 29 09:25:13 2004 Owen Taylor <otaylor@redhat.com>
Rework opentype interfaces and other changes to make GPOS
work for Arabic. (Most of #117282, #121060)
* pango/opentype/otlbuffer.[ch]: OTL_Buffer that
acts as a replacement for the separate GSUB and
GPOS string structures and hides many of the internal
details.
* pango/opentype/ftxgsub.[ch] pango/opentype/ftxgpos.[ch]:
Adapt to OTL_Buffer.
* pango/opentype/ftxgpos.c: Redo handling of cursive
chains so that it actually works.
* pango/pango-ot.h pango/opentype/pango-ot-buffer.c:
Pango wrapper around OTL_Buffer.
* pango/pango-ot.h pango/pango-ot-ruleset.c pango/pango-ot-buffer.c:
Split pango_ot_ruleset_shape() into pango_ot_ruleset_substitute(),
pango_ot_ruleset_position(), make them act on
PangoOTBuffer, add a separate pango_ot_buffer_output()
which does the default positioning and writes to a
PangoGlyphString.
* modules/arabic/arabic-fc.c modules/indic/indic-fc.c
modules/indic/mprefixups.[ch]: Adapt to new OpenType
interfaces; add GPOS features for Arabic.
* pango/opentype/pango-ot-info.c: Don't derive class information
from Unicode properties for Arabic presentation forms,
let the shaping process derive the properties.
Diffstat (limited to 'modules/indic')
-rw-r--r-- | modules/indic/indic-fc.c | 56 | ||||
-rw-r--r-- | modules/indic/indic-ot.c | 2 | ||||
-rw-r--r-- | modules/indic/mprefixups.c | 30 | ||||
-rw-r--r-- | modules/indic/mprefixups.h | 3 |
4 files changed, 33 insertions, 58 deletions
diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c index 68b28662..45eb48f8 100644 --- a/modules/indic/indic-fc.c +++ b/modules/indic/indic-fc.c @@ -241,20 +241,18 @@ get_gpos_ruleset (FT_Face face, PangoIndicInfo *indic_info) return ruleset; } static void -set_glyphs (PangoFont *font, FT_Face face, const gunichar *wcs, glong n_glyphs, PangoGlyphString *glyphs) +set_glyphs (PangoFont *font, FT_Face face, const gunichar *wcs, gulong *tags, glong n_glyphs, PangoOTBuffer *buffer) { gint i; g_assert (face); - pango_glyph_string_set_size (glyphs, n_glyphs); - for (i = 0; i < n_glyphs; i += 1) { - PangoGlyph glyph = FT_Get_Char_Index (face, wcs[i]); - - glyphs->glyphs[i].glyph = glyph; - glyphs->log_clusters[i] = i; + pango_ot_buffer_add_glyph (buffer, + FT_Get_Char_Index (face, wcs[i]), + tags[i], + i); } } @@ -305,6 +303,7 @@ indic_engine_shape (PangoEngineShape *engine, glong *indices = NULL; FT_Face face; PangoOTRuleset *gsub_ruleset = NULL, *gpos_ruleset = NULL; + PangoOTBuffer *buffer; IndicEngineFc *indic_shape_engine = NULL; PangoIndicInfo *indic_info = NULL; PangoFcFont *fc_font; @@ -334,55 +333,27 @@ indic_engine_shape (PangoEngineShape *engine, n_glyphs = indic_ot_reorder (wc_in, utf8_offsets, n_chars, indic_info->classTable, wc_out, indices, tags, &mprefixups); pango_glyph_string_set_size (glyphs, n_glyphs); - set_glyphs(font, face, wc_out, n_glyphs, glyphs); + buffer = pango_ot_buffer_new (fc_font); + set_glyphs(font, face, wc_out, tags, n_glyphs, buffer); /* do gsub processing */ gsub_ruleset = get_gsub_ruleset (face, indic_info); if (gsub_ruleset != NULL) - { - pango_ot_ruleset_shape (gsub_ruleset, glyphs, tags); - } + pango_ot_ruleset_substitute (gsub_ruleset, buffer); /* Fix pre-modifiers for some scripts before base consonant */ if (mprefixups) { - indic_mprefixups_apply (mprefixups, glyphs); + indic_mprefixups_apply (mprefixups, buffer); indic_mprefixups_free (mprefixups); } - /* apply default positioning */ - for (i = 0; i < glyphs->num_glyphs; i += 1) - { - if (glyphs->glyphs[i].glyph != 0) - { - PangoRectangle logical_rect; - - pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect); - glyphs->glyphs[i].geometry.width = logical_rect.width; - } - else - { - glyphs->glyphs[i].geometry.width = 0; - } - - glyphs->glyphs[i].geometry.x_offset = 0; - glyphs->glyphs[i].geometry.y_offset = 0; - } - /* do gpos processing */ gpos_ruleset = get_gpos_ruleset (face, indic_info); if (gpos_ruleset != NULL) - { - gulong *tags_after_gsub; - - tags_after_gsub = g_new (gulong, glyphs->num_glyphs); - for (i = 0; i < glyphs->num_glyphs; i += 1) - tags_after_gsub[i] = tags[glyphs->log_clusters[i]]; - - pango_ot_ruleset_shape (gpos_ruleset, glyphs, tags_after_gsub); - - g_free (tags_after_gsub); - } + pango_ot_ruleset_position (gpos_ruleset, buffer); + + pango_ot_buffer_output (buffer, glyphs); /* Get the right log_clusters values */ for (i = 0; i < glyphs->num_glyphs; i += 1) @@ -390,6 +361,7 @@ indic_engine_shape (PangoEngineShape *engine, pango_fc_font_unlock_face (fc_font); + pango_ot_buffer_destroy (buffer); g_free (tags); g_free (indices); g_free (wc_out); diff --git a/modules/indic/indic-ot.c b/modules/indic/indic-ot.c index 94a689de..211d3e9c 100644 --- a/modules/indic/indic-ot.c +++ b/modules/indic/indic-ot.c @@ -10,7 +10,7 @@ #include "mprefixups.h" /* * FIXME: should the IndicOutput stuff be moved - * to a spereate .h and .c file just to keep the + * to a separate .h and .c file just to keep the * clutter down here? (it's not really usefull * anyplace else, is it?) */ diff --git a/modules/indic/mprefixups.c b/modules/indic/mprefixups.c index 29b126d0..183f29ce 100644 --- a/modules/indic/mprefixups.c +++ b/modules/indic/mprefixups.c @@ -59,7 +59,7 @@ void indic_mprefixups_add (MPreFixups *mprefixups, glong baseIndex, glong mpreIn } } -void indic_mprefixups_apply(MPreFixups *mprefixups, PangoGlyphString *glyphs) +void indic_mprefixups_apply(MPreFixups *mprefixups, PangoOTBuffer *buffer) { glong fixup; @@ -68,17 +68,22 @@ void indic_mprefixups_apply(MPreFixups *mprefixups, PangoGlyphString *glyphs) glong mpreIndex = mprefixups->fFixupData[fixup].fMPreIndex; glong mpreLimit, mpreCount, moveCount, mpreDest; glong i; - PangoGlyph *mpreSave; + PangoOTGlyph *glyphs; + int n_glyphs; + PangoOTGlyph *mpreSave; int *clusterSave; /* determine post GSUB location of baseIndex and mpreIndex */ gboolean no_base = TRUE; - for (i = 0; i<glyphs->num_glyphs; i++) { - if (glyphs->log_clusters[i] == baseIndex) { + + pango_ot_buffer_get_glyphs (buffer, &glyphs, &n_glyphs); + + for (i = 0; i < n_glyphs; i++) { + if (glyphs[i].cluster == baseIndex) { baseIndex = i + 1; no_base = FALSE; } - if (glyphs->log_clusters[i] == mpreIndex) + if (glyphs[i].cluster == mpreIndex) mpreIndex = i; } if (no_base) @@ -86,11 +91,11 @@ void indic_mprefixups_apply(MPreFixups *mprefixups, PangoGlyphString *glyphs) mpreLimit = mpreIndex + 1; - while (glyphs->glyphs[baseIndex].glyph == 0xFFFF || glyphs->glyphs[baseIndex].glyph == 0xFFFE) { + while (glyphs[baseIndex].glyph == 0xFFFF || glyphs[baseIndex].glyph == 0xFFFE) { baseIndex -= 1; } - while (glyphs->glyphs[mpreIndex].glyph == 0xFFFF || glyphs->glyphs[mpreIndex].glyph == 0xFFFE) { + while (glyphs[mpreIndex].glyph == 0xFFFF || glyphs[mpreIndex].glyph == 0xFFFE) { mpreLimit += 1; } @@ -102,22 +107,19 @@ void indic_mprefixups_apply(MPreFixups *mprefixups, PangoGlyphString *glyphs) moveCount = baseIndex - mpreLimit; mpreDest = baseIndex - mpreCount - 1; - mpreSave = g_new (PangoGlyph, mpreCount); + mpreSave = g_new (PangoOTGlyph, mpreCount); clusterSave = g_new (int, mpreCount); for (i = 0; i < mpreCount; i += 1) { - mpreSave[i] = glyphs->glyphs[mpreIndex + i].glyph; - clusterSave[i] = glyphs->log_clusters[mpreIndex + i]; + mpreSave[i] = glyphs[mpreIndex + i]; } for (i = 0; i < moveCount; i += 1) { - glyphs->glyphs[mpreIndex + i].glyph = glyphs->glyphs[mpreLimit + i].glyph; - glyphs->log_clusters[mpreIndex + i] = glyphs->log_clusters[mpreLimit + i]; + glyphs[mpreIndex + i] = glyphs[mpreLimit + i]; } for (i = 0; i < mpreCount; i += 1) { - glyphs->glyphs[mpreDest + i].glyph = mpreSave[i]; - glyphs->log_clusters[mpreDest + i] = clusterSave[i]; + glyphs[mpreDest + i] = mpreSave[i]; } g_free(mpreSave); diff --git a/modules/indic/mprefixups.h b/modules/indic/mprefixups.h index 4bab8cac..d09d6be5 100644 --- a/modules/indic/mprefixups.h +++ b/modules/indic/mprefixups.h @@ -26,6 +26,7 @@ #include <pango/pango-types.h> #include <pango/pango-glyph.h> +#include <pango/pango-ot.h> G_BEGIN_DECLS @@ -41,7 +42,7 @@ typedef struct _MPreFixups MPreFixups; MPreFixups *indic_mprefixups_new(glong char_count); void indic_mprefixups_free(MPreFixups *mprefixups); void indic_mprefixups_add(MPreFixups *mprefixups, glong baseIndex, glong mpreIndex); -void indic_mprefixups_apply(MPreFixups *mprefixups, PangoGlyphString *glyphs); +void indic_mprefixups_apply(MPreFixups *mprefixups, PangoOTBuffer *buffer); G_END_DECLS |