Use the Windows default font on Windows 7 and 8/8.1

It contains the characters we need and will make the application look more
"native".

See #712

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-08-22 15:22:02 -07:00
parent 438fe5dbde
commit e893f6bd9d
6 changed files with 37 additions and 5 deletions

View file

@ -12,9 +12,15 @@
#include <unistd.h>
#include <pwd.h>
const char system_divelist_default_font[] = "Sans";
const char linux_system_divelist_default_font[] = "Sans";
const char *system_divelist_default_font = linux_system_divelist_default_font;
const int system_divelist_default_font_size = 8;
void subsurface_OS_pref_setup(void)
{
// nothing
}
void subsurface_user_info(struct user_info *user)
{
struct passwd *pwd = getpwuid(getuid());

View file

@ -28,9 +28,15 @@ void subsurface_user_info(struct user_info *info)
#define ICON_NAME "Subsurface.icns"
#define UI_FONT "Arial 12"
const char system_divelist_default_font[] = "Arial";
const char mac_system_divelist_default_font[] = "Arial";
const char *system_divelist_default_font = mac_system_divelist_default_font;
const int system_divelist_default_font_size = 10;
void subsurface_OS_pref_setup(void)
{
// nothing
}
const char *system_default_filename(void)
{
const char *home, *user;

3
pref.h
View file

@ -79,9 +79,10 @@ extern struct preferences prefs, default_prefs;
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
extern const char system_divelist_default_font[];
extern const char *system_divelist_default_font;
extern const int system_divelist_default_font_size;
extern const char *system_default_filename();
extern void subsurface_OS_pref_setup();
#ifdef __cplusplus
}

View file

@ -195,6 +195,7 @@ void setup_system_prefs(void)
{
const char *env;
subsurface_OS_pref_setup();
default_prefs.divelist_font = strdup(system_divelist_default_font);
default_prefs.font_size = system_divelist_default_font_size;
default_prefs.default_filename = system_default_filename();

View file

@ -479,3 +479,11 @@ QString SubsurfaceSysInfo::osArch()
#endif
return res;
}
extern "C" {
bool isWin7Or8()
{
QString os = SubsurfaceSysInfo::prettyOsName();
return os == "Windows 7" || os.startsWith("Windows 8");
}
}

View file

@ -12,12 +12,22 @@
#include <dirent.h>
#include <zip.h>
const char system_divelist_default_font[] = "Calibri";
const int system_divelist_default_font_size = 8;
const char non_standard_system_divelist_default_font[] = "Calibri";
const char current_system_divelist_default_font[] = "Segoe UI";
const char *system_divelist_default_font = non_standard_system_divelist_default_font;
const int system_divelist_default_font_size = 9;
void subsurface_user(struct user_info *user)
{ /* Encourage use of at least libgit2-0.20 */ }
extern bool isWin7Or8();
void subsurface_OS_pref_setup(void)
{
if (isWin7Or8())
system_divelist_default_font = current_system_divelist_default_font;
}
const char *system_default_filename(void)
{
char datapath[MAX_PATH];