指南针字体混合粗体
我正在将 @font-face mixin 与 Compass (0.11.beta.1) 一起使用,并且在定义粗体和斜体字体时遇到问题。
我可以使用以下代码成功加载和使用字体:
@include font-face("PTSerif", font-files("/path/to/font/PTF55F_W.ttf", truetype), "/path/to/font/PTF55F_W.eot");
但是我找不到定义粗体字体的方法。消息来源称 style 参数已被弃用,尝试使用它对输出 .css 文件没有影响。
@mixin font-face($name, $font-files, $eot: false, $postscript: false, $style: false) {
@if $postscript or $style {
@warn "The $postscript and $style variables have been deprecated in favor of the Paul Irish smiley bulletproof technique."; }
@font-face {
font-family: quote($name);
@if $eot {
src: font-url($eot); }
src: local("☺"), $font-files; } }
我目前有两种选择:
- 之后编辑 .css 文件。不利于可维护性
为不同的样式定义不同的字体(也不太理想,但目前最可行)例如
@include font-face("PTSerif")
@include font-face("PTSerif-B")
还没有找到任何如何正确执行此操作的示例 - 能够使用 font-weight:bold;
提前致谢。
I am using the @font-face mixin with Compass (0.11.beta.1) and having trouble defining my bold and italic fonts.
I can successfully load and use fonts with the following code:
@include font-face("PTSerif", font-files("/path/to/font/PTF55F_W.ttf", truetype), "/path/to/font/PTF55F_W.eot");
However I can't find a way to define the bold font-face. The source says that the style argument has been deprecated, and trying to use it has no effect on the output .css file.
@mixin font-face($name, $font-files, $eot: false, $postscript: false, $style: false) {
@if $postscript or $style {
@warn "The $postscript and $style variables have been deprecated in favor of the Paul Irish smiley bulletproof technique."; }
@font-face {
font-family: quote($name);
@if $eot {
src: font-url($eot); }
src: local("☺"), $font-files; } }
I currently have two alternatives:
- Edit the .css files afterwards. No good for maintainability
Define different fonts for the different styles (also not ideal, but currently the mos workable) e.g.
@include font-face("PTSerif")
@include font-face("PTSerif-B")
Haven't been able to find any examples of how to do this properly- being able to use font-weight:bold;
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个组合常规、粗体和斜体的示例,我工作得很好: @font-face :: IM英语水平下降了。
Here's an example of combining regular, bold and italic that I have working just fine: @font-face :: IM FELL ENGLISH.
acarabott,我前段时间已经为此做出了compass 的承诺,它似乎随0.12.alpha 一起发布。
注意这里的 $weight 和 $style 参数:
http://beta.compass-style.org/reference/compass/css3/字体面/
acarabott, I've made a commit to compass for this some time ago, and it seems to ship with 0.12.alpha.
Notice the $weight and $style parameters here:
http://beta.compass-style.org/reference/compass/css3/font_face/