Search code examples
androidqttestingfontsfelgo

Prevent fonts and sizes to change on deployment in Qt/Felgo


I recently distributed my app made with Felgo (and Qt) to Android using Microsoft App Store. Until now, I have been testing using a Felgo live client. However, though everything else works, one big thing I noticed is that all the fonts and font sizes where completely messed up. I believe this is because it is using Android native fonts instead of what I set in my code.

Is there any way I can fix this so that all my fonts are the same as what I tested with the live client?


Solution

  • Fonts in Felgo should use the sp() method for scaling correctly, also the fontSize property should not be set with sp or dp scaling, since it's already scaled internally using the sp method, so it's unit is device-independent. This should preserve your font sizes across different platforms.

    AppText {
      fontSize: 18 //same as font.pixelSize: sp(18)
    }