mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:48:52 +02:00
Add high-dpi support to scaleWidgetFontSizes
This commit is contained in:
parent
4a383ff177
commit
ff1fb07b2d
1 changed files with 8 additions and 1 deletions
|
@ -51,7 +51,14 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) {
|
||||||
const float NATIVE_DPI = 96.0f;
|
const float NATIVE_DPI = 96.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float fontScale = (BASE_DPI / NATIVE_DPI) * (glCanvas->logicalDpiX() / NATIVE_DPI);
|
// Scale fonts based on the native dpi. On Windows, where the native DPI is 96,
|
||||||
|
// the scale will be: 72.0 / 96.0 = 0.75
|
||||||
|
float fontScale = (BASE_DPI / NATIVE_DPI);
|
||||||
|
|
||||||
|
// Scale the font further by the system's DPI settings. If using a 2x high-dpi screen
|
||||||
|
// on Windows, for example, the font will be further scaled by: 192.0 / 96.0 = 2.0
|
||||||
|
// This would give a final scale of: 0.75 * 2.0 = 1.5
|
||||||
|
fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI);
|
||||||
|
|
||||||
internalScaleWidgetFontSizes(widget, fontScale);
|
internalScaleWidgetFontSizes(widget, fontScale);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue