在 Pango 中处理更粗更轻的 CSS
我在实现部分 CSS 规范的应用程序中使用 Pango,到目前为止,我一直被 font-weight: (bolder|lighter)
属性难住了。
根据规范,
“bolder”选择分配给比继承的字体更暗的字体的下一个粗细。
“lighter”类似,但工作方向相反:它选择下一个较亮的关键字,其字体与继承的关键字不同。
我似乎找不到一种简单的方法来获取权重值,从而使我的字体变暗(或更亮)。
I am using Pango in an application implementing part of the CSS specification and so far I have been stumped by the font-weight: (bolder|lighter)
attribute.
According to specification,
'bolder' selects the next weight that is assigned to a font that is darker than the inherited one.
'lighter' is similar, but works in the opposite direction: it selects the next lighter keyword with a different font from the inherited one.
I can't seem to find a simple way of getting the weight value that would give me a darker (or lighter) font.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 font_weight 属性。
Take a look at the font_weight attribute.
我不明白这个问题?
Bolder 和 Lighter 是相对的 CSS 样式,并且会更改元素相对于其继承值的字体粗细。 有效值为 100-900,但是大多数字体不支持所有粗细,因此 400-600 之类的内容都会显示相同,等等。
例如,如果普通字体粗细是普通字体(像这样,或粗细 = 500),
bolder
将是下一个增量,可能是 700,看起来像 this。如果默认字体的粗细为 700,那么较亮将使新字体显示为正常粗细,即 500。
I don't understand the issue?
Bolder and Lighter are relative CSS Styles, and will change the font weight of an element relative to its inherited value. Valid values are 100-900, however most fonts wont support all weights so things like 400-600 will all appear the same, etc.
As an example, if the normal font weight was normal font (like this, or weight = 500),
bolder
would be the next increment and would probably be 700 and look like this.If the default font was weight 700, then lighter would make the new font appear as normal weight, or 500.