【发布时间】:2012-10-22 15:05:32
【问题描述】:
如果安装在用户的计算机中,我想在网站中使用“Segoe UI”字体。
我已经用@font-face 声明了所有样式,以便使用font-weight 属性来更改字体的粗细(这是一个非常酷的功能!)。
问题是我无法使用 Segoe UI Bold(我认为名称错误)。有什么想法吗?
这里是一个例子。 (4) 和 (5) 相同:http://jsfiddle.net/kxHQR/1/
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 700;
src: local('Segoe UI Bold'), local('SegoeUI-bold'), local('segoeuib');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 600;
src: local('Segoe UI Semibold'), local('SegoeUI-Semibold');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 400;
src: local('Segoe UI'), local('SegoeUI');
}
@font-face {
font-family: 'Myname';
font-style: normal;
font-weight: 300;
src: local('Segoe UI Light'), local('SegoeUI-Light');
}
/* ... */
BODY {
font-family: 'Myname';
}
.boldtext {
font-family:'Segoe UI';
font-weight:700;
}
<p style='font-weight:300'>1. Text with font-weight:300. OK</h1>
<p>2. Here is normal text. OK</p>
<p style='font-weight:600'>3. Text with font-weight:600. OK</p>
<p style='font-weight:700' >4. Text with font-weight:700. It must be like (5), but it is like (3). :(</p>
<p class='boldtext'>5. Text with font-family:'Segoe UI' (no font-face) and font-weight:700; </p>
【问题讨论】:
-
FWIW,“Segoe UI Bold”是我的 Windows 字体目录中列出的名称。
-
它可以在我的 Chrome、FF 和 IE9 机器上运行:jsfiddle.net/kxHQR。请注意,对于 IE8 及更低版本,您需要使用具有旧 IE 语法的自定义字体。
-
它应该可以正常工作:jsfiddle.net/UcTGP 可能是您缺少字体文件吗?您使用的是什么系统或浏览器?
-
在您的系统上使用
<b style="font-family: Segoe UI">Sample</b>进行测试(没有任何@font-face),或者尝试在文字处理器中使用Segoe UI Bold。听起来字体可能在您的系统中丢失或损坏。该字体可能有些奇怪,因为在我的系统上,font-family: Segoe UI Bold不会生成它(但这种旧方法适用于 Semibold 和 Light),而我的字体列表工具(适用于 IE)cs.tut.fi/~jkorpela/listfonts1.html 没有列出 Segoe UI粗体。 -
刚刚发现了同样的事情。有bug贴出:issue 139857,issue 124504
标签: css fonts embed font-face typography