2012-05-16 21 views
4

我刚刚拉起了一个项目,我正在对其进行一些修改,并注意到正在通过@font-face提供的声明font-weight: lighter,并且它不再在网站上工作(请参阅图像 - 顶部铬,底部ff)。昨天晚上我的系统(Windows)没有任何改变,今天酒吧被升级到Chrome 19.0.1084.46,我认为这是问题,但我想知道是否有其他人注意到了这一点,或者如果有修复?Chrome 19无法识别字体重量:打火机

Chrome vs FF font-weight: lighter

谢谢。

+0

我发现一般情况下,基本以外的fontweights通常会被浏览器以不同的方式解释。你的font-face CSS是否指定了字体的权重? – Damon

+0

以前我从来没有打扰,但我认为它的东西,我将从现在开始作为@digitalbiscuits也建议 – Michael

回答

5

尝试使用数字代替相对项lighter。例如:font-weight:100将是最轻的。

有关于相对和绝对字体权重这里方便的文章: http://webdesign.about.com/od/fonts/qt/aa031807.htm

+0

这实际上做了一个诡计,有点奇怪,它停止工作的方式,但我认为你是对的,它的好做法是使用不同重量的数字,从现在开始我会这样做,谢谢! – Michael

+0

没问题的人。 –

+0

我发现使用数字来指定重量因浏览器而异(我自己使用的浏览器和浏览器之间的截断点不是标准化的跨浏览器),并且已停止设置权重。 – Damon

0

如果您正在使用的字体面对面的字体有多种样式(如你should)确保每个变体特别依赖于一个字体权重,这样每个变体都有自己的显式文件。否则,它有点像浏览器来完成它想做的事情。我发现从字体松鼠自动生成的代码不这样做(虽然也许他们已经更新了它们的包装)

请注意在下面的代码中,每个文件如何显式设置font-weight和font-style 。这没有留下猜测的余地。

@font-face { 
    font-family: 'CaviarDreams'; 
    src: url('fonts/CaviarDreamsItalic-webfont.eot'); 
    src: url('fonts/CaviarDreamsItalic-webfont.eot?#iefix') format('embedded-opentype'), 
     url('fonts/CaviarDreamsItalic-webfont.woff') format('woff'), 
     url('fonts/CaviarDreamsItalic-webfont.ttf') format('truetype'), 
     url('fonts/CaviarDreamsItalic-webfont.svg#CaviarDreamsItalic') format('svg'); 
    font-weight: normal; 
    font-style: italic; 

} 

@font-face { 
    font-family: 'CaviarDreams'; 
    src: url('fonts/CaviarDreams_BoldItalic-webfont.eot'); 
    src: url('fonts/CaviarDreams_BoldItalic-webfont.eot?#iefix') format('embedded-opentype'), 
     url('fonts/CaviarDreams_BoldItalic-webfont.woff') format('woff'), 
     url('fonts/CaviarDreams_BoldItalic-webfont.ttf') format('truetype'), 
     url('fonts/CaviarDreams_BoldItalic-webfont.svg#CaviarDreamsBoldItalic') format('svg'); 
    font-weight: bold; 
    font-style: italic; 

} 

@font-face { 
    font-family: 'CaviarDreams'; 
    src: url('fonts/CaviarDreams-webfont.eot'); 
    src: url('fonts/CaviarDreams-webfont.eot?#iefix') format('embedded-opentype'), 
     url('fonts/CaviarDreams-webfont.woff') format('woff'), 
     url('fonts/CaviarDreams-webfont.ttf') format('truetype'), 
     url('fonts/CaviarDreams-webfont.svg#CaviarDreamsRegular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 

} 

@font-face { 
    font-family: 'CaviarDreams'; 
    src: url('fonts/CaviarDreams_Bold-webfont.eot'); 
    src: url('fonts/CaviarDreams_Bold-webfont.eot?#iefix') format('embedded-opentype'), 
     url('fonts/CaviarDreams_Bold-webfont.woff') format('woff'), 
     url('fonts/CaviarDreams_Bold-webfont.ttf') format('truetype'), 
     url('fonts/CaviarDreams_Bold-webfont.svg#CaviarDreamsBold') format('svg'); 
    font-weight: bold; 
    font-style: normal; 

} 
+1

多数民众赞成我是如何奠定我的字体面出来,这是工作之前,现在使用数字已解决,但我认为这是一个错误铬时试图使用'font-weight:lighter',它只是没有似乎认出了这个电话,并自动假设'font-weight:normal'是更轻的。正如我所说,它以前在以前版本的Chrome中工作,因此我认为这是一个错误。 – Michael