Главная страница | назад





Article #17181: Are TrueType fonts are available...

 Question and Answer Database

FAQ2181C.txt   Are TrueType fonts are available...
Category   :Windows API
Platform    :All
Product    :C++Builder  1.x

Question:
How can I tell if TrueType fonts are available on a given system?

Answer:
The following example will report if the TrueType engine is
available, enabled, and at least one TrueType font is installed:

//Prototypes in the form class:

private:
   RASTERIZER_STATUS rs;
   bool IsTrueTypeAvailable();

//Implementation
bool TForm1::IsTrueTypeAvailable()
{
    memset(rs, NULL, sizeof(rs));
    if(GetRasterizerCaps(&rs, sizeof(rs)) != true)
    	return false;
    if((rs.wFlags & TT_AVAILABLE) != TT_AVAILABLE)
    	return false;
    if((rs.wFlags & TT_ENABLED) != TT_ENABLED)
    	return false;
    return true;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    if(IsTrueTypeAvailable() == false)
    	ShowMessage("True Type Fonts are not available");
    else
    	ShowMessage("True Type Fonts are available");
}


7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99