简体   繁体   English

Firefox中的@ font-face垂直对齐问题

[英]@font-face vertical align issue in firefox

Hi i have an issue with font which is rendering as like having a margin at the top and same font is working fine in all other browsers (I have tested in windows and ubuntu). 嗨,我遇到了一个字体渲染问题,就像在顶部有一个空白,并且相同的字体在所有其他浏览器中都可以正常工作(我已经在Windows和ubuntu中进行了测试)。

My problem seems to be like 我的问题似乎是

在此处输入图片说明

And in other browsers 在其他浏览器中

在此处输入图片说明

I have used font squirrel for generating font-face and here is the code that it has generated 我已经使用字体松鼠来生成字体,这是它生成的代码

@font-face {
    font-family: 'garrisons';
    src:url('../fonts/garrisons-regular-webfont.ttf');
    src: url('../fonts/garrisons-regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/garrisons-regular-webfont.woff') format('woff'),
         url('../fonts/garrisons-regular-webfont.ttf') format('truetype'),
         url('../fonts/garrisons-regular-webfont.svg#garrison_sansregular') format('svg');
    font-weight: normal;
    line-height:30px;
}


@font-face {
    font-family: 'garrisonsb';
    src: url('../fonts/garrisons-bold-webfont.ttf');
    src: url('../fonts/garrisons-bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/garrisons-bold-webfont.woff') format('woff'),
         url('../fonts/garrisons-bold-webfont.ttf') format('truetype'),
         url('../fonts/garrisons-bold-webfont.svg#garrison_sansbold') format('svg');
    font-weight: normal;
    line-height:30px;
}

What may be the possible solution for this? 对此可能有什么解决方案? Thanks in advance. 提前致谢。

Those different font formats you provided render differently in different browsers. 您提供的那些不同的字体格式在不同的浏览器中呈现的方式也不同。 For example, IE supports .eot whereas Chrome supports .ttf . 例如,IE支持.eot,而Chrome支持.ttf。 The difference between browsers means that you will have to find a happy medium when it comes to providing solution for different browser variations. 浏览器之间的差异意味着,在为不同的浏览器版本提供解决方案时,您将不得不找到一个快乐的媒介。

So maybe add more of a bottom margin so it doesn't look foolish on one type of browser. 因此,也许增加更多的底部边距,以使它在一种浏览器上看起来并不愚蠢。 Its an inexact process, but whatever result you think works best for all browsers is often the best route of action. 这是一个不精确的过程,但是您认为对所有浏览器都效果最好的任何结果通常都是最佳的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM