Font-face shifting out of place in Google Chrome - css

I know there are browser rendering inconsistencies between Chrome and Firefox (Windows, both). But I am seeing a weird bug involving #font-face & gooogle-fonts shifting the font down about 10px in Chrome.
Here is an image to illustrate the problem. I have highlighted the text so that you can see the shift:
Here is the CSS for clarity:
.primary-menu li a,
.primary-menu li a:visited {
display: block;
text-decoration: none;
text-transform: uppercase;
color: white;
font-family: 'Oswald', sans-serif;
font-weight: 700;
padding-right: 0;
transition: padding-right .5s;
}
I am using Google Fonts for the Oswald type face:
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Open+Sans:400,700|Oswald:400,700' type='text/css'>
I am using a CSS reset, so most properties are set to a default value. I have tried fiddling with the CSS to see if I can analyse why it is shifting, but I can not see an effect other than turning off the font-face.
Here is the source site for reference. Concept Design Ltd
Any knowledge on why this is happening would be fantastic.
Many thanks,
Neil

I recently had the same problem, but my font was NOT locally installed. (By the way, that would be a problem in web design, as you cant control the installed fonts on pageviewer´s computer).
The problem only occurred in Chrome 26 on Windows, and later in Firefox 19 for Windows but not on any other browser (neither Windows nor Mac OS x).
I finally found out that Chrome/Win would only render SVG Font correctly and Firefox took WOFF unhinted.
So I dirty-fixed the uncorrectly-rendered down-shifting with this-like CSS-code
/* for all browsers */
#font-face {
font-family: 'myfont';
src: url('myfont.eot');
src: url('myfont?#iefix') format('embedded-opentype'),
url('myfont.woff') format('woff'),
url('myfont.ttf') format('truetype'),
url('myfont.svg#wf') format('svg');
}
/* for all webkit-browsers (Chrome, Safari and newly Opera */
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {
font-family: 'myfont';
src: url('myfont.svg#wf') format('svg');
}
}
/* for all mozilla-browsers (Firefox) */
#-moz-document url-prefix() {
#font-face {
font-family: 'myfont';
src: url('myfont_unhinted.woff') format('woff');
}
}
Hope this helps anyone.

I was having the same issue, but in FireFox - I removed the Oswald fonts I had in my font directory on my computer and it fixed the issue. Maybe give that a go?

Related

font-face works in desktop Chrome & desktop Firefox but not in desktop Safari nor iOS browsers

My font-face is working properly on:
Desktop Chrome
Desktop Firefox
The same font-face call is NOT working on:
Desktop Safari
iOS Chrome
iOS Firefox
iOS Safari
You can see the landing page with the font-family call for the site/company name here: Derek Erb Solutions
The font-family declaration:
#font-face {
font-family: 'Dce_handwriting';
src: url('/fonts/DceHandwritingRegular.woff') format('woff'),
url('/fonts/DceHandwritingRegular.ttf') format('truetype'),
url('/fonts/DceHandwritingRegular.otf') format('opentype'),
font-weight: normal;
font-style: normal;
font-display: fallback;
}
The font-family call:
#sitename {
font-family: Dce_handwriting, sans-serif;
font-size: 6em;
margin: 0 auto;
}
Looking around at similar problems here I made sure to remove the dashes and underscores from the file name and include the "src:" in the font-family declaration.
I have probably been looking too long at my own code to see the problem any more... but it is particularly frustrating.
As always the biggest part of the problem was a stupid semi-colon!
That last line should read:
url('/fonts/DceHandwritingRegular.otf') format('opentype');
With the all important semi-colon at the end of the line instead of the comma.
This fixed the problem on just about all of the browsers...

Google Webfont shows up bolder and choppier in Safari than in Chrome, IE and Firefox

