AGS.Editor.Utilities.FindExistingFont C# (CSharp) 메소드

FindExistingFont() 공개 정적인 메소드

Iterates given array of font family names and return the first FontFamily object that is installed in the system. If none was found, returns generic Sans-Serif system font.
public static FindExistingFont ( string fontNames ) : FontFamily
fontNames string
리턴 System.Drawing.FontFamily
        public static FontFamily FindExistingFont(string[] fontNames)
        {
            FontFamily fontfam = null;
            foreach (string name in fontNames)
            {
                try
                {
                    fontfam = new FontFamily(name);
                }
                catch (System.ArgumentException)
                {
                    continue;
                }
                if (fontfam.Name == name)
                    return fontfam;
            }
            return new FontFamily(GenericFontFamilies.SansSerif);
        }

Usage Example

예제 #1
0
            static Design()
            {
                FontFamily fontfam = Utilities.FindExistingFont(Design.FontNames);

                FontName = fontfam.Name;
            }