From: handa Date: Mon, 26 Jul 2004 07:55:29 +0000 (+0000) Subject: (lookup_gpos): Don't apply a GPOS feature twice. X-Git-Tag: REL-0-9-1~33 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1bf802a65e9ccb3b46c94a5635e45e2d64e472a4;p=m17n%2Flibotf.git (lookup_gpos): Don't apply a GPOS feature twice. (OTF_drive_gpos): Initialize values positioning_type memeber. (OTF_drive_gsub): Fix previous change. --- diff --git a/src/otfdrive.c b/src/otfdrive.c index df64f80..b522d75 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -132,22 +132,34 @@ get_langsys (OTF_ScriptList *script_list, char *script, char *language) OTF_Tag script_tag = OTF_tag (script); OTF_Tag langsys_tag = OTF_tag (language); int i, j; + OTF_Tag dflt_tag = OTF_tag ("DFLT"); + OTF_Script *dflt = NULL; for (i = 0; i < script_list->ScriptCount; i++) - if (! script_tag - || script_list->Script[i].ScriptTag == script_tag) - { - OTF_Script *script = script_list->Script + i; - - if (! langsys_tag) - return &script->DefaultLangSys; - for (j = 0; j < script->LangSysCount; j++) - if (script->LangSysRecord[j].LangSysTag == langsys_tag) - return script->LangSys + j; - return &script->DefaultLangSys; - } + { + OTF_Script *script = script_list->Script + i; + + if (script_list->Script[i].ScriptTag == dflt_tag) + dflt = script; + if (script_list->Script[i].ScriptTag == script_tag) + { + if (! langsys_tag) + return &script->DefaultLangSys; + for (j = 0; j < script->LangSysCount; j++) + if (script->LangSysRecord[j].LangSysTag == langsys_tag) + return script->LangSys + j; + return &script->DefaultLangSys; + } + } - return NULL; + if (! dflt) + dflt = script_list->Script; + if (! langsys_tag) + return &dflt->DefaultLangSys; + for (j = 0; j < dflt->LangSysCount; j++) + if (dflt->LangSysRecord[j].LangSysTag == langsys_tag) + return dflt->LangSys + j; + return &dflt->DefaultLangSys; } static int @@ -1148,6 +1160,9 @@ OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring, int *lookup_indices; int i, n; + for (i = 0; i < gstring->used; i++) + gstring->glyphs[i].f.index.from = gstring->glyphs[i].f.index.to = i; + if (! otf->gsub && OTF_get_table (otf, "GSUB") < 0) return errret; @@ -1171,9 +1186,6 @@ OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring, if (n < 0) return errret; - for (i = 0; i < gstring->used; i++) - gstring->glyphs[i].f.index.from = gstring->glyphs[i].f.index.to = i; - for (i = 0; i < n; i++) { int index = lookup_indices[i];