- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用免费 Encode Sans font 的 QML 应用程序,它有 9 个权重匹配 Qt 5.6's font weights .
我已将所有 .ttf 添加到我的项目中,并使用 FontLoader
加载它们。一切都完美无缺,除了字体的粗细。
除了下面的代码之外,我还尝试在 FontLoader 上为 Thin 提供一个唯一的 id
,以确保家族名称相同(确实如此)。如何调试此问题并使 Thin 正常工作?
### main.qml
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-Thin.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-ExtraLight.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-Light.ttf" }
FontLoader { id:mainFont; source:"qrc:/fonts/encodesans/EncodeSans-Regular.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-Medium.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-SemiBold.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-Bold.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-ExtraBold.ttf" }
FontLoader { source:"qrc:/fonts/encodesans/EncodeSans-Black.ttf" }
Column {
TextLine { weight:"Thin" }
TextLine { weight:"ExtraLight" }
TextLine { weight:"Light" }
TextLine { weight:"Normal" }
TextLine { weight:"Medium" }
TextLine { weight:"DemiBold" }
TextLine { weight:"Bold" }
TextLine { weight:"ExtraBold" }
TextLine { weight:"Black" }
}
### TextLine.qml
import QtQuick 2.0
Text {
property string weight
text: "1 2 3 4 font.weight: Font."+weight
color:"white"
font {
weight: Font[weight]
family: mainFont.name
pixelSize: 36
}
}
如果重要的话,在 Ubuntu 上使用 Qt 5.6。
最佳答案
这是一个 Qt 错误:[QTBUG-53196] Thin fonts do not work in Qt
您可以使用的一种解决方法是使用 styleName
property相反,它是在 Qt 5.6 中引入的。这种方法的缺点是,如果您的文本中有一些嵌入的粗体(使用 html 或富文本),它将不起作用(如果我理解这个 bug 正确的话)。
你可以这样使用它:
### TextLine.qml
import QtQuick 2.0
Text {
property string weight
text: "1 2 3 4 font.weight: Font."+weight
color:"white"
font {
styleName: weight
family: mainFont.name
pixelSize: 36
}
}
关于qt - QML 不使用细字体粗细,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37573143/
我有一个格式良好的单元格范围,具有不同的边框线粗细(其中一些是中等厚度,其中一些是薄的,没有特定的图案)。我想运行一个将边框颜色更改为灰色的宏,但每次执行此操作时,它都会自动将所有边框粗细更改为 xl
我可以使用百分比使我的图像/div 具有响应性。 如何使字体大小响应不同的屏幕大小? 最佳答案 我最近偶然发现了这个问题,并为此编写了一个适合我需要的解决方案。也许您会发现您也可以将它合并到您的 CS
在 iOS 8 中,为了获得 Helvetica Neue 的细变体,以下代码可以工作 UIFont.systemFontOfSize(50, weight: UIFontWeightThin) 在
我想将 matplotlib 绘图中使用的默认字体更改为 Windows 下的 Segoe UI。我可以通过像这样改变 rcParams 来做到这一点 import matplotlib matplo
我想知道是否有人知道基于 Bresenham 的线算法或任何类似算法绘制具有特定粗细的线的任何算法。 再想一想,我一直在想,对于每个 setPixel(x,y) 我只是画一个圆圈,例如: filled
我正在尝试自定义我已经拥有的用于选择 Google 字体和更新预览 DIV 的功能之一,但是我还想添加“字体大小”、“字体粗细”、“字母间距”等,但是此功能仅在您单击“主字体选择器”组合框时才有效,我
我正在使用 RaphaelJS 在 IE8 中调试一些性能问题。我们正在 raphael 中从大约 1000 个元素和文本节点构建图形,特别是一个图形在渲染时给我们带来了问题。在 IE9 中,根据机器
我是一名优秀的程序员,十分优秀!