Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: list of installed fonts?

0 views
Skip to first unread message

Tamir Khason

unread,
Jul 6, 2004, 3:27:55 AM7/6/04
to
Here is some C# OnPaint code that will show you how to use FontFamily to
get a list of fonts:

protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
int i, nCount;
SolidBrush b = new SolidBrush( Color.Black );
int x = 0, y = 0;

nCount = FontFamily.Families.Length;

for(i=0;i<nCount;i++)
{
FontStyle fs = FontStyle.Regular;
Font f;
String StylesDesc = "";


if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Regular))
StylesDesc += "Regular ";
else fs = FontStyle.Italic;

if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Italic))
StylesDesc += "Italic ";
else fs = FontStyle.Bold;

if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Bold))
StylesDesc += "Bold ";

if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Underline))
StylesDesc += "Underline ";

if (FontFamily.Families[i].IsStyleAvailable(FontStyle.Strikeout))
StylesDesc += "Strikeout ";

if (StylesDesc.Length > 0)
StylesDesc = StylesDesc.Substring(0,StylesDesc.Length-1);

f = new Font( FontFamily.Families[i].Name, 12, fs);

String s = FontFamily.Families[i].Name + " " + StylesDesc;
e.Graphics.DrawString( s, f, b, x, y );
y += f.Height;

}
}


--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "


"Sachin" <sac...@softbridge-s.com> wrote in message
news:9B26C61F-1888-491B...@microsoft.com...
> How to get the list of installed fonts corresponding to any perticular
charactor set? eg. if I want to get Japanese supporting font list
(corresponding to char set Shift_JIS), how to do it?
> please guide
> --
> sachin


0 new messages