Can anyone tell me how I can get lists of all installed fonts in c# uwp? I just want to put those fonts in combo box. So, I just need a list that has all the installed fonts of the PC.
I also tried to use Win2D but it gave me null output. My code:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var fonts = Microsoft.Graphics.Canvas.Text.CanvasTextFormat.GetSystemFontFamilies();
BaseExample.ItemsSource = fonts;
}
You will need to install the Win2D Nuget package.
Then you can call the CanvasTextFormat.GetSystemFontFamilies method to return a list of the installed fonts.
I have already tried it but it just gave me null output.
Well, at this point, you're going to have to add the code you tried to your question.
I edited my question
The return value for that method is a
string[]
. Is yourfonts
variable actuallynull
, or is it a zero-length array?When I try this I get this exception: