List of installed font names in the Windows 10 Universal App

I am creating a universal Windows 10 application in C #, which should display the names of installed fonts in the system. The app was a metro / modern ui / windows 8.1 app, and I used the SharpDX trick to get the names.

SharpDX is not available (yet?) For Windows 10 UAP, so it no longer works.

Any other ways to achieve my goal? Should I consider a fixed list of font names as described here according to recommended fonts? This seems rather limited, for example, on the desktop.

Thanks in advance!

+4
source share
2 answers

Same basic idea: you will still use DirectWrite to get font names.

You can use Win2D to switch to DirectWrite with C # in Windows 8.1 and Universal Windows Platform applications. CanvasTextFormat. GetSystemFontFamilies will return font families:

string[] fonts = Microsoft.Graphics.Canvas.Text.CanvasTextFormat.GetSystemFontFamilies();
foreach (string font in fonts)
{
    Debug.WriteLine(string.Format("Font: {0}", font));
}
+5
source

I decided to use a fixed list. It does not require Win2D.

If anyone is interested, here is a list of fonts that are guaranteed to be available in all editions of Windows 10 that support UWP applications:

Developed by https://msdn.microsoft.com/en-us/library/windows/apps/hh700394.aspx

public static string[] FontNames = {
    "Arial", "Calibri", "Cambria", "Cambria Math", "Comic Sans MS", "Courier New",
    "Ebrima", "Gadugi", "Georgia",
    "Javanese Text Regular Fallback font for Javanese script", "Leelawadee UI",
    "Lucida Console", "Malgun Gothic", "Microsoft Himalaya", "Microsoft JhengHei",
    "Microsoft JhengHei UI", "Microsoft New Tai Lue", "Microsoft PhagsPa",
    "Microsoft Tai Le", "Microsoft YaHei", "Microsoft YaHei UI",
    "Microsoft Yi Baiti", "Mongolian Baiti", "MV Boli", "Myanmar Text",
    "Nirmala UI", "Segoe MDL2 Assets", "Segoe Print", "Segoe UI", "Segoe UI Emoji",
    "Segoe UI Historic", "Segoe UI Symbol", "SimSun", "Times New Roman",
    "Trebuchet MS", "Verdana", "Webdings", "Wingdings", "Yu Gothic",
    "Yu Gothic UI"
};

, , , Javanese Text Regular Fallback font for Javanese script Microsoft * Segoe MDL2 Assets plus (Web|Wing)dings, .

+1

Source: https://habr.com/ru/post/1614803/


All Articles