Ejemplo n.º 1
0
        public void HeadCalculatedChecksumsTest()
        {
            OTFile f   = TestFonts.GetOTFile_AndikaRegular();
            uint?  idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));

            Assert.IsTrue(idx.HasValue);
            OTTable table;
            bool    result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);

            Assert.IsTrue(result);
            TableHead head = (TableHead)table;

            Assert.AreEqual(head.CalculatedChecksum, head.TableRecordChecksum);
            Assert.AreEqual(head.CalculatedCheckSumAdjustment, head.CheckSumAdjustment);

            f   = TestFonts.GetOTFile_CharisSILBold();
            idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));
            Assert.IsTrue(idx.HasValue);
            table  = null;
            result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);
            Assert.IsTrue(result);
            head = (TableHead)table;
            Assert.AreEqual(head.CalculatedChecksum, head.TableRecordChecksum);
            Assert.AreEqual(head.CalculatedCheckSumAdjustment, head.CheckSumAdjustment);

            f   = TestFonts.GetOTFile_CharisSILBoldItalic();
            idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));
            Assert.IsTrue(idx.HasValue);
            table  = null;
            result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);
            Assert.IsTrue(result);
            head = (TableHead)table;
            Assert.AreEqual(head.CalculatedChecksum, head.TableRecordChecksum);
            Assert.AreEqual(head.CalculatedCheckSumAdjustment, head.CheckSumAdjustment);

            f   = TestFonts.GetOTFile_NotoNastaliqUrduRegular();
            idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));
            Assert.IsTrue(idx.HasValue);
            table  = null;
            result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);
            Assert.IsTrue(result);
            head = (TableHead)table;
            Assert.AreEqual(head.CalculatedChecksum, head.TableRecordChecksum);
            Assert.AreEqual(head.CalculatedCheckSumAdjustment, head.CheckSumAdjustment);

            f   = TestFonts.GetOTFile_SelawikRegular();
            idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));
            Assert.IsTrue(idx.HasValue);
            table  = null;
            result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);
            Assert.IsTrue(result);
            head = (TableHead)table;
            Assert.AreEqual(head.CalculatedChecksum, head.TableRecordChecksum);
            Assert.AreEqual(head.CalculatedCheckSumAdjustment, head.CheckSumAdjustment);
        }
Ejemplo n.º 2
0
        public void HeadTableTest()
        {
            // Table constructor for 'head' will get the offset table record, calculate the table checksum
            // and then read the remainder of the table.

            OTFile f   = TestFonts.GetOTFile_SelawikRegular();
            uint?  idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));

            Assert.IsTrue(idx.HasValue);
            OTTable table;
            bool    result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);

            Assert.IsTrue(result);
            VerifySelawikRegularHead((TableHead)(table));

            f   = TestFonts.GetOTFile_CharisSILBoldItalic();
            idx = f.GetFont(0).OffsetTable.GetTableRecordIndex((OTTag)("head"));
            Assert.IsTrue(idx.HasValue);
            table  = null;
            result = f.GetFont(0).TryGetTable((OTTag)("head"), out table);
            Assert.IsTrue(result);
            VerifyCharisSILBoldItalicHead((TableHead)(table));
        }