示例#1
0
        public void ShouldReturnNullWhenTableCouldNotBeFound()
        {
            var writer = new BinaryWriter();

            writer.WriteTrueTypeFileHeader();

            using (System.IO.MemoryStream stream = writer.GetStream())
            {
                Assert.Null(ColrTable.Load(new FontReader(stream)));
            }
        }
示例#2
0
        public void ShouldReturnTableValues()
        {
            var writer = new BigEndianBinaryWriter();

            writer.WriteTrueTypeFileHeader();
            writer.WriteColrTable(new[]
            {
                new ColrGlyphRecord
                {
                    Glyph  = 1,
                    Layers =
                    {
                        new ColrLayerRecord {
                            Glyph = 10, Pallete = 1
                        },
                        new ColrLayerRecord {
                            Glyph = 11, Pallete = 2
                        }
                    }
                },
                new ColrGlyphRecord
                {
                    Glyph  = 2,
                    Layers =
                    {
                        new ColrLayerRecord {
                            Glyph = 12, Pallete = 1
                        },
                        new ColrLayerRecord {
                            Glyph = 13, Pallete = 2
                        }
                    }
                }
            });

            using (System.IO.Stream stream = TestFonts.TwemojiMozillaData())
            {
                var       reader = new FontReader(stream);
                ColrTable tbl    = reader.GetTable <ColrTable>();

                System.Span <Fonts.Tables.General.Colr.LayerRecord> layers = tbl.GetLayers(15);
                Assert.Equal(2, layers.Length);
            }
        }