Search code examples
c#.netpdffontssystem.drawing

Where can I find a list of fonts that go in the constructor 'public Font( string familyName, float emSize )'?


I've been trying for the past hour to figure out where I can get a list of all possible values that go into familyName in the constructor

public Font(
    string familyName,
    float emSize
)

https://msdn.microsoft.com/en-us/library/164w6x6z(v=vs.110).aspx

I'm trying to find a font that is close to the thin

wf_segoe-ui_semilight,wf_segoe-ui_light,wf_segoe-ui_normal,'Segoe UI Semilight','Segoe UI Light','Segoe UI',Arial,sans-serif !important

on https://www.microsoft.com/en-us/

and so far I've been doing the "Guess and check" method where I recompile my application after putting in a new font name.


Solution

  • Check the FontFamily class

    using System;
    using System.Drawing;
    
    namespace ConsoleApplicationFont
    {
        class Program
        {
            static void Main(string[] args)
            {
                foreach (var item in FontFamily.Families)
                    Console.WriteLine(item.Name);
    
                Console.ReadLine();
            }
        }
    }