3

I'm using Win2D.UWP to get the System font set. I need to filter the queried fonts and group them in categories like "Serif", "Sans-Serif", "Decorative", etc. (Like Adobe apps or Corel Font Manager). As far as I've researched that information can be accessed through Microsoft.Graphics.Canvas.Text.CanvasFontSet.GetPropertyValues with parameter CanvasFontPropertyIdentifier.SemanticTag but that doesn't return any value in any of my installed fonts.

Is there another way to know that info? Please, anything can be helpful.

Thanks in advance

Leisvan
  • 105
  • 1
  • 7

1 Answers1

0

This is an old question but for anyone who comes later with the exact same question, there is a good news.

Now the Win2D.uwp has improved so we can achieve it with the following codes.

var availableFonts = CanvasFontSet.GetSystemFontSet().Fonts;

foreach (var font in availableFonts)
{
    var familyNames = new List<string>();

    foreach (var familyName in font.FamilyNames) 
    {
        familyNames.Add(familyName.Value);
    }

    Debug.WriteLine(string.Join(", ", familyNames.Distinct()));
}
Chun Lin
  • 534
  • 14
  • 34