我在 IE11 中遇到一个问题,当在本地安装字体的计算机上显示字体 Open Sans 时,与从网站提取字体作为 webfont 的计算机相比,字体显示更粗。
这发生在使用 Google 字体 Open Sans 的内部网站上。字体文件和 CSS 已下载并直接包含在应用程序中,因为它需要离线功能(因此它不会从 Google 的服务器中提取)。
我通过从我的计算机上卸载 Open Sans 发现了这个问题并注意到它正常显示,但如果它安装在我的计算机上,它会更厚。需要明确的是,它不仅仅是显示粗体字体,因为我仍然可以更改字体粗细,它仍然会变得更加粗体。此外,这只发生在 IE11 中,无论情况如何,在 Chrome 中都可以正常工作。查看 Chrome 中呈现的字体显示使用了正确的权重。不过我不知道如何在 IE 中检查它。
这是用于在网站中包含字体的 CSS:
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans Regular'), local('OpenSans-Regular'), url(fonts/OpenSans-Regular.woff2?v=1.5.0) format('woff2'), url(#{$assets-path}fonts/OpenSans-Regular.woff?v=1.5.0) format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'), url(fonts/OpenSans-SemiBold.woff2?v=1.5.0) format('woff2'), url(#{$assets-path}fonts/OpenSans-SemiBold.woff?v=1.5.0) format('woff');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 700;
src: local('Open Sans Bold'), local('OpenSans-Bold'), url(fonts/OpenSans-Bold.woff2?v=1.5.0) format('woff2'), url(#{$assets-path}fonts/OpenSans-Bold.woff?v=1.5.0) format('woff');
}
下面是电脑上安装IE时字体的截图:
这是未安装字体时的截图:
最佳答案
我最终删除了对字体本地副本的引用,通过从每种字体中删除以下代码,迫使网站使用下载的副本:
local('Open Sans SemiBold'), local('OpenSans-SemiBold')
关于css - 在 IE11 中使用安装的字体与 webfont 时打开 Sans 字体更粗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49613974/