public virtual void SubstituteOneToMany(OpenTypeFontTableReader tableReader, int[] substGlyphIds) { //sequence length shall be at least 1 int substCode = substGlyphIds[0]; Glyph oldGlyph = glyphs[idx]; Glyph glyph = tableReader.GetGlyph(substCode); glyphs[idx] = glyph; if (substGlyphIds.Length > 1) { IList <Glyph> additionalGlyphs = new List <Glyph>(substGlyphIds.Length - 1); for (int i = 1; i < substGlyphIds.Length; ++i) { substCode = substGlyphIds[i]; glyph = tableReader.GetGlyph(substCode); additionalGlyphs.Add(glyph); } AddAllGlyphs(idx + 1, additionalGlyphs); if (null != actualText) { if (null == actualText[idx]) { actualText[idx] = new GlyphLine.ActualText(oldGlyph.GetUnicodeString()); } for (int i = 0; i < additionalGlyphs.Count; i++) { this.actualText[idx + 1 + i] = actualText[idx]; } } idx += substGlyphIds.Length - 1; end += substGlyphIds.Length - 1; } }
public virtual void SubstituteOneToOne(OpenTypeFontTableReader tableReader, int substitutionGlyphIndex) { Glyph oldGlyph = glyphs[idx]; Glyph newGlyph = tableReader.GetGlyph(substitutionGlyphIndex); if (oldGlyph.GetChars() != null) { newGlyph.SetChars(oldGlyph.GetChars()); } else { if (newGlyph.HasValidUnicode()) { newGlyph.SetChars(iText.IO.Util.TextUtil.ConvertFromUtf32(newGlyph.GetUnicode())); } else { if (oldGlyph.HasValidUnicode()) { newGlyph.SetChars(iText.IO.Util.TextUtil.ConvertFromUtf32(oldGlyph.GetUnicode())); } } } glyphs[idx] = newGlyph; }
public virtual void SubstituteOneToMany(OpenTypeFontTableReader tableReader, int[] substGlyphIds) { int substCode = substGlyphIds[0]; //sequence length shall be at least 1 Glyph glyph = tableReader.GetGlyph(substCode); glyphs[idx] = glyph; if (substGlyphIds.Length > 1) { IList <Glyph> additionalGlyphs = new List <Glyph>(substGlyphIds.Length - 1); for (int i = 1; i < substGlyphIds.Length; ++i) { substCode = substGlyphIds[i]; glyph = tableReader.GetGlyph(substCode); additionalGlyphs.Add(glyph); } AddAllGlyphs(idx + 1, additionalGlyphs); idx += substGlyphIds.Length - 1; end += substGlyphIds.Length - 1; } }
public virtual void SubstituteManyToOne(OpenTypeFontTableReader tableReader, int lookupFlag, int rightPartLen , int substitutionGlyphIndex) { OpenTableLookup.GlyphIndexer gidx = new OpenTableLookup.GlyphIndexer(); gidx.line = this; gidx.idx = idx; StringBuilder chars = new StringBuilder(); Glyph currentGlyph = glyphs[idx]; if (currentGlyph.GetChars() != null) { chars.Append(currentGlyph.GetChars()); } else { if (currentGlyph.HasValidUnicode()) { chars.Append(iText.IO.Util.TextUtil.ConvertFromUtf32(currentGlyph.GetUnicode())); } } for (int j = 0; j < rightPartLen; ++j) { gidx.NextGlyph(tableReader, lookupFlag); currentGlyph = glyphs[gidx.idx]; if (currentGlyph.GetChars() != null) { chars.Append(currentGlyph.GetChars()); } else { if (currentGlyph.HasValidUnicode()) { chars.Append(iText.IO.Util.TextUtil.ConvertFromUtf32(currentGlyph.GetUnicode())); } } RemoveGlyph(gidx.idx--); } char[] newChars = new char[chars.Length]; chars.GetChars(0, chars.Length, newChars, 0); Glyph newGlyph = tableReader.GetGlyph(substitutionGlyphIndex); newGlyph.SetChars(newChars); glyphs[idx] = newGlyph; end -= rightPartLen; }