public static XElement ToXml(KerningRecord record) { return(new XElement("WideKerning", new XAttribute("a", record.LeftCode), new XAttribute("b", record.RightCode), new XAttribute("adjustment", record.Adjustment))); }
public static KerningRecord ReadKerningRecord(this ISwfStreamReader reader, bool wideCodes) { var res = new KerningRecord { LeftCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(), RightCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(), Adjustment = reader.ReadSInt16() }; return res; }
public static KerningRecord ReadKerningRecord(this ISwfStreamReader reader, bool wideCodes) { var res = new KerningRecord { LeftCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(), RightCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(), Adjustment = reader.ReadSInt16() }; return(res); }
public static void WriteKerningRecord(this ISwfStreamWriter writer, KerningRecord record, bool wideCodes) { if (wideCodes) { writer.WriteUInt16(record.LeftCode); writer.WriteUInt16(record.RightCode); } else { writer.WriteByte((byte)record.LeftCode); writer.WriteByte((byte)record.RightCode); } writer.WriteSInt16(record.Adjustment); }
/// <summary> /// Parses the layout of this tag. /// </summary> /// <param name="input">The input stream where to read from.</param> protected virtual void ParseLayout(Stream input) { BinaryReader br = new BinaryReader(input); if (this._fontFlagsHasLayout) { this._fontAscent = br.ReadInt16(); this._fontDescent = br.ReadInt16(); this._fontLeading = br.ReadInt16(); this._fontAdvanceTable = new Int16[this._numberOfGlyphs]; for (int i = 0; i < this._numberOfGlyphs; i++) { this._fontAdvanceTable[i] = br.ReadInt16(); } this._fontBoundsTable = new Rect[this._numberOfGlyphs]; for (int i = 0; i < this._numberOfGlyphs; i++) { Rect r = new Rect(this._SwfVersion); r.Parse(this._dataStream); this._fontBoundsTable[i] = r; } this._kerningCount = br.ReadUInt16(); this._fontKerningTable = new KerningRecord[this._kerningCount]; for (int i = 0; i < this._kerningCount; i++) { KerningRecord r = new KerningRecord(this._SwfVersion); r.Parse(this._dataStream, this._fontFlagsWideCodes); this._fontKerningTable[i] = r; } } }