public bool Read(Stream stream, int directoryCount) { int bytesRead = 0; this.NumTables = WoffBuffer.Read255UInt16(stream); if (this.NumTables == 0) { return(false); } this.Flavor = WoffBuffer.ReadUInt32BE(WoffBuffer.ReadBytes(stream, WoffBuffer.SizeOfUInt, out bytesRead), 0); this.TableIndices = new ushort[this.NumTables]; for (ushort i = 0; i < this.NumTables; i++) { this.TableIndices[i] = WoffBuffer.Read255UInt16(stream); if (this.TableIndices[i] >= directoryCount) { Trace.TraceError("Invalid collection font entry: " + this.TableIndices[i]); return(false); } } return(true); }
public bool Read(Stream stream) { int bytesRead = 0; this.Version = WoffBuffer.ReadUInt32BE(WoffBuffer.ReadBytes(stream, WoffBuffer.SizeOfUInt, out bytesRead), 0); this.NumFonts = WoffBuffer.Read255UInt16(stream); if (this.Version == 0x00010000 || this.Version == 0x00020000) { TtcTag = WoffUtils.TtcSignature; this.MajorVersion = (ushort)(this.Version == 0x00010000 ? 1 : 2); return(true); } return(false); }