コード例 #1
0
        /// <summary>
        /// Deserializes this structure from binary data.
        /// </summary>
        /// <param name="reader">The <see cref="BinaryReader"/> to read the data from.</param>
        /// <param name="font">Tiny Font containing this appendix.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public override void ReadFrom(BinaryReader reader, TinyFont font)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            _coverageCount      = reader.ReadUInt16();
            _coverageGlyphCount = reader.ReadUInt16();

            _coverages.Clear();
            _coverages.Capacity = _coverageCount;

            for (int i = 0; i < _coverageCount; i++)
            {
                Coverage coverage = new Coverage();
                coverage.ReadFrom(reader);

                _coverages.Add(coverage);
            }

            _coverageGlyphs.Clear();
            _coverageGlyphs.Capacity = _coverageGlyphCount;

            for (int i = 0; i < _coverageGlyphCount; i++)
            {
                CoverageGlyphs.Add(reader.ReadInt32());
            }

            //if (_coverageGlyphCount % 2 == 1)
            //    reader.ReadUInt16();
        }