diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-04-30 09:17:54 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-05-13 12:29:21 +0000 |
commit | 56acf089c7759ce21a5bc3ce32616df5b01e78ef (patch) | |
tree | 88af13b8656633009884e11a857563ba01365704 /src/plugins/platforms/wasm/qtloader.js | |
parent | ffdcad9e400ff43b7f33621caca672389a03e4e6 (diff) |
wasm: support setting the font DPI from JS
We have not really been able to determine what the
default DPI should be, so make it configurable with
API on qtloader.js:
qtLoader.setFontDpi(72);
Also lowers the default DPI to the standard value of
96 (down from Qt default 100).
Task-number: QTBUG-75510
Change-Id: Ica1164c8d80bb06519233adebf2c9e400c0991ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qtloader.js')
-rw-r--r-- | src/plugins/platforms/wasm/qtloader.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qtloader.js b/src/plugins/platforms/wasm/qtloader.js index 4752a1dcee..ef4a6ec2b9 100644 --- a/src/plugins/platforms/wasm/qtloader.js +++ b/src/plugins/platforms/wasm/qtloader.js @@ -124,6 +124,8 @@ // Remove canvas at run-time. Removes the corresponding QScreen. // resizeCanvasElement // Signals to the application that a canvas has been resized. +// setFontDpi +// Sets the logical font dpi for the application. var Module = {} @@ -237,6 +239,8 @@ function QtLoader(config) publicAPI.addCanvasElement = addCanvasElement; publicAPI.removeCanvasElement = removeCanvasElement; publicAPI.resizeCanvasElement = resizeCanvasElement; + publicAPI.setFontDpi = setFontDpi; + publicAPI.fontDpi = fontDpi; restartCount = 0; @@ -557,6 +561,16 @@ function QtLoader(config) Module.qtResizeCanvasElement(element); } + function setFontDpi(dpi) { + Module.qtFontDpi = dpi; + if (publicAPI.status == "Running") + Module.qtSetFontDpi(dpi); + } + + function fontDpi() { + return Module.qtFontDpi; + } + setStatus("Created"); return publicAPI; |