default font doesn't render same size between desktop and Wasm
-
Hello, testing the Wasm version of my application, I noticed that the font size isn't the same as the Desktop Window version. I'm using the default font for simplicity, but in order to have all versions rendering same size text I can use whatever font that will render the same on both versions. Does someone know what font I should use ?
Here's a screenshot of the two versions of the same pieces :
On the Qt for WebAssembly doc it is stated that Wasm uses
Fonts The Qt WASM module contains 3 embedded fonts: "Bitstream Vera Sans" (fallback font), "DejaVu Sans", "DejaVu Sans Mono".
I'm going to try to explicitly mention the font instead of using default (QFont()).
But the problem is maybe that I'm using others parameters to make the numbers use as few space as possible :
tf = QFont(); tf.setLetterSpacing(QFont::AbsoluteSpacing, -1); tf.setStretch(75);
At first I used others parameters but they caused Wasm to not render the font.
I could also get rid of using font and instead directly use the vectors that I will use for the SVG
-
By using
tf = QFont("Bitstream Vera Sans", 8); tf.setLetterSpacing(QFont::AbsoluteSpacing, -1);
I almost have the same rendering, except a small vertical offset that I can correct, My alignment formula is using an absolute value and I need to change it to relative.
-