I seem to have a problem the other way round some people have here.
Here is the deal. http://www.mb-events.de/wordpress/ renders wonderfully on IE, Chrome and Firefox. However on Safari information like price and testimonials are displayed differently and I just can't find out why. The Google Webfont I use for that is 'Cabin'. I would post a side-by-side comparision, but can't due to being new.
I tried setting different fallback fonts and searched wether Safari does not like Google Webfonts in general.
My CSS is
.entry, .entry p {
font: 300 15px/1.5em 'Cabin', arial, sans-serif;
}
Did you try moving the stacking order of the web font your calling. I've always found that adding the svg type to the top of the stack always helps maintain the readability.
As an example:
#font-face {
font-family: 'encode_widelight';
src: url('encode-sans/encodesanswide-300-light.eot');
src: url('encode-sans/encodesanswide-300-light.eot?#iefix') format('embedded-opentype'),
url('encode-sans/encodesanswide-300-light.svg#encode_sans_widelight') format('svg'), /* Place your svg font here */
url('encode-sans/encodesanswide-300-light.woff') format('woff'),
url('encode-sans/encodesanswide-300-light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
You could also try adding font smoothing to your css:
html {
-webkit-font-smoothing: antialiased;
}

Font rendering and :before in firefox

Hello stackoverflowers,
I have built a site that looks great in Chrome and FF (but only in local server). When uploaded, chrome does a great job and looks great. FF does not render the #font-face font..cant figure out why. Using Foundation 3.
SASS:
#font-face {
font-family: 'oswald';
src: url('/stylesheets/font/oswald/oswald-webfont.eot');
src: url('/stylesheets/font/oswald/oswald-webfont.eot?#iefix') format('embedded-opentype'),
url('/stylesheets/font/oswald/oswald-webfont.woff') format('woff'),
url('/stylesheets/font/oswald/oswald-webfont.ttf') format('truetype'),
url('/stylesheets/font/oswald/oswald-webfont.svg#oswaldregular') format('svg');
font-weight: lighter;
font-style: lighter;
}
$headerFontFamily: "oswald", Helvetica, Arial, sans-serif;
In the footer, there are some social links. these have icons using the a:before pseudo selector. Again, fine in chrome but no go in firefox. I have checked the code letter by letter and cant see any typos....but then it is getting late. This one is strange as one of the links is fine, just not the first two:
css:
li:nth-of-type(1) a:before { content: url('../images/watch-trailer.png'); }
li:nth-of-type(2) a:before { content: url('../images/rating.png'); }
li:nth-of-type(3) a:before { content: url('../images/book-seats.png'); }
li:nth-of-type(1) a:hover:before { content: url('../images/watch-trailer-active.png'); }
li:nth-of-type(2) a:hover:before { content: url('../images/rating-active.png'); }
li:nth-of-type(3) a:hover:before { content: url('../images/book-seats-active.png');
}
http://schwack.madmantis.co.uk/
Any help with these two questions please.
On a side note, the page does have some problems in ie (such as slider content missing, movie thumb overlay not going transparent and probably a few others) I am not in a big hurry to fix these but would be nice if someone happened to have a fix for them. Silly IE getting in the way of progress.
It seems that your server is wrongly configured and can't handle font files (woff, svg, eot, ttf).
The server returns a 500 Internal Server Error.
http://schwack.madmantis.co.uk/stylesheets/font/Oswald/oswald-webfont.woff
http://schwack.madmantis.co.uk/stylesheets/font/Oswald/oswald-webfont.ttf
Update
It seems that the fonts are available under (all lowercase) http://schwack.madmantis.co.uk/stylesheets/font/oswald/oswald-webfont.{format}
Change your styles.css with the following font definition:
#font-face {
font-family: 'oswald';
src: url("/stylesheets/font/oswald/oswald-webfont.eot");
src: url("/stylesheets/font/oswald/oswald-webfont.eot?#iefix") format("embedded-opentype"), url("/stylesheets/font/oswald/oswald-webfont.woff") format("woff"), url("/stylesheets/font/Oswald/oswald-webfont.ttf") format("truetype"), url("/stylesheets/font/Oswald/oswald-webfont.svg#oswaldregular") format("svg");
font-weight: lighter;
font-style: lighter;
}

OTF Web Font renders wrong in Webkit/Chrome on Windows

