public static IList <IList <GposAnchor[]> > ReadLigatureArray(OpenTypeFontTableReader tableReader, int classCount , int location) { IList <IList <GposAnchor[]> > ligatureArray = new List <IList <GposAnchor[]> >(); tableReader.rf.Seek(location); int ligatureCount = tableReader.rf.ReadUnsignedShort(); int[] ligatureAttachLocations = ReadUShortArray(tableReader.rf, ligatureCount, location); for (int liga = 0; liga < ligatureCount; ++liga) { int ligatureAttachLocation = ligatureAttachLocations[liga]; IList <GposAnchor[]> ligatureAttach = new List <GposAnchor[]>(); tableReader.rf.Seek(ligatureAttachLocation); int componentCount = tableReader.rf.ReadUnsignedShort(); int[] componentRecordsLocation = ReadUShortArray(tableReader.rf, classCount * componentCount, ligatureAttachLocation ); int idx = 0; for (int k = 0; k < componentCount; ++k) { ligatureAttach.Add(ReadAnchorArray(tableReader, componentRecordsLocation, idx, idx + classCount)); idx += classCount; } ligatureArray.Add(ligatureAttach); } return(ligatureArray); }
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; }
/// <exception cref="System.IO.IOException"/> protected internal GsubLookupType5(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations ) : base(openReader, lookupFlag, subTableLocations) { subTables = new List <ContextualSubTable>(); ReadSubTables(); }
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 static GposAnchor[] ReadAnchorArray(OpenTypeFontTableReader tableReader, int[] locations, int left, int right) { GposAnchor[] anchors = new GposAnchor[right - left]; for (int i = left; i < right; i++) { anchors[i - left] = ReadGposAnchor(tableReader, locations[i]); } return(anchors); }
public OpenTypeScript(OpenTypeFontTableReader openTypeReader, int locationScriptTable) { this.openTypeReader = openTypeReader; records = new List <ScriptRecord>(); openTypeReader.rf.Seek(locationScriptTable); TagAndLocation[] tagsLocs = openTypeReader.ReadTagAndLocations(locationScriptTable); foreach (TagAndLocation tagLoc in tagsLocs) { ReadScriptRecord(tagLoc); } }
public OpenTypeFeature(OpenTypeFontTableReader openTypeReader, int locationFeatureTable) { this.openTypeReader = openTypeReader; records = new List <FeatureRecord>(); openTypeReader.rf.Seek(locationFeatureTable); TagAndLocation[] tagsLocs = openTypeReader.ReadTagAndLocations(locationFeatureTable); foreach (TagAndLocation tagLoc in tagsLocs) { // +2 don't use FeatureParams openTypeReader.rf.Seek(tagLoc.location + 2L); int lookupCount = openTypeReader.rf.ReadUnsignedShort(); FeatureRecord rec = new FeatureRecord(); rec.tag = tagLoc.tag; rec.lookups = openTypeReader.ReadUShortArray(lookupCount); records.Add(rec); } }
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; }
public static IList <GposAnchor[]> ReadBaseArray(OpenTypeFontTableReader tableReader, int classCount, int location ) { IList <GposAnchor[]> baseArray = new List <GposAnchor[]>(); tableReader.rf.Seek(location); int baseCount = tableReader.rf.ReadUnsignedShort(); int[] anchorLocations = ReadUShortArray(tableReader.rf, baseCount * classCount, location); int idx = 0; for (int k = 0; k < baseCount; ++k) { baseArray.Add(ReadAnchorArray(tableReader, anchorLocations, idx, idx + classCount)); idx += classCount; } return(baseArray); }
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 static GposAnchor ReadGposAnchor(OpenTypeFontTableReader tableReader, int location) { if (location == 0) { return(null); } tableReader.rf.Seek(location); int format = tableReader.rf.ReadUnsignedShort(); GposAnchor t = null; switch (format) { default: { t = new GposAnchor(); t.XCoordinate = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); t.YCoordinate = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); break; } } return(t); }
public static GposValueRecord ReadGposValueRecord(OpenTypeFontTableReader tableReader, int mask) { GposValueRecord vr = new GposValueRecord(); if ((mask & 0x0001) != 0) { vr.XPlacement = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); } if ((mask & 0x0002) != 0) { vr.YPlacement = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); } if ((mask & 0x0004) != 0) { vr.XAdvance = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); } if ((mask & 0x0008) != 0) { vr.YAdvance = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm(); } if ((mask & 0x0010) != 0) { tableReader.rf.Skip(2); } if ((mask & 0x0020) != 0) { tableReader.rf.Skip(2); } if ((mask & 0x0040) != 0) { tableReader.rf.Skip(2); } if ((mask & 0x0080) != 0) { tableReader.rf.Skip(2); } return(vr); }
public static IList <OtfMarkRecord> ReadMarkArray(OpenTypeFontTableReader tableReader, int location) { tableReader.rf.Seek(location); int markCount = tableReader.rf.ReadUnsignedShort(); int[] classes = new int[markCount]; int[] locations = new int[markCount]; for (int k = 0; k < markCount; ++k) { classes[k] = tableReader.rf.ReadUnsignedShort(); int offset = tableReader.rf.ReadUnsignedShort(); locations[k] = location + offset; } IList <OtfMarkRecord> marks = new List <OtfMarkRecord>(); for (int k = 0; k < markCount; ++k) { OtfMarkRecord rec = new OtfMarkRecord(); rec.markClass = classes[k]; rec.anchor = ReadGposAnchor(tableReader, locations[k]); marks.Add(rec); } return(marks); }
/// <exception cref="System.IO.IOException"/> public GposLookupType2(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { ReadSubTables(); }
public GposLookupType7(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { subTables = new List <ContextualPositionTable>(); ReadSubTables(); }
/// <exception cref="System.IO.IOException"/> public PairPosAdjustmentFormat2(OpenTypeFontTableReader openReader, int lookupFlag, int subtableLocation) : base(openReader, lookupFlag, null) { ReadFormat(subtableLocation); }
/// <exception cref="System.IO.IOException"/> public GsubLookupType3(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { substMap = new Dictionary <int, int[]>(); ReadSubTables(); }
/// <exception cref="System.IO.IOException"/> public GposLookupType5(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { marksligatures = new List <GposLookupType5.MarkToLigature>(); ReadSubTables(); }
/// <exception cref="System.IO.IOException"/> public GposLookupType4(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { marksbases = new List <GposLookupType4.MarkToBase>(); ReadSubTables(); }
public GsubLookupType4(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { ligatures = new Dictionary <int, IList <int[]> >(); ReadSubTables(); }
public GsubLookupType1(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations) : base(openReader, lookupFlag, subTableLocations) { substMap = new IntHashtable(); ReadSubTables(); }
protected internal ContextualSubTable(OpenTypeFontTableReader openReader, int lookupFlag) { this.openReader = openReader; this.lookupFlag = lookupFlag; }
/// <exception cref="System.IO.IOException"/> protected internal GsubLookupType6(OpenTypeFontTableReader openReader, int lookupFlag, int[] subTableLocations ) : base(openReader, lookupFlag, subTableLocations) { }