spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 998b562841e73301d527de6859a7c28044ca5074
parent 313c7a9e35854d73325d33b6968a76eaac28fb41
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Wed, 23 Jun 2010 09:52:54 +0900

[osx] Pango fonts are smaller on OSX

Diffstat:
Msrc/spek-spectrogram.vala | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala @@ -40,6 +40,12 @@ namespace Spek { private const int BPAD = 40; private const int GAP = 10; private const int RULER = 10; + private const double FONT_SCALE = +#if MAC_INTEGRATION + 1.5; // Pango/Quartz fonts are smaller than on X. +#else + 1.0; +#endif public Spectrogram () { // Pre-draw the palette. @@ -158,7 +164,8 @@ namespace Spek { cr.set_line_width (1); cr.set_antialias (Antialias.NONE); var layout = cairo_create_layout (cr); - layout.set_font_description (FontDescription.from_string ("Sans 8")); + layout.set_font_description (FontDescription.from_string ( + "Sans " + (8 * FONT_SCALE).to_string ())); layout.set_width (-1); // Time ruler. @@ -189,7 +196,8 @@ namespace Spek { // File properties. cr.move_to (LPAD, TPAD - GAP); - layout.set_font_description (FontDescription.from_string ("Sans 9")); + layout.set_font_description (FontDescription.from_string ( + "Sans " + (9 * FONT_SCALE).to_string ())); layout.set_width ((int) (w - LPAD - RPAD) * Pango.SCALE); layout.set_ellipsize (EllipsizeMode.END); layout.set_text (info, -1); @@ -199,7 +207,8 @@ namespace Spek { // File name. cr.move_to (LPAD, TPAD - 2 * GAP - text_height); - layout.set_font_description (FontDescription.from_string ("Sans Bold 10")); + layout.set_font_description (FontDescription.from_string ( + "Sans Bold " + (10 * FONT_SCALE).to_string ())); layout.set_width ((int) (w - LPAD - RPAD) * Pango.SCALE); layout.set_ellipsize (EllipsizeMode.START); layout.set_text (file_name, -1); @@ -271,4 +280,4 @@ namespace Spek { return (rr << 16) + (gg << 8) + bb; } } -} -\ No newline at end of file +}