Why do web fonts render differently between browsers, and what steps can be taken to fix the issue?
I'm having some issues with cross browser web font issues. I am absolutely positioning spans with single characters within them. Between browsers, the characters seem to be positioned the same relative to each other (within a few pixels).
However in IE, the grouping of characters is way off in relation to the rest of the flow of the document. The behavior when the characters are highlighted seems dramatically different in IE as well.
Does this have to do with font metrics? All 3 browsers are being rendered with a WOFF font.
Rendered in Chrome:
Rendered in Firefox:
Rendered in Internet Explorer:
Here is a snippet of the code:
<div style="border: 3px #000 solid; padding: 0px; line-height: 1; position: relative; width: 85.75px; height: 80px; font-size: 80px;">
<span class="MathJax_Main" style="position: absolute; left: 0; top: 0;">3</span>
<span class="MathJax_MathItalic" style="position: absolute; left: 40px; top: 0;">x</span>
</div>
Here is the CSS used to load the web font:
#font-face {
font-family: 'MathJax_Math';
src: url('woff/MathJax_Math-Italic.woff') format('woff'),
url('svg/MathJax_Math-Italic.svg#MathJax_Math') format('svg');
font-style: italic;
font-weight: normal;
}
#font-face {
font-family: 'MathJax_Main';
src: url('woff/MathJax_Main-Regular.woff') format('woff'),
url('svg/MathJax_Main-Regular.svg#MathJax_Main') format('svg');
font-weight: normal;
}
.MathJax_MathItalic {
font-family: 'MathJax_Math';
font-style: italic;
}
.MathJax_Main {
font-family: 'MathJax_Main';
}
Related
I've been struggling with an issue for days now. I have a webfont kit from fontsquirrel. IE9 won't load the fonts when I load the containing webpage in an iframe. Weirdly enough, when I load the page in the browser itself, it does work. No errors in F12 developer tools.
The code:
<style type="text/css">
html, body {
margin: 0;
padding: 0 0 1em 0;
width: 100%;
height: 100%;
/*overflow-x: hidden;
overflow-y: auto;*/
overflow: hidden;
position: relative;
}
#font-face {
font-family: 'bebas_neueregular';
src: url('build/img/BebasNeue-webfont.eot?');
src: url('build/img/BebasNeue-webfont.eot?#iefix') format('embedded-opentype'),
url('build/img/BebasNeue-webfont.woff') format('woff'),
url('build/img/BebasNeue-webfont.ttf') format('truetype'),
url('build/img/BebasNeue-webfont.svg#bebas_neueregular') format('svg');
font-weight: normal;
font-style: normal;
}
</style>
I have a problem with my icomoon font in Chrome with that icons are sometimes not shown. I don't get the font-missing empty rectangle "fallback".
When I select the element with an icon it will appear, so a repaint will fix it. But forcing a repaint is a terrible solution...
The only solution I find regarding buggy iconfonts in Chrome is to use PUA codes, but I already do that.
My CSS for icons:
.icon-back-in-time-mirror:before {
content: "\e613";
}
.icon {
position: relative;
}
.icon:before {
position: absolute;
height: 22px;
margin: -11px 0 0;
top: 50%;
left: 0;
font-family: 'icomoon';
font-weight: 400;
line-height: 22px;
display: block;
speak: none;
}
The #font-face rules
#font-face {
font-family: 'icomoon';
src:url('/gui/css/fonts/icomoon.eot?-cpkbjx');
src:url('/gui/css/fonts/icomoon.eot?#iefix-cpkbjx') format('embedded-opentype'),
url('/gui/css/fonts/icomoon.woff?-cpkbjx') format('woff'),
url('/gui/css/fonts/icomoon.ttf?-cpkbjx') format('truetype'),
url('/gui/css/fonts/icomoon.svg?-cpkbjx#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
I used the #font-face this way
#font-face {
font-family: 'SteelTongs';
src: url('../fonts/SteelTongs.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
section.page_heading .logo a {
font-size: 40px;
font-family: 'SteelTongs';
text-shadow: 0px 2px rgba(0,0,0,0.36);
color: #fff;
text-decoration: none;
float: left;
margin-right: 25px;
Now, what happens is the sample text normally in .ttf file shows in the logo container
Edit:
See http://www.had.omarsalim.biz
Here is a screen shot:
Notice the Header
Please help
I tested in chrome and firefox
I'm also tested with the SteelTongs web font in firefox and chrome, it is not supported,the font link is
abstractfonts- steeltongs ,U just change the font.
I have two font face styles in my css, both are identical, but only one doesnt work in firefox? i have tried changing the speech marks, adding a local version, changing the files root, and urls, and various other things, i just cant understand why one would work and the other wouldnt, here is my code:
#font-face {
font-family: 'AlienLeague';
src: url('fonts/alien5.eot');
src: url('fonts/alien5.eot?#iefix') format('embedded-opentype'),
url('fonts/alien5.woff') format('woff'),
url('fonts/alien5.ttf') format('truetype'),
url('fonts/alien5.svg#alien5') format('svg');
font-weight: normal;
font-style: normal;
}
#title {
width: auto;
font-family: "AlienLeague", sans-serif;
font-size: 34px;
color: #fff;
float: left;
margin: 0px 40px 0px 40px;
}
I used font squirrel so please dont mention that and heres a link: http://aawilson.co.uk/assign1/ (its the top left heading "space and beyond")
Thanks in advance.
I have an inline heading (h1) with a background-color on the heading, but on Mac OS in both safari and Firefox it does not seem to stretch around the font. With a websafe font it works fine. Line height is set according to the font-size.
Any suggestions?
See visual expamle:
http://www.flickr.com/photos/hegerokenes/5038724235/
#font-face {
font-family: 'FedraMonoStd-Medium';
src: url('fonts/fedramonostd-medium-webfont.eot');
src: local('☺'), url('fonts/fedramonostd-medium-webfont.woff') format('woff'), url('fonts/fedramonostd-medium-webfont.ttf') format('truetype'), url('fonts/fedramonostd-medium-webfont.svg#webfontNCPrZ83i') format('svg');
font-weight: normal;
font-style: normal;
}
h1 {
font-size: 22px;
background-color: #999895;
line-height: 38px;
display: inline;
color: #fff;
padding: 3px;
}
try a little more padding, this should work without messing up the line-height. say
padding: 12px 3px 3px 3px;
at least it did with the font i was using...
Try floating left or display:inline-block instead, so it can be "blocky".