2011-05-06 29 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