# HG changeset patch # User Chris Cannam # Date 1432220714 -3600 # Node ID 0aac065f09f989c1a7eddec2576a900569e29a8f # Parent 9b4771ba2e3e749e1dcee1cc544f8fa570c371f0 Fixes to font sizing in colour 3d plot layer (for #1221) diff -r 9b4771ba2e3e -r 0aac065f09f9 layer/Colour3DPlotLayer.cpp --- 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;