■ InstalledFontCollection 클래스를 사용해 영문 폰트명 리스트를 구하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
using System.Drawing; using System.Drawing.Text; using System.Globalization; using System.Threading; #region 영문 폰트명 리스트 구하기 - GetEnglishFontNameList() /// <summary> /// 영문 폰트명 리스트 구하기 /// </summary> /// <returns>영문 폰트명 리스트</returns> public List<string> GetEnglishFontNameList() { CultureInfo currentCultureInfo = Thread.CurrentThread.CurrentUICulture; try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfoByIetfLanguageTag("en-US"); List<string> list = new List<string>(); InstalledFontCollection installedFontCollection = new InstalledFontCollection(); foreach(FontFamily fontFamily in installedFontCollection.Families) { list.Add(fontFamily.Name); } return list; } finally { Thread.CurrentThread.CurrentUICulture = currentCultureInfo; } } #endregion |