public void GetName_LanguageCode_ReturnsExpected(int languageCode, string expectedName) { using (var fontCollection = new PrivateFontCollection()) { fontCollection.AddFontFile(Helpers.GetTestFontPath("CodeNewRoman.ttf")); using (var fontFamily = new FontFamily("Code New Roman", fontCollection)) { Assert.Equal(expectedName, fontFamily.GetName(languageCode)); } } }
public void Ctor_Name_FontCollection() { using (var fontCollection = new PrivateFontCollection()) { fontCollection.AddFontFile(Helpers.GetTestFontPath("CodeNewRoman.otf")); using (var fontFamily = new FontFamily("Code New Roman", fontCollection)) { Assert.Equal("Code New Roman", fontFamily.Name); } } }
public void FontFamilyProperties_CustomFont_ReturnsExpected(FontStyle style) { using (var fontCollection = new PrivateFontCollection()) { fontCollection.AddFontFile(Helpers.GetTestFontPath("CodeNewRoman.otf")); using (var fontFamily = new FontFamily("Code New Roman", fontCollection)) { Assert.True(fontFamily.IsStyleAvailable(style)); Assert.Equal(1884, fontFamily.GetCellAscent(style)); Assert.Equal(514, fontFamily.GetCellDescent(style)); Assert.Equal(2048, fontFamily.GetEmHeight(style)); Assert.Equal(2398, fontFamily.GetLineSpacing(style)); } } }