I'm having trouble determining if a custom font (Euclid Triangle) is installed on a collection of machines.
I've used the code listed here "Test if a Font is installed" and it works on my Windows 10 machine. But it does not work on a Windows 7 machine and a bunch of machines at my customer.
All machines have .Net 4.5 and above.
The font is not listed if I try listing all the Fonts on the machine:
static void ListFonts()
{
try
{
using (InstalledFontCollection fontsCollection = new InstalledFontCollection())
{
FontFamily[] fontFamilies = fontsCollection.Families;
var fonts = new List<string>();
foreach (FontFamily font in fontFamilies)
fonts.Add(font.Name);
var file = new FileInfo(Assembly.GetExecutingAssembly().Path() + "\\fonts.txt");
Serializer.SerializeToFile(fonts, file.FullName);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Printer Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
var file = new FileInfo(Assembly.GetExecutingAssembly().Path() + "\\log.txt");
File.WriteAllText(file.FullName, ex.ToString());
Console.WriteLine(ex.ToString());
}
}
EDIT: I've run my code as Administrator to confirm that the issue is not related to permissions.