public unsafe void EnumFont_Arial() { using (var context = GdiMethods.GetDeviceContext(WindowMethods.GetDesktopWindow())) { var info = GdiMethods.EnumerateFontFamilies(context, CharacterSet.ANSI_CHARSET, "Arial"); info.Count().Should().Be(4); var regular = info.First(); regular.FontAttributes.elfEnumLogfontEx.elfFullName.CreateString().Should().Be("Arial"); regular.FontAttributes.elfEnumLogfontEx.elfStyle.CreateString().Should().Be("Regular"); regular.FontAttributes.elfEnumLogfontEx.elfScript.CreateString().Should().Be("Western"); regular.TextMetrics.ntmTm.ntmFlags.Should().Be(TextMetricFlags.NTM_REGULAR | TextMetricFlags.NTM_TT_OPENTYPE | TextMetricFlags.NTM_DSIG); regular.TextMetrics.ntmTm.tmPitchAndFamily.PitchTypes.Should().Be(FontPitchTypes.VariablePitch | FontPitchTypes.TrueType | FontPitchTypes.Vector); regular.TextMetrics.ntmTm.tmPitchAndFamily.Family.Should().Be(FontFamily.Swiss); regular.TextMetrics.ntmFontSig.UnicodeSubsetsOne.Should().Be( UnicodeSubsetsOne.BasicLatin | UnicodeSubsetsOne.Latin1Supplement | UnicodeSubsetsOne.LatinExtendedA | UnicodeSubsetsOne.LatinExtendedB | UnicodeSubsetsOne.IPAPhoneticExtensions | UnicodeSubsetsOne.SpacingToneModifier | UnicodeSubsetsOne.CombiningDiacriticalMarks | UnicodeSubsetsOne.GreekAndCoptic | UnicodeSubsetsOne.Cyrillic | UnicodeSubsetsOne.Armenian | UnicodeSubsetsOne.Hebrew | UnicodeSubsetsOne.Arabic | UnicodeSubsetsOne.LatinExtendedAdditionalCD | UnicodeSubsetsOne.GreekExtended | UnicodeSubsetsOne.Punctuation); regular.TextMetrics.ntmFontSig.UnicodeSubsetsFour.Should().Be((UnicodeSubsetsFour)0); regular.TextMetrics.ntmFontSig.CodePagesOem.Should().Be(CodePagesOem.ModernGreek | CodePagesOem.Russian | CodePagesOem.Nordic | CodePagesOem.Arabic | CodePagesOem.CanadianFrench | CodePagesOem.Hebrew | CodePagesOem.Icelandic | CodePagesOem.Portugese | CodePagesOem.Turkish | CodePagesOem.Cyrillic | CodePagesOem.Latin2 | CodePagesOem.Baltic | CodePagesOem.Greek | CodePagesOem.ArabicAsmo | CodePagesOem.MuiltilingualLatin | CodePagesOem.US); } }
public void EnumFont_All() { // Just making sure we don't fall over using (var context = GdiMethods.GetDeviceContext(WindowMethods.GetDesktopWindow())) { GdiMethods.EnumerateFontFamilies(context, CharacterSet.DEFAULT_CHARSET, null).Should().NotBeEmpty(); } }