void Layout(GlyphIndexList glyphs) { if (_needPlanUpdate) { UpdateLayoutPlan(); } //[C] //---------------------------------------------- //glyph substitution if (_gsub != null && glyphs.Count > 0) { //TODO: review perf here _gsub.EnableLigation = this.EnableLigature; _gsub.EnableComposition = this.EnableComposition; _gsub.DoSubstitution(glyphs); } //---------------------------------------------- //after glyph substitution, //number of input glyph MAY changed (increase or decrease).*** //so count again. int finalGlyphCount = glyphs.Count; //---------------------------------------------- //[D] //glyph position _glyphPositions.Clear(); _glyphPositions.Typeface = _typeface; for (int i = 0; i < finalGlyphCount; ++i) { //at this stage _inputGlyphs and _glyphPositions //has member 1:1 ushort glyIndex, input_codepointOffset, input_mapLen; glyphs.GetGlyphIndexAndMap(i, out glyIndex, out input_codepointOffset, out input_mapLen); // Glyph orgGlyph = _typeface.GetGlyphByIndex(glyIndex); //this is original value WITHOUT fit-to-grid adjust _glyphPositions.AddGlyph(input_codepointOffset, glyIndex, orgGlyph); } PositionTechnique posTech = this.PositionTechnique; if (_gpos != null && glyphs.Count > 1 && posTech == PositionTechnique.OpenFont) { _gpos.DoGlyphPosition(_glyphPositions); } //---------------------------------------------- //at this point, all positions are layouted at its original scale *** //then we will scale it to target scale later //---------------------------------------------- }