diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-08-22 15:22:02 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-22 15:56:57 -0700 |
commit | e893f6bd9db696a1d647b796138233152ca290fa (patch) | |
tree | 32b5fad9d0a958257817fb3d134d53f881ef9127 | |
parent | 438fe5dbde222c73e22441a6e39c85c8c887218b (diff) | |
download | subsurface-e893f6bd9db696a1d647b796138233152ca290fa.tar.gz |
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>
-rw-r--r-- | linux.c | 8 | ||||
-rw-r--r-- | macos.c | 8 | ||||
-rw-r--r-- | pref.h | 3 | ||||
-rw-r--r-- | subsurfacestartup.c | 1 | ||||
-rw-r--r-- | subsurfacesysinfo.cpp | 8 | ||||
-rw-r--r-- | windows.c | 14 |
6 files changed, 37 insertions, 5 deletions
@@ -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()); @@ -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; @@ -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 } diff --git a/subsurfacestartup.c b/subsurfacestartup.c index 8edc409be..10dacfcba 100644 --- a/subsurfacestartup.c +++ b/subsurfacestartup.c @@ -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(); diff --git a/subsurfacesysinfo.cpp b/subsurfacesysinfo.cpp index caa9db8a5..4093654ee 100644 --- a/subsurfacesysinfo.cpp +++ b/subsurfacesysinfo.cpp @@ -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"); +} +} @@ -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]; |