Mercurial > hg > svgui
diff view/View.cpp @ 955:76b5eabd816b osx-retina
Fix font size for painter when rendering scaled
author | Chris Cannam |
---|---|
date | Wed, 29 Apr 2015 13:08:17 +0100 |
parents | fe46201414c8 |
children | 092de22db207 |
line wrap: on
line diff
--- a/view/View.cpp Wed Apr 29 13:02:57 2015 +0100 +++ b/view/View.cpp Wed Apr 29 13:08:17 2015 +0100 @@ -1657,8 +1657,18 @@ void View::setPaintFont(QPainter &paint) { + int scaleFactor = 1; + int dpratio = devicePixelRatio(); + if (dpratio > 1) { + QPaintDevice *dev = paint.device(); + if (dynamic_cast<QPixmap *>(dev) || dynamic_cast<QImage *>(dev)) { + scaleFactor = dpratio; + } + } + QFont font(paint.font()); - font.setPointSize(Preferences::getInstance()->getViewFontSize()); + font.setPointSize(Preferences::getInstance()->getViewFontSize() + * scaleFactor); paint.setFont(font); }