Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Just .TTF no .FON

Status
Not open for further replies.

Tremorblue

Programmer
Apr 30, 2004
56
GB
Hi I have a list box on the form and populate it with the windows fonts.

ListBox1->Items = Screen->Fonts;

Is there a way to remove the .fon fonts from this list and just leave the .ttf files.

for (int i = 0; i < Screen->Fonts->Count; i++)
{
if( font is .ttf ) // What goes here ??
ListBox1->Items->Add(Screen->Fonts->Strings);
}

Thanks,

TremorB.
 
You could use the Windows API's EnumFontFamilies function, something like:
[tt]
int CALLBACK fontfunc
(ENUMLOGFONT*lpelf,NEWTEXTMETRIC*,int FontType,LPARAM)
{
if(FontType==TRUETYPE_FONTTYPE)
Form1->ListBox1->Items
->Add((char*)lpelf->elfFullName);
return 1;
}

...

EnumFontFamilies
(Canvas->Handle,0,(FONTENUMPROC)fontfunc,0);
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top