From: Behdad Esfahbod Date: Fri, 17 Aug 2012 00:42:44 +0000 (-0400) Subject: [HB] Remove Indic module X-Git-Tag: 1.31.0~19^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=656d473b52e3edea621c0681d2ba14363f257e84;p=platform%2Fupstream%2Fpango.git [HB] Remove Indic module --- diff --git a/configure.in b/configure.in index 38e3774..5aa923b 100644 --- a/configure.in +++ b/configure.in @@ -498,9 +498,8 @@ fi # # Checks for LibThai # -have_libthai=false LIBTHAI_REQUIRED_VERSION=0.1.9 -PKG_CHECK_MODULES(LIBTHAI, libthai >= $LIBTHAI_REQUIRED_VERSION, have_libthai=true, AC_MSG_RESULT([no])) +PKG_CHECK_MODULES(LIBTHAI, libthai >= $LIBTHAI_REQUIRED_VERSION, have_libthai=true, have_libthai=false) # # Checks for GObject Introspection @@ -513,7 +512,7 @@ GOBJECT_INTROSPECTION_CHECK([0.9.5]) # arabic_modules="arabic-lang" basic_modules="basic-fc,basic-win32,basic-x,basic-atsui,basic-coretext" -indic_modules="indic-fc,indic-lang" +indic_modules="indic-lang" thai_modules="" if $have_libthai ; then @@ -575,10 +574,7 @@ AC_SUBST(INCLUDED_LANG_MODULES) IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=", " for module in $included_modules; do - case $indic_modules in - *$module*) dir=indic ;; - *) dir=`echo $module | sed "s/-.*//"` ;; - esac + dir=`echo $module | sed "s/-.*//"` included_path="\$(top_builddir)/modules/$dir/libpango-$module.la" case $module in @@ -599,7 +595,6 @@ AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-w AM_CONDITIONAL(INCLUDE_BASIC_X, echo $included_modules | egrep '(^|,)basic-x($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_ATSUI, echo $included_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_BASIC_CORE_TEXT, echo $included_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) -AM_CONDITIONAL(INCLUDE_INDIC_FC, echo $included_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_INDIC_LANG, echo $included_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) AM_CONDITIONAL(INCLUDE_THAI_LANG, echo $included_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) @@ -609,7 +604,6 @@ AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-wi AM_CONDITIONAL(DYNAMIC_BASIC_X, echo $dynamic_modules | egrep '(^|,)basic-x($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_ATSUI, echo $dynamic_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_BASIC_CORE_TEXT, echo $dynamic_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null) -AM_CONDITIONAL(DYNAMIC_INDIC_FC, echo $dynamic_modules | egrep '(^|,)indic-fc($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_INDIC_LANG, echo $dynamic_modules | egrep '(^|,)indic-lang($|,)' > /dev/null) AM_CONDITIONAL(DYNAMIC_THAI_LANG, echo $dynamic_modules | egrep '(^|,)thai-lang($|,)' > /dev/null) diff --git a/modules/indic/Makefile.am b/modules/indic/Makefile.am index eb08cfa..599a2eb 100644 --- a/modules/indic/Makefile.am +++ b/modules/indic/Makefile.am @@ -1,31 +1,5 @@ include $(top_srcdir)/modules/Module.mk -if HAVE_FREETYPE -INCLUDES += $(FREETYPE_CFLAGS) -if INCLUDE_INDIC_FC -noinst_LTLIBRARIES += libpango-indic-fc.la -else -if DYNAMIC_INDIC_FC -module_LTLIBRARIES += pango-indic-fc.la -endif -endif -endif - -fc_sources = \ - indic-fc.c \ - indic-ot-class-tables.c \ - indic-ot.c \ - indic-ot.h \ - mprefixups.c \ - mprefixups.h - -pango_indic_fc_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_indic_fc_la_LIBADD = $(pangoft2libs) -pango_indic_fc_la_SOURCES = $(fc_sources) -libpango_indic_fc_la_SOURCES = $(fc_sources) -libpango_indic_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_indic_fc - - if INCLUDE_INDIC_LANG noinst_LTLIBRARIES += libpango-indic-lang.la else diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c deleted file mode 100644 index 3a232be..0000000 --- a/modules/indic/indic-fc.c +++ /dev/null @@ -1,348 +0,0 @@ -/* Pango - * indic-xft.c: - * - * Copyright (C) 2001, 2002 IBM Corporation - * Author: Eric Mader - * Based on arabic-xft.c by Owen Taylor - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include - -#include "indic-ot.h" - -#include "pango-engine.h" -#include "pango-ot.h" -#include "pango-utils.h" -#include "pangofc-font.h" - -typedef struct _PangoIndicInfo PangoIndicInfo; - -typedef struct _IndicEngineFc IndicEngineFc; -typedef PangoEngineShapeClass IndicEngineFcClass ; /* No extra fields needed */ - -struct _IndicEngineFc -{ - PangoEngineShape shapeEngine; - const IndicOTClassTable *classTable; -}; - -#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##_scripts, G_N_ELEMENTS(script##_scripts)} - -#define INDIC_OT_CLASS_TABLE(script) &script##_class_table - -static PangoEngineScriptInfo deva_scripts[] = { - { PANGO_SCRIPT_DEVANAGARI, "*" } -}; - -static PangoEngineScriptInfo beng_scripts[] = { - {PANGO_SCRIPT_BENGALI, "*" } -}; - -static PangoEngineScriptInfo guru_scripts[] = { - { PANGO_SCRIPT_GURMUKHI, "*" } -}; - -static PangoEngineScriptInfo gujr_scripts[] = { - { PANGO_SCRIPT_GUJARATI, "*" } -}; - -static PangoEngineScriptInfo orya_scripts[] = { - { PANGO_SCRIPT_ORIYA, "*" } -}; - -static PangoEngineScriptInfo taml_scripts[] = { - { PANGO_SCRIPT_TAMIL, "*" } -}; - -static PangoEngineScriptInfo telu_scripts[] = { - { PANGO_SCRIPT_TELUGU, "*" } -}; - -static PangoEngineScriptInfo knda_scripts[] = { - { PANGO_SCRIPT_KANNADA, "*" } -}; - -static PangoEngineScriptInfo mlym_scripts[] = { - { PANGO_SCRIPT_MALAYALAM, "*" } -}; - -static PangoEngineScriptInfo sinh_scripts[] = { - { PANGO_SCRIPT_SINHALA, "*" } -}; - -static PangoEngineInfo script_engines[] = { - INDIC_ENGINE_INFO(deva), INDIC_ENGINE_INFO(beng), INDIC_ENGINE_INFO(guru), - INDIC_ENGINE_INFO(gujr), INDIC_ENGINE_INFO(orya), INDIC_ENGINE_INFO(taml), - INDIC_ENGINE_INFO(telu), INDIC_ENGINE_INFO(knda), INDIC_ENGINE_INFO(mlym), - INDIC_ENGINE_INFO(sinh) -}; - -/* - * WARNING: These entries need to be in the same order as the entries - * in script_engines[]. - * - * FIXME: remove this requirement, either by encapsulating the order - * in a macro that calls a body macro that can be redefined, or by - * putting the pointers to the PangoEngineInfo in PangoIndicInfo... - */ -static const IndicOTClassTable *indic_ot_class_tables[] = { - INDIC_OT_CLASS_TABLE(deva), INDIC_OT_CLASS_TABLE(beng), INDIC_OT_CLASS_TABLE(guru), - INDIC_OT_CLASS_TABLE(gujr), INDIC_OT_CLASS_TABLE(orya), INDIC_OT_CLASS_TABLE(taml), - INDIC_OT_CLASS_TABLE(telu), INDIC_OT_CLASS_TABLE(knda), INDIC_OT_CLASS_TABLE(mlym), - INDIC_OT_CLASS_TABLE(sinh) -}; - -static const PangoOTFeatureMap gsub_features[] = -{ - {"ccmp", PANGO_OT_ALL_GLYPHS}, - {"locl", PANGO_OT_ALL_GLYPHS}, - {"init", init}, - {"nukt", nukt}, - {"akhn", akhn}, - {"rphf", rphf}, - {"blwf", blwf}, - {"half", half}, - {"pstf", pstf}, - {"vatu", vatu}, - {"pres", pres}, - {"blws", blws}, - {"abvs", abvs}, - {"psts", psts}, - {"haln", haln}, - {"calt", PANGO_OT_ALL_GLYPHS} -}; - -static const PangoOTFeatureMap gpos_features[] = -{ - {"blwm", blwm}, - {"abvm", abvm}, - {"dist", dist}, - {"kern", PANGO_OT_ALL_GLYPHS}, - {"mark", PANGO_OT_ALL_GLYPHS}, - {"mkmk", PANGO_OT_ALL_GLYPHS} -}; - -static void -set_glyphs (PangoFont *font, - const gunichar *wcs, - gulong *tags, - glong n_glyphs, - PangoOTBuffer *buffer, - gboolean process_zwj) -{ - gint i; - PangoFcFont *fc_font; - - g_assert (font); - - fc_font = PANGO_FC_FONT (font); - - for (i = 0; i < n_glyphs; i++) - { - guint glyph; - - if (pango_is_zero_width (wcs[i]) && - (!process_zwj || wcs[i] != 0x200D)) - glyph = PANGO_GLYPH_EMPTY; - else - { - glyph = pango_fc_font_get_glyph (fc_font, wcs[i]); - - if (!glyph) - glyph = PANGO_GET_UNKNOWN_GLYPH ( wcs[i]); - } - pango_ot_buffer_add_glyph (buffer, glyph, tags[i], i); - } -} - -/* - * FIXME: should this check for null pointers, etc.? - */ -static gunichar * -expand_text(const gchar *text, glong length, glong **offsets, glong *n_chars) -{ - const gchar *p; - gunichar *wcs, *wco; - glong i, *oo; - - *n_chars = g_utf8_strlen (text, length); - wcs = g_new (gunichar, *n_chars); - *offsets = g_new (glong, *n_chars + 1); - - p = text; - wco = wcs; - oo = *offsets; - for (i = 0; i < *n_chars; i++) - { - *wco++ = g_utf8_get_char (p); - *oo++ = p - text; - - p = g_utf8_next_char (p); - } - - *oo = p - text; - - return wcs; -} - - -/* analysis->shape_engine has the PangoEngine... */ -static void -indic_engine_shape (PangoEngineShape *engine, - PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) -{ - PangoFcFont *fc_font; - FT_Face face; - PangoOTRulesetDescription desc; - const PangoOTRuleset *ruleset; - PangoOTBuffer *buffer; - glong i, n_chars, n_glyphs; - gulong *tags = NULL; - gunichar *wc_in = NULL, *wc_out = NULL; - glong *utf8_offsets = NULL; - glong *indices = NULL; - IndicEngineFc *indic_shape_engine = NULL; - MPreFixups *mprefixups; - - g_return_if_fail (font != NULL); - g_return_if_fail (text != NULL); - g_return_if_fail (length >= 0); - g_return_if_fail (analysis != NULL); - - fc_font = PANGO_FC_FONT (font); - face = pango_fc_font_lock_face (fc_font); - if (!face) - return; - - indic_shape_engine = (IndicEngineFc *) engine; - - wc_in = expand_text (text, length, &utf8_offsets, &n_chars); - - n_glyphs = indic_ot_reorder (wc_in, utf8_offsets, n_chars, indic_shape_engine->classTable, NULL, NULL, NULL, NULL); - - wc_out = g_new (gunichar, n_glyphs); - indices = g_new (glong, n_glyphs); - tags = g_new (gulong, n_glyphs); - - n_glyphs = indic_ot_reorder (wc_in, utf8_offsets, n_chars, indic_shape_engine->classTable, wc_out, indices, tags, &mprefixups); - - pango_glyph_string_set_size (glyphs, n_glyphs); - buffer = pango_ot_buffer_new (fc_font); - pango_ot_buffer_set_rtl (buffer, analysis->level % 2 != 0); - - set_glyphs(font, wc_out, tags, n_glyphs, buffer, - (indic_shape_engine->classTable->scriptFlags & SF_PROCESS_ZWJ) != 0); - - desc.script = analysis->script; - desc.language = analysis->language; - - desc.n_static_gsub_features = G_N_ELEMENTS (gsub_features); - desc.static_gsub_features = gsub_features; - desc.n_static_gpos_features = G_N_ELEMENTS (gpos_features); - desc.static_gpos_features = gpos_features; - - /* TODO populate other_features from analysis->extra_attrs */ - desc.n_other_features = 0; - desc.other_features = NULL; - - ruleset = pango_ot_ruleset_get_for_description (pango_ot_info_get (face), &desc); - - /* do gsub processing */ - pango_ot_ruleset_substitute (ruleset, buffer); - - /* Fix pre-modifiers for some scripts before base consonant */ - if (mprefixups) - { - indic_mprefixups_apply (mprefixups, buffer); - indic_mprefixups_free (mprefixups); - } - - /* do gpos processing */ - pango_ot_ruleset_position (ruleset, buffer); - - pango_ot_buffer_output (buffer, glyphs); - - /* Get the right log_clusters values */ - for (i = 0; i < glyphs->num_glyphs; i += 1) - glyphs->log_clusters[i] = indices[glyphs->log_clusters[i]]; - - pango_fc_font_unlock_face (fc_font); - - pango_ot_buffer_destroy (buffer); - g_free (tags); - g_free (indices); - g_free (wc_out); - g_free (wc_in); - g_free (utf8_offsets); -} - -static void -indic_engine_fc_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = indic_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (IndicEngineFc, indic_engine_fc, - indic_engine_fc_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - indic_engine_fc_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - guint i; - - for (i = 0; i < G_N_ELEMENTS(script_engines); i += 1) - { - if (!strcmp(id, script_engines[i].id)) - { - IndicEngineFc *engine = g_object_new (indic_engine_fc_type, NULL); - engine->classTable = indic_ot_class_tables[i]; - - return (PangoEngine *)engine; - } - } - - return NULL; -} diff --git a/modules/indic/indic-ot-class-tables.c b/modules/indic/indic-ot-class-tables.c deleted file mode 100644 index fca63ae..0000000 --- a/modules/indic/indic-ot-class-tables.c +++ /dev/null @@ -1,524 +0,0 @@ -/* Pango - * indic-ot-class-tables.c: - * - * Copyright (C) 2001, 2002 IBM Corporation. All Rights Reserved. - * Author: Eric Mader - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished - * to do so, provided that the above copyright notice(s) and this - * permission notice appear in all copies of the Software and that - * both the above copyright notice(s) and this permission notice - * appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR - * ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written - * authorization of the copyright holder. - */ - -#include "config.h" - -#include "indic-ot.h" - - -/* - * Split matra table indices - */ -#define _x1 (1 << CF_INDEX_SHIFT) -#define _x2 (2 << CF_INDEX_SHIFT) -#define _x3 (3 << CF_INDEX_SHIFT) -#define _x4 (4 << CF_INDEX_SHIFT) -#define _x5 (5 << CF_INDEX_SHIFT) -#define _x6 (6 << CF_INDEX_SHIFT) -#define _x7 (7 << CF_INDEX_SHIFT) -#define _x8 (8 << CF_INDEX_SHIFT) -#define _x9 (9 << CF_INDEX_SHIFT) - -/* - * Simple classes - */ -#define _xx (CC_RESERVED) -#define _ma (CC_MODIFYING_MARK_ABOVE) -#define _mp (CC_MODIFYING_MARK_POST) -#define _iv (CC_INDEPENDENT_VOWEL) -#define _ct (CC_CONSONANT | CF_CONSONANT) -#define _cn (CC_CONSONANT_WITH_NUKTA | CF_CONSONANT) -#define _nu (CC_NUKTA) -#define _dv (CC_DEPENDENT_VOWEL) -#define _dl (_dv | CF_MATRA_PRE) -#define _db (_dv | CF_MATRA_BELOW) -#define _da (_dv | CF_MATRA_ABOVE) -#define _dr (_dv | CF_MATRA_POST) -#define _lm (_dv | CF_LENGTH_MARK) -#define _vr (CC_VIRAMA) -#define _al (CC_AL_LAKUNA) - -/* - * Split matras - */ -#define _s1 (_dv | _x1) -#define _s2 (_dv | _x2) -#define _s3 (_dv | _x3) -#define _s4 (_dv | _x4) -#define _s5 (_dv | _x5) -#define _s6 (_dv | _x6) -#define _s7 (_dv | _x7) -#define _s8 (_dv | _x8) -#define _s9 (_dv | _x9) - -/* - * consonants with special forms - * NOTE: this assumes that no consonants with nukta have - * special forms... (Bengali RA?) - */ -#define _bb (_ct | CF_BELOW_BASE) -#define _pb (_ct | CF_POST_BASE) -#define _vt (_bb | CF_VATTU) -#define _rv (_vt | CF_REPH) -#define _rp (_pb | CF_REPH) -#define _rb (_bb | CF_REPH) - - -/* - * Character class tables - */ -static const IndicOTCharClass devaCharClasses[] = -{ - _xx, _ma, _ma, _mp, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, /* 0900 - 090F */ - _iv, _iv, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0910 - 091F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _cn, _ct, _ct, _ct, _ct, _ct, _ct, /* 0920 - 092F */ - _rv, _cn, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, /* 0930 - 093F */ - _dr, _db, _db, _db, _db, _da, _da, _da, _da, _dr, _dr, _dr, _dr, _vr, _xx, _xx, /* 0940 - 094F */ - _xx, _xx, _db, _da, _da, _xx, _xx, _xx, _cn, _cn, _cn, _cn, _cn, _cn, _cn, _cn, /* 0950 - 095F */ - _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0960 - 096F */ - _xx, _xx, _iv, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _ct /* 0970 - 097F */ -}; - -/* As a hack, BENGALI LETTER A (U+0985) and BENGALI LETTER E (U+098F) - * are marked as consonants below; this gives approximately the - * right behavior for the sequences "a halant ya aa" and - * "e halant ya aa". - */ -static const IndicOTCharClass bengCharClasses[] = -{ - _xx, _ma, _mp, _mp, _xx, _ct, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _ct, /* 0980 - 098F */ - _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0990 - 099F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _bb, _ct, _ct, _pb, /* 09A0 - 09AF */ - _rv, _xx, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, /* 09B0 - 09BF */ - _dr, _db, _db, _db, _db, _xx, _xx, _dl, _dl, _xx, _xx, _s1, _s2, _vr, _xx, _xx, /* 09C0 - 09CF */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _dr, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _cn, /* 09D0 - 09DF */ - _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 09E0 - 09EF */ - _rv, _ct, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 09F0 - 09FA */ -}; - -static const IndicOTCharClass guruCharClasses[] = -{ - _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _xx, _iv, /* 0A00 - 0A0F */ - _iv, _xx, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0A10 - 0A1F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _bb, /* 0A20 - 0A2F */ - _vt, _xx, _ct, _cn, _xx, _bb, _cn, _xx, _ct, _bb, _xx, _xx, _nu, _xx, _dr, _dl, /* 0A30 - 0A3F */ - _dr, _db, _db, _xx, _xx, _xx, _xx, _da, _da, _xx, _xx, _da, _da, _vr, _xx, _xx, /* 0A40 - 0A4F */ - _xx, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _cn, _cn, _cn, _ct, _xx, _cn, _xx, /* 0A50 - 0A5F */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0A60 - 0A6F */ - _ma, _ma, _iv, _iv, _xx, _db /* 0A70 - 0A75 */ -}; - -static const IndicOTCharClass gujrCharClasses[] = -{ - _xx, _ma, _ma, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _xx, _iv, /* 0A80 - 0A8F */ - _iv, _iv, _xx, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0A90 - 0A9F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, /* 0AA0 - 0AAF */ - _rv, _xx, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _nu, _xx, _dr, _dl, /* 0AB0 - 0ABF */ - _dr, _db, _db, _db, _db, _da, _xx, _da, _da, _dr, _xx, _dr, _dr, _vr, _xx, _xx, /* 0AC0 - 0ACF */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0AD0 - 0ADF */ - _iv, _xx, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 0AE0 - 0AEF */ -}; - -static const IndicOTCharClass oryaCharClasses[] = -{ - _xx, _ma, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _iv, /* 0B00 - 0B0F */ - _iv, _xx, _xx, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _ct, _bb, /* 0B10 - 0B1F */ - _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _pb, /* 0B20 - 0B2F */ - _rb, _xx, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _nu, _xx, _dr, _da, /* 0B30 - 0B3F */ - _dr, _db, _db, _db, _db, _xx, _xx, _dl, _s1, _xx, _xx, _s2, _s3, _vr, _xx, _xx, /* 0B40 - 0B4F */ - _xx, _xx, _xx, _xx, _xx, _xx, _da, _dr, _xx, _xx, _xx, _xx, _cn, _cn, _xx, _pb, /* 0B50 - 0B5F */ - _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0B60 - 0B6F */ - _xx, _bb /* 0B70 - 0B71 */ -}; - -static const IndicOTCharClass tamlCharClasses[] = -{ - _xx, _xx, _ma, _xx, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _iv, _iv, /* 0B80 - 0B8F */ - _iv, _xx, _iv, _iv, _iv, _ct, _xx, _xx, _xx, _ct, _ct, _xx, _ct, _xx, _ct, _ct, /* 0B90 - 0B9F */ - _xx, _xx, _xx, _ct, _ct, _xx, _xx, _xx, _ct, _ct, _ct, _xx, _xx, _xx, _ct, _ct, /* 0BA0 - 0BAF */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _dr, _dr, /* 0BB0 - 0BBF */ - _da, _dr, _dr, _xx, _xx, _xx, _dl, _dl, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, /* 0BC0 - 0BCF */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _dr, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0BD0 - 0BDF */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0BE0 - 0BEF */ - _xx, _xx, _xx /* 0BF0 - 0BF2 */ -}; - -/* FIXME: Should some of the bb's be pb's? (KA, NA, MA, YA, VA, etc. (approx 13)) */ -static const IndicOTCharClass teluCharClasses[] = -{ - _xx, _mp, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, /* 0C00 - 0C0F */ - _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, /* 0C10 - 0C1F */ - _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, /* 0C20 - 0C2F */ - _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _xx, _xx, _da, _da, /* 0C30 - 0C3F */ - _da, _dr, _dr, _lm, _lm, _xx, _da, _da, _s1, _xx, _da, _da, _da, _vr, _xx, _xx, /* 0C40 - 0C4F */ - _xx, _xx, _xx, _xx, _xx, _da, _db, _xx, _bb, _bb, _xx, _xx, _xx, _xx, _xx, _xx, /* 0C50 - 0C5F */ - _iv, _iv, _lm, _lm, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0C60 - 0C6F */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 0C70 - 0C7F */ -}; - -/* U+CC3 and U+CC4 are _lm here not _dr since the Kannada rendering - * rules want them below and to the right of the entire cluster. They - * aren't, strictly speaking, length marks, however. - * - * There's some information about this in: - * - * http://brahmi.sourceforge.net/docs/KannadaComputing.html - */ -static const IndicOTCharClass kndaCharClasses[] = -{ - _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, /* 0C80 - 0C8F */ - _iv, _xx, _iv, _iv, _iv, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, /* 0C90 - 0C9F */ - _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _bb, /* 0CA0 - 0CAF */ - _rb, _bb, _bb, _bb, _xx, _bb, _bb, _bb, _bb, _bb, _xx, _xx, _nu, _xx, _dr, _da, /* 0CB0 - 0CBF */ - _s1, _dr, _dr, _lm, _lm, _xx, _da, _s2, _s3, _xx, _s4, _s5, _da, _vr, _xx, _xx, /* 0CC0 - 0CCF */ - _xx, _xx, _xx, _xx, _xx, _lm, _lm, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _ct, _xx, /* 0CD0 - 0CDF */ - _iv, _iv, _lm, _lm, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 0CE0 - 0CEF */ -}; - -/* - * FIXME: this is correct for old-style Malayalam (MAL) but not for reformed Malayalam (MLR) - * FIXME: should there be a REPH for old-style Malayalam? - */ -static const IndicOTCharClass mlymCharClasses[] = -{ - _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _iv, _iv, /* 0D00 - 0D0F */ - _iv, _xx, _iv, _iv, _iv, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0D10 - 0D1F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _pb, /* 0D20 - 0D2F */ - _cn, _cn, _ct, _ct, _ct, _pb, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _xx, _dr, _dr, /* 0D30 - 0D3F */ - _dr, _dr, _dr, _dr, _dr, _xx, _dl, _dl, _dl, _xx, _s1, _s2, _s3, _vr, _xx, _xx, /* 0D40 - 0D4F */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _dr, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0D50 - 0D5F */ - _iv, _iv, _db, _db, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0D60 - 0D6F */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx /* 0D70 - 0D7F */ -}; - -static const IndicOTCharClass sinhCharClasses[] = -{ - _xx, _xx, _mp, _mp, _xx, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, _iv, /* 0D80 - 0D8F */ - _iv, _iv, _iv, _iv, _iv, _iv, _iv, _xx, _xx, _xx, _ct, _ct, _ct, _ct, _ct, _ct, /* 0D90 - 0D9F */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, /* 0DA0 - 0DAF */ - _ct, _ct, _xx, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _ct, _xx, _xx, /* 0DB0 - 0DBF */ - _ct, _ct, _ct, _ct, _ct, _ct, _ct, _xx, _xx, _xx, _al, _xx, _xx, _xx, _xx, _dr, /* 0DC0 - 0DCF */ - _dr, _dr, _da, _da, _db, _xx, _db, _xx, _dr, _dl, _s1, _dl, _s2, _s3, _s4, _dr, /* 0DD0 - 0DDF */ - _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, _xx, /* 0DE0 - 0DEF */ - _xx, _xx, _dr, _dr, _xx /* 0DF0 - 0DF4 */ -}; - - -/* - * Split matra tables - */ -static const IndicOTSplitMatra bengSplitTable[] = {{0x09C7, 0x09BE}, {0x09C7, 0x09D7}}; - -static const IndicOTSplitMatra oryaSplitTable[] = {{0x0B47, 0x0B56}, {0x0B47, 0x0B3E}, {0x0B47, 0x0B57}}; - -static const IndicOTSplitMatra tamlSplitTable[] = {{0x0BC6, 0x0BBE}, {0x0BC7, 0x0BBE}, {0x0BC6, 0x0BD7}}; - -static const IndicOTSplitMatra teluSplitTable[] = {{0x0C46, 0x0C56}}; - -static const IndicOTSplitMatra kndaSplitTable[] = {{0x0CBF, 0x0CD5}, {0x0CC6, 0x0CD5}, {0x0CC6, 0x0CD6}, {0x0CC6, 0x0CC2}, - {0x0CC6, 0x0CC2, 0x0CD5}}; - -static const IndicOTSplitMatra mlymSplitTable[] = {{0x0D46, 0x0D3E}, {0x0D47, 0x0D3E}, {0x0D46, 0x0D57}}; - -static const IndicOTSplitMatra sinhSplitTable[] = {{0x0DD9, 0x0DCA}, {0x0DD9, 0x0DCF}, {0x0DD9, 0x0DCF, 0x0DCA}, - {0x0DD9, 0x0DDF} }; - - -/* - * Script Flags - */ - -/* - * FIXME: post 'GSUB' reordering of MATRA_PRE's for Malayalam and Tamil - * FIXME: reformed Malayalam needs to reorder VATTU to before base glyph... - * FIXME: eyelash RA only for Devanagari?? - */ -#define DEVA_SCRIPT_FLAGS (SF_EYELASH_RA | SF_NO_POST_BASE_LIMIT) -#define BENG_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT) -#define GURU_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT) -#define GUJR_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT) -#define ORYA_SCRIPT_FLAGS (SF_REPH_AFTER_BELOW | SF_NO_POST_BASE_LIMIT) -#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_MPRE_FIXUP | SF_NO_POST_BASE_LIMIT | SF_PROCESS_ZWJ) -#define SINH_SCRIPT_FLAGS (SF_NO_POST_BASE_LIMIT | SF_PROCESS_ZWJ) - -/* - * Indic Class Tables - */ -/* Add a little macro to compute lastChar based on size of the charClasses * table */ -#define INDIC_OT_CLASS_TABLE_DEFINE(name, firstChar, worstCaseExpansion, scriptFlags, charClasses, splitMatraTable) \ - const IndicOTClassTable name = {firstChar, firstChar + G_N_ELEMENTS (charClasses) - 1, \ - worstCaseExpansion, scriptFlags, charClasses, splitMatraTable} -INDIC_OT_CLASS_TABLE_DEFINE (deva_class_table, 0x0900, 2, DEVA_SCRIPT_FLAGS, devaCharClasses, NULL); -INDIC_OT_CLASS_TABLE_DEFINE (beng_class_table, 0x0980, 3, BENG_SCRIPT_FLAGS, bengCharClasses, bengSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (guru_class_table, 0x0A00, 2, GURU_SCRIPT_FLAGS, guruCharClasses, NULL); -INDIC_OT_CLASS_TABLE_DEFINE (gujr_class_table, 0x0A80, 2, GUJR_SCRIPT_FLAGS, gujrCharClasses, NULL); -INDIC_OT_CLASS_TABLE_DEFINE (orya_class_table, 0x0B00, 3, ORYA_SCRIPT_FLAGS, oryaCharClasses, oryaSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (taml_class_table, 0x0B80, 3, TAML_SCRIPT_FLAGS, tamlCharClasses, tamlSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (telu_class_table, 0x0C00, 3, TELU_SCRIPT_FLAGS, teluCharClasses, teluSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (knda_class_table, 0x0C80, 4, KNDA_SCRIPT_FLAGS, kndaCharClasses, kndaSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (mlym_class_table, 0x0D00, 3, MLYM_SCRIPT_FLAGS, mlymCharClasses, mlymSplitTable); -INDIC_OT_CLASS_TABLE_DEFINE (sinh_class_table, 0x0D80, 4, SINH_SCRIPT_FLAGS, sinhCharClasses, sinhSplitTable); - -const IndicOTSplitMatra *indic_ot_get_split_matra(const IndicOTClassTable *class_table, IndicOTCharClass char_class) -{ - gint32 index = (char_class & CF_INDEX_MASK) >> CF_INDEX_SHIFT; - - return &class_table->splitMatraTable[index - 1]; -} - -gboolean indic_ot_is_vm_above(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_VM_ABOVE(char_class); -} - -gboolean indic_ot_is_vm_post(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_VM_POST(char_class); -} - -gboolean indic_ot_is_consonant(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_CONSONANT(char_class); -} - -gboolean indic_ot_is_reph(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_REPH(char_class); -} - -gboolean indic_ot_is_virama(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return (IS_VIRAMA(char_class) || IS_AL_LAKUNA(char_class)); -} - -gboolean indic_ot_is_al_lakuna(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_AL_LAKUNA(char_class); -} - -gboolean indic_ot_is_nukta(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_NUKTA(char_class); -} - -gboolean indic_ot_is_vattu(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_VATTU(char_class); -} - -gboolean indic_ot_is_matra(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_MATRA(char_class); -} - -gboolean indic_ot_is_split_matra(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_SPLIT_MATRA(char_class); -} - -gboolean indic_ot_is_m_pre(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_M_PRE(char_class); -} - -gboolean indic_ot_is_m_below(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_M_BELOW(char_class); -} - -gboolean indic_ot_is_m_above(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_M_ABOVE(char_class); -} - -gboolean indic_ot_is_m_post(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_M_POST(char_class); -} - -gboolean indic_ot_is_length_mark(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return IS_LENGTH_MARK(char_class); -} - -gboolean indic_ot_has_post_or_below_base_form(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return HAS_POST_OR_BELOW_BASE_FORM(char_class); -} - -gboolean indic_ot_has_post_base_form(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return HAS_POST_BASE_FORM(char_class); -} - -gboolean indic_ot_has_below_base_form(const IndicOTClassTable *class_table, gunichar ch) -{ - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, ch); - - return HAS_BELOW_BASE_FORM(char_class); -} - -IndicOTCharClass indic_ot_get_char_class(const IndicOTClassTable *class_table, gunichar ch) -{ - if (ch == C_SIGN_ZWJ) { - return CF_CONSONANT | CC_ZERO_WIDTH_MARK; - } - - if (ch == C_SIGN_ZWNJ) { - return CC_ZERO_WIDTH_MARK; - } - - if (ch < class_table->firstChar || ch > class_table->lastChar) { - return CC_RESERVED; - } - - return class_table->charClasses[ch - class_table->firstChar]; -} - -static const gint8 stateTable[][CC_COUNT] = -{ -/* xx ma mp iv ct cn nu dv vr zw al */ - { 1, 1, 1, 5, 3, 2, 1, 1, 1, 1, 1}, - {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, - {-1, 6, 1, -1, -1, -1, -1, 5, 4, -1, -1}, - {-1, 6, 1, -1, -1, -1, 2, 5, 4, 10, 9}, - {-1, -1, -1, -1, 3, 2, -1, -1, -1, 8, -1}, - {-1, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {-1, 7, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {-1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1}, - {-1, -1, -1, -1, 3, 2, -1, -1, -1, -1, -1}, - {-1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1}, - {-1, -1, -1, -1, -1, -1, -1, -1, 8, -1, 8} - -}; - -glong indic_ot_find_syllable(const IndicOTClassTable *class_table, const gunichar *chars, glong prev, glong char_count) -{ - glong cursor = prev; - gint8 state = 0; - - while (cursor < char_count) { - IndicOTCharClass char_class = indic_ot_get_char_class(class_table, chars[cursor]); - - state = stateTable[state][char_class & CF_CLASS_MASK]; - - /*for the components of split matra*/ - if ((char_count >= cursor + 3) && - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCF && chars[cursor + 2] == 0x0DCA)) { /*for 3 split matra of Sinhala*/ - return cursor + 3; - } - else if ((char_count >= cursor + 3) && - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2 && chars[cursor + 2] == 0x0CD5)) { /*for 3 split matra of Kannada*/ - return cursor + 3; - } - /*for 2 split matra*/ - else if (char_count >= cursor + 2) { - /*for Bengali*/ - if ((chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09BE) || - (chars[cursor] == 0x09C7 && chars[cursor + 1] == 0x09D7) || - /*for Oriya*/ - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B3E) || - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B56) || - (chars[cursor] == 0x0B47 && chars[cursor + 1] == 0x0B57) || - /*for Tamil*/ - (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BBE) || - (chars[cursor] == 0x0BC6 && chars[cursor + 1] == 0x0BD7) || - (chars[cursor] == 0x0BC7 && chars[cursor + 1] == 0x0BBE) || - /*for Malayalam*/ - (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D3E) || - (chars[cursor] == 0x0D46 && chars[cursor + 1] == 0x0D57) || - (chars[cursor] == 0x0D47 && chars[cursor + 1] == 0x0D3E) || - /*for Sinhala*/ - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCA) || - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DCF) || - (chars[cursor] == 0x0DD9 && chars[cursor + 1] == 0x0DDF) || - (chars[cursor] == 0x0DDC && chars[cursor + 1] == 0x0DCA) || - /*for Telugu*/ - (chars[cursor] == 0x0C46 && chars[cursor + 1] == 0x0C56) || - /*for Kannada*/ - (chars[cursor] == 0x0CBF && chars[cursor + 1] == 0x0CD5) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD5) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CD6) || - (chars[cursor] == 0x0CC6 && chars[cursor + 1] == 0x0CC2) || - (chars[cursor] == 0x0CCA && chars[cursor + 1] == 0x0CD5)) - return cursor + 2; - } - - if (state < 0) { - break; - } - - cursor += 1; - } - - return cursor; -} - diff --git a/modules/indic/indic-ot.c b/modules/indic/indic-ot.c deleted file mode 100644 index 7a72d34..0000000 --- a/modules/indic/indic-ot.c +++ /dev/null @@ -1,521 +0,0 @@ -/* Pango - * indic-ot.c: - * - * Copyright (C) 2001, 2002 IBM Corporation. All Rights Reserved. - * Author: Eric Mader - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished - * to do so, provided that the above copyright notice(s) and this - * permission notice appear in all copies of the Software and that - * both the above copyright notice(s) and this permission notice - * appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR - * ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written - * authorization of the copyright holder. - */ - -#include "config.h" - -#include "indic-ot.h" -#include "mprefixups.h" -/* - * FIXME: should the IndicOutput stuff be moved - * to a separate .h and .c file just to keep the - * clutter down here? (it's not really usefull - * anyplace else, is it?) - */ -struct _Output -{ - glong fOutIndex; - - const glong *fOriginalOffsets; - - gunichar *fOutChars; - glong *fCharIndices; - gulong *fCharTags; - - gunichar fMpre; - gunichar fMbelow; - gunichar fMabove; - gunichar fMpost; - gunichar fLengthMark; - gunichar fAlLakuna; /* to handle Al-Lakuna in sinhala split matras */ - glong fMatraIndex; - gulong fMatraTags; - gboolean fMatraWordStart; - glong fMPreOutIndex; - - MPreFixups *fMPreFixups; -}; - -typedef struct _Output Output; - -static void initOutput(Output *output, const glong *originalOffsets, gunichar *outChars, glong *charIndices, gulong *charTags, MPreFixups *mpreFixups) -{ - output->fOriginalOffsets = originalOffsets; - - output->fOutChars = outChars; - output->fCharIndices = charIndices; - output->fCharTags = charTags; - - output->fOutIndex = 0; - output->fMatraTags = 0; - - output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = output->fAlLakuna = 0; - - output->fMPreOutIndex = -1; - output->fMPreFixups = mpreFixups; -} - -static void saveMatra(Output *output, gunichar matra, IndicOTCharClass matraClass) -{ - /* FIXME: check if already set, or if not a matra... */ - if (IS_M_PRE(matraClass)) { - output->fMpre = matra; - } else if (IS_M_BELOW(matraClass)) { - output->fMbelow = matra; - } else if (IS_M_ABOVE(matraClass)) { - output->fMabove = matra; - } else if (IS_M_POST(matraClass)) { - output->fMpost = matra; - } else if (IS_LENGTH_MARK(matraClass)) { - output->fLengthMark = matra; - } else if (IS_AL_LAKUNA(matraClass)) { - output->fAlLakuna = matra; - } -} - -static void initMatra(Output *output, guint32 matraIndex, gulong matraTags, gboolean wordStart) -{ - output->fMpre = output->fMbelow = output->fMabove = output->fMpost = output->fLengthMark = output->fAlLakuna = 0; - output->fMPreOutIndex = -1; - output->fMatraIndex = matraIndex; - output->fMatraTags = matraTags; - output->fMatraWordStart = wordStart; -} - -static gboolean noteMatra(Output *output, const IndicOTClassTable *classTable, gunichar matra) -{ - IndicOTCharClass matraClass = indic_ot_get_char_class(classTable, matra); - - if (IS_MATRA(matraClass)) { - if (IS_SPLIT_MATRA(matraClass)) { - const IndicOTSplitMatra *splitMatra = indic_ot_get_split_matra(classTable, matraClass); - int i; - - for (i = 0; i < 3 && (*splitMatra)[i] != 0; i += 1) { - gunichar piece = (*splitMatra)[i]; - IndicOTCharClass pieceClass = indic_ot_get_char_class(classTable, piece); - - saveMatra(output, piece, pieceClass); - } - } else { - saveMatra(output, matra, matraClass); - } - - return TRUE; - } else - return FALSE; -} - -static void noteBaseConsonant(Output *output) -{ - if (output->fMPreFixups && output->fMPreOutIndex >= 0) { - indic_mprefixups_add(output->fMPreFixups, output->fOutIndex, output->fMPreOutIndex); - } -} - -static void writeChar(Output *output, gunichar ch, guint32 charIndex, gulong charTags) -{ - if (output->fOutChars != NULL) { - output->fOutChars[output->fOutIndex] = ch; - output->fCharIndices[output->fOutIndex] = output->fOriginalOffsets[charIndex]; - output->fCharTags[output->fOutIndex] = charTags; - } - - output->fOutIndex += 1; -} - -static void writeMpre(Output *output) -{ - if (output->fMpre != 0) { - gulong tags = output->fMatraTags; - if (output->fMatraWordStart) - tags &= ~init; - - output->fMPreOutIndex = output->fOutIndex; - writeChar(output, output->fMpre, output->fMatraIndex, tags); - } -} - -static void writeMbelow(Output *output) -{ - if (output->fMbelow != 0) { - writeChar(output, output->fMbelow, output->fMatraIndex, output->fMatraTags); - } -} - -static void writeMabove(Output *output) -{ - if (output->fMabove != 0) { - writeChar(output, output->fMabove, output->fMatraIndex, output->fMatraTags); - } -} - -static void writeMpost(Output *output) -{ - if (output->fMpost != 0) { - writeChar(output, output->fMpost, output->fMatraIndex, output->fMatraTags); - } -} - -static void writeLengthMark(Output *output) -{ - if (output->fLengthMark != 0) { - writeChar(output, output->fLengthMark, output->fMatraIndex, output->fMatraTags); - } -} - -static void writeAlLakuna(Output *output) -{ - if (output->fAlLakuna != 0) { - writeChar(output, output->fAlLakuna, output->fMatraIndex, output->fMatraTags); - } -} - -static glong getOutputIndex(Output *output) -{ - return output->fOutIndex; -} - -#define false 0 -#define true 1 - -glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong char_count, const IndicOTClassTable *class_table, gunichar *out_chars, glong *char_indices, gulong *char_tags, MPreFixups **outMPreFixups) -{ - MPreFixups *mpreFixups = NULL; - Output output; - glong i, prev = 0; - gboolean last_in_word = FALSE; - - if (outMPreFixups && (class_table->scriptFlags & SF_MPRE_FIXUP)) { - mpreFixups = indic_mprefixups_new (char_count); - } - - initOutput(&output, utf8_offsets, out_chars, char_indices, char_tags, mpreFixups); - - while (prev < char_count) { - glong syllable = indic_ot_find_syllable(class_table, chars, prev, char_count); - glong matra, vmabove, vmpost = syllable; - - while (vmpost > prev && indic_ot_is_vm_post(class_table, chars[vmpost - 1])) { - vmpost -= 1; - } - - vmabove = vmpost; - while (vmabove > prev && indic_ot_is_vm_above(class_table, chars[vmabove - 1])) { - vmabove -= 1; - } - - matra = vmabove - 1; - initMatra(&output, prev, blwf_p, !last_in_word); - while (noteMatra(&output, class_table, chars[matra]) && - matra != prev) - matra--; - - last_in_word = TRUE; - switch (indic_ot_get_char_class(class_table, chars[prev]) & CF_CLASS_MASK) { - case CC_RESERVED: - last_in_word = FALSE; - /* Fall through */ - case CC_INDEPENDENT_VOWEL: - case CC_ZERO_WIDTH_MARK: - for (i = prev; i < syllable; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - - break; - - case CC_MODIFYING_MARK_ABOVE: - case CC_MODIFYING_MARK_POST: - case CC_NUKTA: - case CC_VIRAMA: - /* patch for rendering fix for Malayalam SAMVRUTHOKARA by suresh */ - if (chars[prev - 1] == 0x0D41) { - writeChar(&output, chars[prev], prev, blwf_p); - break; - } - /* end patch */ - - case CC_AL_LAKUNA: - writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); - writeChar(&output, chars[prev], prev, blwf_p); - break; - - case CC_DEPENDENT_VOWEL: - writeMpre(&output); - writeChar(&output, C_DOTTED_CIRCLE, prev, blwf_p); - writeMbelow(&output); - writeMabove(&output); - writeMpost(&output); - writeLengthMark(&output); - writeAlLakuna(&output); - break; - - case CC_CONSONANT: - case CC_CONSONANT_WITH_NUKTA: - { - guint32 length = vmabove - prev; - glong lastConsonant = vmabove - 1; - glong baseLimit = prev; - glong baseConsonant, postBase, postBaseLimit; - gboolean seenVattu, seenBelowBaseForm, supressVattu; - glong bcSpan; - - /* Check for REPH at front of syllable */ - if (length > 2 && indic_ot_is_reph(class_table, chars[prev]) && indic_ot_is_virama(class_table, chars[prev + 1])) { - baseLimit += 2; - - /* Check for eyelash RA, if the script supports it */ - if ((class_table->scriptFlags & SF_EYELASH_RA) != 0 && - chars[baseLimit] == C_SIGN_ZWJ) { - if (length > 3) { - baseLimit += 1; - } else { - baseLimit -= 2; - } - } - } - - while (lastConsonant > baseLimit && !indic_ot_is_consonant(class_table, chars[lastConsonant])) { - lastConsonant -= 1; - } - - baseConsonant = lastConsonant; - postBase = lastConsonant + 1; - - postBaseLimit = class_table->scriptFlags & SF_POST_BASE_LIMIT_MASK; - seenVattu = false; - seenBelowBaseForm = false; - supressVattu = true; - - while (baseConsonant > baseLimit) { - IndicOTCharClass charClass = indic_ot_get_char_class(class_table, chars[baseConsonant]); - - if (IS_CONSONANT(charClass)) { - if (postBaseLimit == 0 || seenVattu || - (baseConsonant > baseLimit && !indic_ot_is_virama(class_table, chars[baseConsonant - 1])) || - !HAS_POST_OR_BELOW_BASE_FORM(charClass)) { - break; - } - - seenVattu = IS_VATTU(charClass); - - if (HAS_POST_BASE_FORM(charClass)) { - if (seenBelowBaseForm) { - break; - } - - postBase = baseConsonant; - } else if (HAS_BELOW_BASE_FORM(charClass)) { - seenBelowBaseForm = true; - } - - postBaseLimit -= 1; - } - - baseConsonant -= 1; - } - - /* Write Mpre */ - writeMpre(&output); - - /* Write eyelash RA */ - /* NOTE: baseLimit == prev + 3 iff eyelash RA present... */ - if (baseLimit == prev + 3) { - writeChar(&output, chars[prev], prev, half_p); - writeChar(&output, chars[prev + 1], prev /*+ 1*/, half_p); - writeChar(&output, chars[prev + 2], prev /*+ 2*/, half_p); - } - - /* write any pre-base consonants */ - supressVattu = true; - - for (i = baseLimit; i < baseConsonant; i += 1) { - gunichar ch = chars[i]; - /* Applying blwf to the first consonant doesn't makes sense - * since the below-form follows the consonant that it is - * put under */ - gulong tag = (i == baseLimit) ? half_p : blwf_p; - IndicOTCharClass charClass = indic_ot_get_char_class(class_table, ch); - - if (IS_CONSONANT(charClass)) { - if (IS_VATTU(charClass) && supressVattu) { - tag = nukt_p; - } - else if ((i + 2 < baseConsonant) && (chars[i + 2] == C_SIGN_ZWNJ)) { - tag = nukt_p; - } - - supressVattu = IS_VATTU(charClass); - } else if (IS_VIRAMA(charClass) && chars[i + 1] == C_SIGN_ZWNJ) - { - tag = nukt_p; - } - - writeChar(&output, ch, /*i*/ prev, tag); - } - - bcSpan = baseConsonant + 1; - - if (bcSpan < vmabove && indic_ot_is_nukta(class_table, chars[bcSpan])) { - bcSpan += 1; - } - - if (baseConsonant == lastConsonant && bcSpan < vmabove && indic_ot_is_virama(class_table, chars[bcSpan])) { - bcSpan += 1; - - if (bcSpan < vmabove && chars[bcSpan] == C_SIGN_ZWNJ) { - bcSpan += 1; - } - } - - /* note the base consonant for post-GSUB fixups */ - noteBaseConsonant(&output); - - /* write base consonant */ - for (i = baseConsonant; i < bcSpan; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, nukt_p); - } - - if ((class_table->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) { - gboolean is_for_0C48 = FALSE; - if (output.fOutChars != NULL) { /*for 0x0C48 of Telugu*/ - int t; - for (t = prev; t < syllable; t++) { - if (chars[t] == 0x0C48) { - writeMabove(&output); - writeMbelow(&output); - writeMpost(&output); - - is_for_0C48 = TRUE; - break; - } - } - } - - if (!is_for_0C48) { - writeMbelow(&output); - writeMabove(&output); - writeMpost(&output); - } - } - - /* write below-base consonants */ - if (baseConsonant != lastConsonant) { - for (i = bcSpan + 1; i < postBase; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - - if (postBase > lastConsonant) { - /* write halant that was after base consonant */ - writeChar(&output, chars[bcSpan], /*bcSpan*/ prev, blwf_p); - } - } - - /* write Mbelow, Mabove */ - if ((class_table->scriptFlags & SF_MATRAS_AFTER_BASE) == 0) { - writeMbelow(&output); - writeMabove(&output); - } - - if ((class_table->scriptFlags & SF_REPH_AFTER_BELOW) != 0) { - if (baseLimit == prev + 2) { - writeChar(&output, chars[prev], prev, rphf_p); - writeChar(&output, chars[prev + 1], prev /*+ 1*/, rphf_p); - } - - /* write VMabove */ - for (i = vmabove; i < vmpost; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - } - - /* write post-base consonants */ - if (baseConsonant != lastConsonant) { - if (postBase <= lastConsonant) { - for (i = postBase; i <= lastConsonant; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, pstf_p); - } - - /* write halant that was after base consonant */ - writeChar(&output, chars[bcSpan], /*bcSpan*/ prev, blwf_p); - } - - /* write the training halant, if there is one */ - if (lastConsonant < matra && indic_ot_is_virama(class_table, chars[matra])) { - writeChar(&output, chars[matra], /*matra*/ prev, nukt_p); - } - } - - /* write Mpost */ - if ((class_table->scriptFlags & SF_MATRAS_AFTER_BASE) == 0) { - writeMpost(&output); - } - - writeLengthMark(&output); - writeAlLakuna(&output); - - /* write reph */ - if ((class_table->scriptFlags & SF_REPH_AFTER_BELOW) == 0) { - if (baseLimit == prev + 2) { - writeChar(&output, chars[prev], prev, rphf_p); - writeChar(&output, chars[prev + 1], prev /*+ 1*/, rphf_p); - } - - /* write VMabove */ - for (i = vmabove; i < vmpost; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - } - - /* write VMpost */ - for (i = vmpost; i < syllable; i += 1) { - writeChar(&output, chars[i], /*i*/ prev, blwf_p); - } - - break; - } - - default: - break; - } - - - prev = syllable; - } - - if (outMPreFixups) { - *outMPreFixups = mpreFixups; - } - - return getOutputIndex(&output); -} diff --git a/modules/indic/indic-ot.h b/modules/indic/indic-ot.h deleted file mode 100644 index 47dd39f..0000000 --- a/modules/indic/indic-ot.h +++ /dev/null @@ -1,238 +0,0 @@ -/* Pango - * indic-ot.h: - * - * Copyright (C) 2001, 2002 IBM Corporation. All Rights Reserved. - * Author: Eric Mader - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, and/or sell copies of the - * Software, and to permit persons to whom the Software is furnished - * to do so, provided that the above copyright notice(s) and this - * permission notice appear in all copies of the Software and that - * both the above copyright notice(s) and this permission notice - * appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR - * ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written - * authorization of the copyright holder. - */ - -#ifndef __INDIC_OT_H__ -#define __INDIC_OT_H__ - -#include -#include -#include "mprefixups.h" - -G_BEGIN_DECLS - -#ifdef PANGO_ENABLE_ENGINE - -/* Characters that get refered to by name... */ -#define C_SIGN_ZWNJ 0x200C -#define C_SIGN_ZWJ 0x200D -#define C_DOTTED_CIRCLE 0x25CC - -/* - * The characters that a split matra splits into. - * Unused characters will be zero. - */ -typedef gunichar IndicOTSplitMatra[3]; - -/* - * Character class values - */ -typedef enum -{ - CC_RESERVED, - CC_MODIFYING_MARK_ABOVE, - CC_MODIFYING_MARK_POST, - CC_INDEPENDENT_VOWEL, - CC_CONSONANT, - CC_CONSONANT_WITH_NUKTA, - CC_NUKTA, - CC_DEPENDENT_VOWEL, - CC_VIRAMA, - CC_ZERO_WIDTH_MARK, - CC_AL_LAKUNA, - CC_COUNT -} IndicOTCharClassValues; - -/* - * Character class flags - */ -#define CF_CLASS_MASK 0x0000FFFFU - -#define CF_CONSONANT 0x80000000U - -#define CF_REPH 0x40000000U -#define CF_VATTU 0x20000000U -#define CF_BELOW_BASE 0x10000000U -#define CF_POST_BASE 0x08000000U - -#define CF_MATRA_PRE 0x04000000U -#define CF_MATRA_BELOW 0x02000000U -#define CF_MATRA_ABOVE 0x01000000U -#define CF_MATRA_POST 0x00800000U -#define CF_LENGTH_MARK 0x00400000U - -#define CF_INDEX_MASK 0x000F0000U -#define CF_INDEX_SHIFT 16 - -/* - * Character class: a character class value - * ORed with character class flags. - */ -typedef glong IndicOTCharClass; - -/* - * Script flags - */ -#define SF_MATRAS_AFTER_BASE 0x80000000U -#define SF_REPH_AFTER_BELOW 0x40000000U -#define SF_EYELASH_RA 0x20000000U -#define SF_MPRE_FIXUP 0x10000000U -#define SF_PROCESS_ZWJ 0x08000000U - -#define SF_POST_BASE_LIMIT_MASK 0x0000FFFFU -#define SF_NO_POST_BASE_LIMIT 0x00007FFFU - -typedef guint32 IndicOTScriptFlags; - -/* - * Bit flags for the indic feature tags - */ -enum indic_glyph_feature_ -{ - nukt = 0x0001, - akhn = 0x0002, - rphf = 0x0004, - blwf = 0x0008, - half = 0x0010, - pstf = 0x0020, - vatu = 0x0040, - pres = 0x0080, - blws = 0x0100, - abvs = 0x0200, - psts = 0x0400, - haln = 0x0800, - blwm = 0x1000, - abvm = 0x2000, - dist = 0x4000, - junk = 0x8000, - init = 0x10000 -}; - -/* - * Complement of the feature flags that - * will be assigned to specific glyphs. - * - * The names come from the ICU implementation, - * which listed the actual tags in an order - * such that tags could be assigned using the - * address of the first one: &tags[0], &tags[1], - * &tags[2], &tags[3]. The name of each set here - * is the name of the first tag in the ICU list. - */ -enum indic_glyph_property_ -{ - rphf_p = (junk | dist | init), - blwf_p = (junk | dist | init | rphf), - half_p = (junk | dist | init | rphf | blwf), - pstf_p = (junk | dist | init | rphf | blwf | half), - nukt_p = (junk | dist | init | rphf | blwf | half | pstf) -}; - -/* - * Macros to test the charClass flags for various things. - */ -#define IS_VM_ABOVE(charClass) ((charClass & CF_CLASS_MASK) == CC_MODIFYING_MARK_ABOVE) -#define IS_VM_POST(charClass) ((charClass & CF_CLASS_MASK) == CC_MODIFYING_MARK_POST) -#define IS_CONSONANT(charClass) ((charClass & CF_CONSONANT) != 0) -#define IS_REPH(charClass) ((charClass & CF_REPH) != 0) -#define IS_NUKTA(charClass) ((charClass & CF_CLASS_MASK) == CC_NUKTA) -#define IS_VIRAMA(charClass) ((charClass & CF_CLASS_MASK) == CC_VIRAMA) -#define IS_AL_LAKUNA(charClass) ((charClass & CF_CLASS_MASK) == CC_AL_LAKUNA) -#define IS_VATTU(charClass) ((charClass & CF_VATTU) != 0) -#define IS_MATRA(charClass) ((charClass & CF_CLASS_MASK) == CC_DEPENDENT_VOWEL) -#define IS_SPLIT_MATRA(charClass) ((charClass & CF_INDEX_MASK) != 0) -#define IS_M_PRE(charClass) ((charClass & CF_MATRA_PRE) != 0) -#define IS_M_BELOW(charClass) ((charClass & CF_MATRA_BELOW) != 0) -#define IS_M_ABOVE(charClass) ((charClass & CF_MATRA_ABOVE) != 0) -#define IS_M_POST(charClass) ((charClass & CF_MATRA_POST) != 0) -#define IS_LENGTH_MARK(charClass) ((charClass & CF_LENGTH_MARK) != 0) -#define HAS_POST_OR_BELOW_BASE_FORM(charClass) ((charClass & (CF_POST_BASE | CF_BELOW_BASE)) != 0) -#define HAS_POST_BASE_FORM(charClass) ((charClass & CF_POST_BASE) != 0) -#define HAS_BELOW_BASE_FORM(charClass) ((charClass & CF_BELOW_BASE) != 0) - -struct _IndicOTClassTable -{ - gunichar firstChar; - gunichar lastChar; - glong worstCaseExpansion; - IndicOTScriptFlags scriptFlags; - - const IndicOTCharClass *charClasses; - const IndicOTSplitMatra *splitMatraTable; -}; - -typedef struct _IndicOTClassTable IndicOTClassTable; - -extern const IndicOTClassTable deva_class_table; -extern const IndicOTClassTable beng_class_table; -extern const IndicOTClassTable guru_class_table; -extern const IndicOTClassTable gujr_class_table; -extern const IndicOTClassTable orya_class_table; -extern const IndicOTClassTable taml_class_table; -extern const IndicOTClassTable telu_class_table; -extern const IndicOTClassTable knda_class_table; -extern const IndicOTClassTable mlym_class_table; -extern const IndicOTClassTable sinh_class_table; - -const IndicOTSplitMatra *indic_ot_get_split_matra(const IndicOTClassTable *class_table, IndicOTCharClass char_class); - -IndicOTCharClass indic_ot_get_char_class(const IndicOTClassTable *class_table, gunichar ch); - -gboolean indic_ot_is_vm_above(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_vm_post(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_consonant(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_reph(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_virama(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_al_lakuna(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_nukta(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_vattu(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_matra(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_split_matra(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_m_pre(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_m_below(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_m_above(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_m_post(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_is_length_mark(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_has_post_or_below_base_form(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_has_post_base_form(const IndicOTClassTable *class_table, gunichar ch); -gboolean indic_ot_has_below_base_form(const IndicOTClassTable *class_table, gunichar ch); - -glong indic_ot_find_syllable(const IndicOTClassTable *class_table, const gunichar *chars, glong prev, glong char_count); - -glong indic_ot_reorder(const gunichar *chars, const glong *utf8_offsets, glong char_count, const IndicOTClassTable *class_table, gunichar *out_chars, glong *char_indices, gulong *char_tags, MPreFixups **outMPreFixups); - -#endif /* PANGO_ENABLE_ENGINE */ - -G_END_DECLS - -#endif /* __INDIC_OT_H__ */ diff --git a/modules/indic/mprefixups.c b/modules/indic/mprefixups.c deleted file mode 100644 index a599e6d..0000000 --- a/modules/indic/mprefixups.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * mprefixups.h: Handle left matra placement - * - * Author: Sivaraj Doddannan - * Ported from IBM's ICU engine. Original copyright: - * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" -#include -#include "mprefixups.h" -#include - -struct _FixupData -{ - glong fBaseIndex; - glong fMPreIndex; -}; - -MPreFixups *indic_mprefixups_new(glong char_count) -{ - MPreFixups *mprefixups = g_new (MPreFixups, 1); - mprefixups->fFixupCount = 0; - mprefixups->fFixupData = g_new (FixupData, char_count); - - return mprefixups; -} - -void indic_mprefixups_free (MPreFixups *mprefixups) -{ - g_free (mprefixups->fFixupData); - g_free (mprefixups); -} - -void indic_mprefixups_add (MPreFixups *mprefixups, glong baseIndex, glong mpreIndex) -{ - /* NOTE: don't add the fixup data if the mpre is right - * before the base consonant glyph. - */ - if (baseIndex - mpreIndex > 1) { - mprefixups->fFixupData[mprefixups->fFixupCount].fBaseIndex = baseIndex; - mprefixups->fFixupData[mprefixups->fFixupCount].fMPreIndex = mpreIndex; - - mprefixups->fFixupCount += 1; - } -} - -void indic_mprefixups_apply(MPreFixups *mprefixups, PangoOTBuffer *buffer) -{ - glong fixup; - - for (fixup = 0; fixup < mprefixups->fFixupCount; fixup += 1) { - gulong baseIndex = mprefixups->fFixupData[fixup].fBaseIndex; - gulong mpreIndex = mprefixups->fFixupData[fixup].fMPreIndex; - glong baseGlyph = -1; - glong mpreGlyph = -1; - glong mpreLimit = -1; - glong mpreCount, moveCount, mpreDest; - glong i; - PangoOTGlyph *glyphs; - int n_glyphs; - PangoOTGlyph *mpreSave; - - /* determine post GSUB location of baseIndex and mpreIndex */ - - pango_ot_buffer_get_glyphs (buffer, &glyphs, &n_glyphs); - - for (i = 0; i < n_glyphs; i++) { - if ((baseIndex >= glyphs[i].cluster) && (baseIndex-glyphs[i].cluster) % 2 == 0) /* bug 441654 */ - baseGlyph = i; - if (glyphs[i].cluster == mpreIndex) { - if (mpreGlyph < 0) - mpreGlyph = i; - mpreLimit = i + 1; - } - } - if (baseGlyph < 0 || mpreGlyph < 0 || mpreLimit >= baseGlyph) { - continue; - } - - mpreCount = mpreLimit - mpreGlyph; - moveCount = baseGlyph - mpreLimit; - mpreDest = baseGlyph - mpreCount; - - mpreSave = g_new (PangoOTGlyph, mpreCount); - - for (i = 0; i < mpreCount; i += 1) { - mpreSave[i] = glyphs[mpreGlyph + i]; - } - - for (i = 0; i < moveCount; i += 1) { - glyphs[mpreGlyph + i] = glyphs[mpreLimit + i]; - } - - for (i = 0; i < mpreCount; i += 1) { - glyphs[mpreDest + i] = mpreSave[i]; - } - - g_free(mpreSave); - } -} diff --git a/modules/indic/mprefixups.h b/modules/indic/mprefixups.h deleted file mode 100644 index 22336db..0000000 --- a/modules/indic/mprefixups.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * mprefixups.c: Handle left matra placement - * - * Author: Sivaraj Doddannan - * Ported from IBM's ICU engine. Original copyright: - * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __MPREFIXUPS_H -#define __MPREFIXUPS_H - -#include -#include -#include - -G_BEGIN_DECLS - -typedef struct _FixupData FixupData; - -struct _MPreFixups { - glong fFixupCount; - FixupData *fFixupData; -}; - -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, PangoOTBuffer *buffer); - - -G_END_DECLS - -#endif -