المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Using Open-Type font in C#



C# Programming
06-05-2012, 12:11 AM
Hi all,

My application lets a user select a True Type font from the FontFamily.Families enumeration:

foreach (FontFamily ff in FontFamily.Families) { if(ff.IsStyleAvailable(FontStyle.Regular)) fontCombo.Items.Add(ff.Name); }
This doesn't work for Open Type fonts, e.g. I just installed Costura Light, and it's now available in MS Word, but invisible to my enumeration above.

Googling doesn't reveal any solution to this; all the sites just assume the font is there after you install it.

What do I have to do to make Open-Type fonts available? Thanks!

=========================

EDIT -- THERE'S NO SIMPLE WAY TO DO THIS: GDI+ ONLY SUPPORTS TRUE TYPE. THERE'S A CONVOLUTED WAY TO USE GDI FOR OPEN-TYPE FONTS FROM MANAGED C++ DESCRIBED HERE: http://www.codeguru.com/cpp/g-m/gdi/fonthandlinganddetection/article.php/c10621/Make-GDI-Less-Finicky-About-Fonts.htm[^ (http://www.codeguru.com/cpp/g-m/gdi/fonthandlinganddetection/article.php/c10621/Make-GDI-Less-Finicky-About-Fonts.htm)]
"Microsoft -- Adding unnecessary complexity to your work since 1987!"