changeset 969:0aac065f09f9 osx-retina

Fixes to font sizing in colour 3d plot layer (for #1221)
author Chris Cannam
date Thu, 21 May 2015 16:05:14 +0100
parents 9b4771ba2e3e
children 1011ffb1b6d5
files layer/Colour3DPlotLayer.cpp
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Thu May 14 15:40:37 2015 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Thu May 21 16:05:14 2015 +0100
@@ -755,9 +755,10 @@
 }
 
 int
-Colour3DPlotLayer::getColourScaleWidth(QPainter &) const
+Colour3DPlotLayer::getColourScaleWidth(QPainter &p) const
 {
-    int cw = 20;
+    // Font is rotated
+    int cw = p.fontMetrics().height();
     return cw;
 }
 
@@ -844,7 +845,7 @@
         paint.save();
 
         QFont font = paint.font();
-        font.setPixelSize(10);
+        font.setPixelSize(font.pixelSize() * 0.65);
         paint.setFont(font);
 
         int msw = paint.fontMetrics().width(maxstr);
@@ -882,6 +883,8 @@
 
     int py = h;
 
+    int defaultFontHeight = paint.fontMetrics().height();
+    
     for (int i = symin; i <= symax; ++i) {
 
         int y0;
@@ -891,9 +894,9 @@
 
         if (i > symin) {
             if (paint.fontMetrics().height() >= h) {
-                if (h >= 8) {
+                if (h >= defaultFontHeight * 0.8) {
                     QFont tf = paint.font();
-                    tf.setPixelSize(h-2);
+                    tf.setPixelSize(h * 0.8);
                     paint.setFont(tf);
                 } else {
                     continue;