Use Consolas as the default font where available

This commit is contained in:
Berke Viktor 2012-10-28 02:08:36 +01:00
parent e0f61605de
commit 6ae224107f
5 changed files with 50 additions and 4 deletions

View File

@ -789,8 +789,21 @@ load_config (void)
#endif
strcpy (prefs.hex_stamp_log_format, "%b %d %H:%M:%S ");
strcpy (prefs.hex_stamp_text_format, "[%H:%M:%S] ");
#ifdef WIN32
if (find_font ("Consolas"))
{
strcpy (prefs.hex_text_font, "Consolas 10");
strcpy (prefs.hex_text_font_main, "Consolas 10");
}
else
{
strcpy (prefs.hex_text_font, DEF_FONT);
strcpy (prefs.hex_text_font_main, DEF_FONT);
}
#else
strcpy (prefs.hex_text_font, DEF_FONT);
strcpy (prefs.hex_text_font_main, DEF_FONT);
#endif
strcpy (prefs.hex_text_font_alternative, DEF_FONT_ALTER);
strcpy (prefs.hex_text_spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US");

View File

@ -125,7 +125,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -143,7 +143,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>

View File

@ -122,7 +122,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
@ -140,7 +140,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_LIB;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>

View File

@ -32,6 +32,7 @@
#include <sys/timeb.h>
#include <process.h>
#include <io.h>
#include <pango/pangocairo.h> /* for find_font() */
#include "../dirent/dirent-win32.h"
#include "../../config-win32.h"
#else
@ -1986,3 +1987,34 @@ encode_sasl_pass (char *user, char *pass)
return encoded;
}
#ifdef WIN32
int
find_font (const char *fontname)
{
int i;
int n_families;
const char *family_name;
PangoFontMap *fontmap;
PangoFontFamily *family;
PangoFontFamily **families;
fontmap = pango_cairo_font_map_get_default ();
pango_font_map_list_families (fontmap, &families, &n_families);
for (i = 0; i < n_families; i++)
{
family = families[i];
family_name = pango_font_family_get_name (family);
if (!g_ascii_strcasecmp (family_name, fontname))
{
g_free (families);
return 1;
}
}
g_free (families);
return 0;
}
#endif

View File

@ -47,6 +47,7 @@ int waitline (int sok, char *buf, int bufsize, int);
#ifdef WIN32
int waitline2 (GIOChannel *source, char *buf, int bufsize);
int get_cpu_arch (void);
int find_font (const char *fontname);
#else
#define waitline2(source,buf,size) waitline(serv->childread,buf,size,0)
#endif