Anyone come across with this issue?
Windows 7 Chrome web font OTF issue:
I have a web font and adding it with css3...Looks great in FF/IE(or takes the backup)/Safari but in Chrome(Windows) it looks pretty awful:
I tried this: -webkit-font-smoothing: antialiased;
...Which fixes it in Safari but not Chrome and saw here that Mac should work:
Does -webkit-font-smoothing only work on Mac browsers, Not windows?
I checked this too: http://maxvoltar.com/archive/-webkit-font-smoothing
Here is what i have:
#font-face { font-family: SeravekBasic; src: url('/fonts/SeravekBasic-Regular.otf'); font-weight: normal; font-style: normal; -webkit-font-smoothing: antialiased;}
html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;}
html, button, input, select, textarea {font-family: SeravekBasic, Arial, Helvetica, sans-serif; color: #000; }
Lastly I tried Mozillas text-rendering see if this would help webkit but nothing:
https://developer.mozilla.org/en-US/docs/CSS/text-rendering
....Not sure if there is something else that can resolve this.
I wouldn't recommend using OTF for webfonts. It causes some rendering issues for people using Windows XP. You're going to have to use a bulletproof font-face syntax with a media query specifying SVG for chrome.
An example for PT Sans
#font-face {
font-family: "PT Sans";
src: url("ptsans.eot");
src: url("ptsans.eot?#iefix") format("embedded-opentype"),
url("ptsans.woff") format("woff"),
url("ptsans.ttf") format("truetype"),
url("ptsans.svg") format("svg");
font-weight: normal;
font-style: normal
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {
font-family: "PT Sans";
src: url("ptsans.svg") format("svg")
}
}
Chrome uses an older font rendering system, so it doesn't show fonts as clearly. Chrome fonts look best with SVG so you have to specify a media query to serve only Chrome the SVG file. You can find more information on the syntax here: http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax.
You should include ttf, eot, woff, and svg formats in your #font-face syntax. The browser won't download each one, it will only download the one it needs. It also adds appropriate fallback. This should solve most of your font rendering issues.You can get the appropriate files for your #font-face rule by using the fontsquirrel generator: http://www.fontsquirrel.com/tools/webfont-generator.
So my solution was to convert this to embedded Open Type:
.eot and also add .woff for other browser support.
This is actually great because it works fine in IE9 (even IE8)
:)
src: url('/fonts/SeravekBasic-Regular.eot');
src: url('/fonts/SeravekBasic-Regular.eot?#iefix') format('embedded-opentype'),
url('/fonts/SeravekBasic-Regular.woff') format('woff');

#font-face with multiple font-size css declarations slow Firefox to a crawl

CSS:
#font-face {
font-family: Gabriola;
font-weight: normal;
font-style: normal;
src: local("Gabriola Regular"), local("Gabriola"),
url("Gabriola.eot"), /* IE 5+ */
url('Gabriola.woff') format('woff'), /* FF 3.6, Chrome 5, IE9 */
url('Gabriola.ttf') format('truetype'), /* Opera, Safari */
url('Gabriola.svg#Gabriola') format('svg'); /* iOS */
}
body {
font-family: Gabriola, sans-serif;
font-size: 1.3em;
}
.wine_name { font-size:2em; }
.price { font-size:2.6em; color:#CCC; }
.sugar { font-size:2em; color:#980000; }
br { page-break-after: always; }
The page displays quickly because I have Gabriola already installed. When I remove the local() references, the file downloads...but Firefox freezes for around 20 seconds before finally rendering the page. This is because of the multiple font-size declarations. When I remove them, it renders fast whether or not I specify local() sources. Has anyone else had this issue?
Perhaps I'm impatient but I seem to be answering my own questions a lot lately :S
Turns out there's either A) something wrong with the font file itself and/or B) Firefox isn't good at parsing certain types of fonts...
I downloaded a different script font (akaDora) and tested it...it works just fine. No lag. No delay. Now of course I'm tasked with finding font-face files for Gabriola that don't make Firefox barf. Anyone know of them? I got both fonts tested from http://www.fonts2u.com/.

Resources