osx: Use a larger font

This commit is contained in:
Alexander Kojevnikov 2012-08-16 09:51:10 -07:00
parent 891db76d63
commit 31df33c9da
3 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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" {

View File

@ -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);