コード例 #1
0
        public void LoadFontMetadata_WithWoff2Format()
        {
            var description = FontDescription.LoadDescription(TestFonts.OpensSansWoff2Data());

            Assert.Equal("Open Sans Regular", description.FontNameInvariantCulture);
            Assert.Equal("Regular", description.FontSubFamilyNameInvariantCulture);
        }
コード例 #2
0
        public void GlyphsCount_WithWoff2Format_EqualsTtf()
        {
            var        fontReaderWoff = new FontReader(TestFonts.OpensSansWoff2Data());
            GlyphTable glyphsWoff     = fontReaderWoff.GetTable <GlyphTable>();
            var        fontReaderTtf  = new FontReader(TestFonts.OpenSansTtfData());
            GlyphTable glyphsTtf      = fontReaderTtf.GetTable <GlyphTable>();

            Assert.Equal(glyphsTtf.GlyphCount, glyphsWoff.GlyphCount);
        }
コード例 #3
0
        public void ReadFont_WithWoff2Format_EqualsTtf()
        {
            var fontReaderTtf  = new FontReader(TestFonts.OpenSansTtfData());
            var fontReaderWoff = new FontReader(TestFonts.OpensSansWoff2Data());

            Assert.Equal(fontReaderTtf.Headers.Count, fontReaderWoff.Headers.Count);
            foreach (string key in fontReaderTtf.Headers.Keys)
            {
                Assert.True(fontReaderWoff.Headers.ContainsKey(key));
            }
        }
コード例 #4
0
        public void LoadFont_WithWoff2Format()
        {
            Font font = new FontCollection().Add(TestFonts.OpensSansWoff2Data()).CreateFont(12);

            GlyphMetrics glyph = font.FontMetrics.GetGlyphMetrics(new CodePoint('A'), ColorFontSupport.None).First();
            var          r     = new GlyphRenderer();

            glyph.RenderTo(r, font.Size, System.Numerics.Vector2.Zero, new TextOptions(font));

            Assert.Equal(37, r.ControlPoints.Count);
            Assert.Single(r.GlyphKeys);
            Assert.Single(r.GlyphRects);
        }