commit 31df33c9da9446ced92e0f16c8510673c89e7a4e
parent 891db76d6384c42e61bda4432339a7238d240ba6
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Thu, 16 Aug 2012 09:51:10 -0700
osx: Use a larger font
Diffstat:
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/spek-platform.cc b/src/spek-platform.cc
@@ -59,6 +59,15 @@ bool SpekPlatform::can_change_language()
#endif
}
+double SpekPlatform::font_scale()
+{
+#ifdef OS_OSX
+ return 1.3;
+#else
+ return 1.0;
+#endif
+}
+
char * spek_platform_short_path(const char *path)
{
#ifdef OS_WIN
diff --git a/src/spek-platform.hh b/src/spek-platform.hh
@@ -34,6 +34,9 @@ public:
// Setting non-default locale under GTK+ is tricky (see e.g. how FileZilla does it). We will
// just disable the language setting for GTK+ users and will always use the system locale.
static bool can_change_language();
+
+ // Fonts are smaller on OSX.
+ static double font_scale();
};
extern "C" {
diff --git a/src/spek-spectrogram.cc b/src/spek-spectrogram.cc
@@ -22,6 +22,7 @@
#include "spek-audio.h"
#include "spek-audio-desc.hh"
#include "spek-pipeline.h"
+#include "spek-platform.hh"
#include "spek-ruler.hh"
#include "spek-spectrogram.hh"
@@ -127,12 +128,17 @@ void SpekSpectrogram::render(wxDC& dc)
dc.SetPen(*wxWHITE_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetTextForeground(wxColour(255, 255, 255));
- wxFont normal_font = wxFont(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
+ wxFont normal_font = wxFont(
+ (int)round(9 * SpekPlatform::font_scale()),
+ wxFONTFAMILY_SWISS,
+ wxFONTSTYLE_NORMAL,
+ wxFONTWEIGHT_NORMAL
+ );
wxFont large_font = wxFont(normal_font);
- large_font.SetPointSize(10);
+ large_font.SetPointSize((int)round(10 * SpekPlatform::font_scale()));
large_font.SetWeight(wxFONTWEIGHT_BOLD);
wxFont small_font = wxFont(normal_font);
- small_font.SetPointSize(8);
+ small_font.SetPointSize((int)round(8 * SpekPlatform::font_scale()));
dc.SetFont(normal_font);
int normal_height = dc.GetTextExtent(wxT("dummy")).GetHeight();
dc.SetFont(large_font);