Exemple #1
0
        public void ShouldGetName()
        {
            var font = TrueTypeFont.FromFile(@"C:\Windows\Fonts\arial.ttf");

            var name = NameHelper.GetName(NameId.FontSubfamilyName, new CultureInfo("nl-NL"), font);

            Assert.Equal("Standaard", name);
        }
Exemple #2
0
        public void ShouldGetGlyph()
        {
            var font = TrueTypeFont.FromFile(@"C:\Windows\Fonts\arial.ttf");

            var glyphIndex = GlyphHelper.GetGlyphIndex('A', font);

            Assert.NotEqual((uint)0, glyphIndex);
        }
Exemple #3
0
        public void ShouldGetKerning()
        {
            var font = TrueTypeFont.FromFile(@"C:\Windows\Fonts\arial.ttf");

            var horizontalKerning = KerningHelper.GetHorizontalKerning('A', 'W', font);

            Assert.True(horizontalKerning < 0);

            horizontalKerning = KerningHelper.GetHorizontalKerning('T', 'T', font);
            Assert.Equal(0, horizontalKerning);
        }
Exemple #4
0
        public void ShouldParseWindowsFonts()
        {
            var fonts = new List <TrueTypeFont>();

            foreach (var file in Directory.EnumerateFiles(@"C:\Windows\Fonts"))
            {
                if (file.EndsWith(".ttf"))
                {
                    var font = TrueTypeFont.FromFile(file);
                    fonts.Add(font);
                    if (font.KernTable.SubtableCount > 0)
                    {
                    }
                }
            }

            Assert.NotEmpty(fonts);
        }