简体   繁体   English

防止在 Qt/Felgo 中部署时更改字体和大小

[英]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.我最近使用 Microsoft App Store 将我用 Felgo(和 Qt)制作的应用程序分发到 Android。 Until now, I have been testing using a Felgo live client.到目前为止,我一直在使用 Felgo 实时客户端进行测试。 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.我相信这是因为它使用的是 Android 原生字体,而不是我在代码中设置的字体。

Is there any way I can fix this so that all my fonts are the same as what I tested with the live client?有什么办法可以解决这个问题,以便我所有的字体都与我在实时客户端上测试的字体相同?

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. Felgo 中的字体应该使用sp()方法正确缩放,也不应该使用spdp缩放设置 fontSize 属性,因为它已经使用 sp 方法在内部进行了缩放,因此它的单位与设备无关。 This should preserve your font sizes across different platforms.这应该在不同平台上保留您的字体大小。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM