# HG changeset patch # User Chris Cannam # Date 1588761878 -3600 # Node ID 52d4bfba5b3de2e116e2cf22bf9797d17c0fcb93 # Parent d6976d231efb597c3eac0731ac0d40d202c6a59b Reduce font size when pane is very thin diff -r d6976d231efb -r 52d4bfba5b3d view/View.cpp --- a/view/View.cpp Wed May 06 09:08:37 2020 +0100 +++ b/view/View.cpp Wed May 06 11:44:38 2020 +0100 @@ -2199,8 +2199,19 @@ } QFont font(paint.font()); - font.setPointSize(Preferences::getInstance()->getViewFontSize() - * scaleFactor); + int pointSize = Preferences::getInstance()->getViewFontSize() * scaleFactor; + font.setPointSize(pointSize); + + int h = height(); + int fh = QFontMetrics(font).height(); + if (pointSize > 6) { + if (h < fh * 2.1) { + font.setPointSize(pointSize - 2); + } else if (h < fh * 3.1) { + font.setPointSize(pointSize - 1); + } + } + paint.setFont(font); }