Patch level :2.1 50

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :aggiunto metodo per stabilire quale e' il font di default


git-svn-id: svn://10.65.10.50/trunk@12102 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2004-05-20 12:35:03 +00:00
parent fb055d618a
commit bc64de7745

View File

@ -143,6 +143,21 @@ HIDDEN TPicture_array* _picture = NULL;
HIDDEN XVT_FNTID DEF_FONT = NULL;
HIDDEN XVT_FNTID FAT_FONT = NULL;
bool has_font(const char * nome_font)
{
const int max_fonts = 1024;
char * fonts[max_fonts];
const int num_fonts = xvt_fmap_get_families(NULL, fonts, max_fonts);
bool found = false;
for (int i = 0; i < num_fonts; i++)
{
if (!found && xvt_str_compare_ignoring_case(fonts[i], nome_font) == 0)
found = true;
xvt_mem_free(fonts[i]);
}
return found;
}
XVT_FNTID xvt_default_font(bool bold)
{
if (DEF_FONT == NULL)
@ -153,7 +168,12 @@ XVT_FNTID xvt_default_font(bool bold)
TString font_ser_desc(font.get("FontDesc"));
if (font_ser_desc.empty())
#ifdef WIN32
font_ser_desc = "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
{
const char* name = "Courier";
if (has_font("Verdana"))
name = "Verdana";
font_ser_desc.format("01\\%s\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/%s", name, name);
}
#else
font_ser_desc = "01\\Courier\\0\\10\\WIN01/10/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
#endif