void UpdateLayoutPlan() { GlyphLayoutPlanContext context = _layoutPlanCollection.GetPlanOrCreate(this._typeface, this._scriptLang); this._gpos = context._glyphPos; this._gsub = context._glyphSub; _needPlanUpdate = false; }
/// <summary> /// get glyph layout plan or create if not exists /// </summary> /// <param name="typeface"></param> /// <param name="scriptLang"></param> /// <returns></returns> public GlyphLayoutPlanContext GetPlanOrCreate(Typeface typeface, ScriptLang scriptLang) { GlyphLayoutPlanKey key = new GlyphLayoutPlanKey(typeface, scriptLang.internalName); if (!_collection.TryGetValue(key, out GlyphLayoutPlanContext context)) { var glyphSubstitution = (typeface.GSUBTable != null) ? new GlyphSubstitution(typeface, scriptLang.shortname) : null; var glyphPosition = (typeface.GPOSTable != null) ? new GlyphSetPosition(typeface, scriptLang.shortname) : null; _collection.Add(key, context = new GlyphLayoutPlanContext(glyphSubstitution, glyphPosition)); } return(context); }