list of installed fonts?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.IsStyleAvailable(FontStyle.Regular))
StylesDesc += "Regular ";
else fs = FontStyle.Italic;

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

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

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

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

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

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

String s = FontFamily.Families.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 said:
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?
 
Back
Top