From bc64de7745927c988e6c830052ef94ff69f808a1 Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 20 May 2004 12:35:03 +0000 Subject: [PATCH] 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 --- include/controls.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/include/controls.cpp b/include/controls.cpp index 9bac932ce..f7e93b9b3 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -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