public void LoadFormat0()
        {
            var writer = new BigEndianBinaryWriter();

            // int subtableCount = 1;
            writer.WriteCMapSubTable(
                new Format0SubTable(
                    0,
                    PlatformIDs.Windows,
                    2,
                    new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            BigEndianBinaryReader reader = writer.GetReader();
            ushort format = reader.ReadUInt16(); // read format before we pass along as that's what the cmap table does

            Assert.Equal(0, format);

            Format0SubTable table = Format0SubTable.Load(
                new[] { new EncodingRecord(PlatformIDs.Windows, 2, 0) },
                reader).Single();

            Assert.Equal(0, table.Language);
            Assert.Equal(PlatformIDs.Windows, table.Platform);
            Assert.Equal(2, table.Encoding);
            Assert.Equal(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, table.GlyphIds);
        }
        public void LoadFormat4()
        {
            var writer = new BigEndianBinaryWriter();

            // int subtableCount = 1;
            writer.WriteCMapSubTable(
                new Format4SubTable(
                    0,
                    PlatformIDs.Windows,
                    2,
                    new[] { new Format4SubTable.Segment(0, 1, 2, 3, 4) },
                    new ushort[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            BigEndianBinaryReader reader = writer.GetReader();
            ushort format = reader.ReadUInt16(); // read format before we pass along as that's what the cmap table does

            Assert.Equal(4, format);

            Format4SubTable table = Format4SubTable.Load(
                new[] { new EncodingRecord(PlatformIDs.Windows, 2, 0) },
                reader).Single();

            Assert.Equal(0, table.Language);
            Assert.Equal(PlatformIDs.Windows, table.Platform);
            Assert.Equal(2, table.Encoding);
            Assert.Equal(new ushort[] { 1, 2, 3, 4, 5, 6, 7, 8 }, table.GlyphIds);

            Assert.Single(table.Segments);
            Format4SubTable.Segment seg = table.Segments[0];
            Assert.Equal(0, seg.Index);
            Assert.Equal(1, seg.End);
            Assert.Equal(2, seg.Start);
            Assert.Equal(3, seg.Delta);
            Assert.Equal(4, seg.Offset);
        }