2011-05-06 93 views
0

我使用@font-face来启用自定义字体。它适用于Firefox,IE,Safari和Mac上的Chrome。在使用Chrome的Windows 7上,10px的文字看起来不是黑色或灰色! ...经过更多测试:与Firefox(Windows)和Safari(Windows)相同的问题@ Windows 7中的font-face渲染

也许它与Windows ClearType呈现有关。但为什么它在Internet Explorer中工作?

直接链接到页面:http://www.light-work.de/chrome.html

It's真奇怪!只有10px字体大小(我需要的大小)才会出现问题。在light-work.de/webfontkit/下,您可以看到样本概览。

一个更大的屏幕截图:http://light-work.de/styles/02.png

<!DOCTYPE HTML> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>google chrome</title> 
<style> 
/* Generated by Font Squirrel */ 
@font-face { 
    font-family: 'M10Regular'; 
    src: url('http://light-work.de/styles/m10/m10-webfont.eot'); 
    src: url('http://light-work.de/styles/m10/m10-webfont.eot?#iefix') format('embedded-opentype'), 
     url('http://light-work.de/styles/m10/m10-webfont.woff') format('woff'), 
     url('http://light-work.de/styles/m10/m10-webfont.ttf') format('truetype'), 
     url('http://light-work.de/styles/m10/m10-webfont.svg#M10Regular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 

} 


body { 
    font-family: 'M10Regular'; 
    line-height: 20px; 
    font-size: 10px; 
    color:#666666; 
} 


</style> 
</head> 
<body> 
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. 
</body> 
</html> 
+0

如果你想要一个跨浏览器的兼容性,你总是可以使用谷歌字体http://www.google.com/webfonts – denislexic 2011-05-06 11:46:47

+0

首先你应该尝试在这种情况下,正在验证你的html:http:// validator。 w3.org/ – AllisonC 2011-05-06 12:23:39

回答

0

您的示例网页呈现为灰色(#666666,其实)我有Chrome的v11.0.696.60在64位Windows 7

在不文本右击看起来是正确的,你可以调出上下文菜单。从中点击Inspect element。这将打开开发人员工具。他们会帮助你理清你的问题。这是我看到

Screenshot of test page in Chrome, with developer tools open

正如你所看到的,铬是根据您指定的风格渲染你的页面。

+0

谢谢你,一个伟大的工具!经过一些测试后,Firefox 4.01(WIN),Safari 5.05(WIN)和Chrome 11.0.696.60(WIN)出现问题。我会在更多的计算机上测试这个页面,但是你有什么想法可以解决这个问题吗?谢谢。 – opentype 2011-05-06 18:08:04

+0

我已经在其他机器上测试过该网站,它正在工作。感谢您的帮助! – opentype 2011-05-08 13:29:35

0

嗯,你的文字是不是在body标签。所以你的风格不应该被应用(这显然不是在Chrome中)。问题应该是:为什么所有其他浏览器都在关注你的字体设置? :-)

+0

哦,我很抱歉,错误!不幸的是,我仍然在Google Chrome中看到了错误的颜色。 – opentype 2011-05-06 15:00:52

+0

因为浏览器试图容纳无效标记。每个浏览器都试图将它插入一个有效的结构中来解释这种无效标记。 – 2011-05-06 17:39:18