简体   繁体   English

“粗体”样式不适用于 QT5 上的“Sans Serif”字体

[英]"Bold" style is not available for "Sans Serif" font on QT5

We just moved our application from QT4 to QT5.我们刚刚将我们的应用程序从 QT4 移到了 QT5。 We found the "Bold" style is not avialble for "Sans Serif" font on QT5.我们发现“粗体”样式不适用于 QT5 上的“Sans Serif”字体。 I can tell from the QFontDialog which looks below:我可以从下面的 QFontDialog 中看出: 在此处输入图片说明

I also use the following code to dump all available styles under "Sans Serif"我还使用以下代码转储“Sans Serif”下的所有可用样式

QFontDatabase db;
auto list = db.styles("Sans Serif");
for(auto& l : list)
    std::cout << l << " ";

And I got the same list which is Normal, Italic and Oblique.我得到了相同的列表,即 Normal、Italic 和 Oblique。 However I can see the Bold and Bold Italic options on QT4.但是我可以在 QT4 上看到 Bold 和 Bold Italic 选项。 My question is how the mapping from font to font style is implemented.我的问题是如何实现从字体到字体样式的映射。 Am I able to configure something to make the "Bold" avalialble for "Sans Serif" font in QT5.我是否能够配置一些东西来使 QT5 中的“Sans Serif”字体的“Bold”可用。

Is it possible that is selects a different font?是否有可能选择不同的字体? (note, Sans Serif is a general name, actual font associated may differ from system to system, from what was included into distribution of OS, from hardware, or from version to version of Qt). (注意,Sans Serif 是一个通用名称,实际关联的字体可能因系统、操作系统分发版中包含的内容、硬件或 Qt 的版本而异)。

At least when dealing with QSS styles, with Qt Quick and etc. it follows same rules as LaTex, where Sans Serif and Bold combinations are deprecated (actually Italic is too, it is same as just choose an Italic font).至少在处理 QSS 样式时,使用 Qt Quick 等,它遵循与 LaTex 相同的规则,不推荐使用无衬线和粗体组合(实际上斜体也是如此,它与仅选择斜体字体相同)。 If you want an equivalent , you likely have to use Helvetica with Bold style (Helvetica is the usual typeface behind Sans Serif).如果你想要一个等价的 ,你可能必须使用粗体风格的 Helvetica(Helvetica 是 Sans Serif 背后的常用字体)。

This is really depending on OS configuration.这实际上取决于操作系统配置。

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

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