Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@font-face Text is invisible in Chrome on refresh... but not always?

My WordPress site is here: http://pangalactic.co/

When using Chrome, users find that sometimes the text below the logo, and the text relating to the site's pages (to the right of the logo) is invisible to them. If they try refresh in Chrome it remains invisible. If they click the site logo to refresh, however, the text appears again. The relevant @font-face text is below...

@font-face {
font-family: 'BebasNeueRegular';
src: url("fonts/bebas-neue/BebasNeue-webfont.eot");
src: url("fonts/bebas-neue/BebasNeue.otf");
src: url("fonts/bebas-neue/BebasNeue-webfont.eot?#iefix") format("embedded-opentype"),     url("fonts/bebas-neue/BebasNeue-webfont.woff") format("woff"), url("fonts/bebas-    neue/BebasNeue-webfont.ttf") format("truetype"), url("fonts/bebas-neue/BebasNeue-    webfont.svg#BebasNeueRegular") format("svg");
font-weight: normal;
font-style: normal; 
}
like image 556
user3339416 Avatar asked Feb 22 '14 00:02

user3339416


People also ask

Why is my font messed up in Chrome?

Go to Control Panel > Appearance and Personalization > Display > Adjust ClearType text (on the left). Check the box entitled “Turn on ClearType.” After going through a short wizard, this will fix some of the text rendering issues in Chrome. Enable "Disable accelerated 2D Canvas" in Chrome.

How do I stop showing invisible text?

Most browsers will hide texts until the font is loaded completely. This problem is known as flash of invisible text (FOIT). We can prevent it from happening by asking the browser to use the system font while the custom font is still being loaded. Once the font is loaded, it will replace the system font used earlier.

Why is my Google text white?

Under > Text and Background, be sure that they are not the same. Per default, the text is black and the background is white.In Internet Explorer go to > Extras > Internet Options > General tab. Click the button > Colors... at the bottom and check the box > Use Windows colors (or something to that extend).


1 Answers

Using the following hack suggested in the bug report Paul Irish linked to worked for me:

.classes-affected-by-issue
{
    -webkit-animation-duration: 0.1s;
    -webkit-animation-name: fontfix;
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: linear;
    -webkit-animation-delay: 0.1s;
}

@-webkit-keyframes fontfix{
    from{   opacity: 1; }
    to{ opacity: 1; }
}

It forces Chrome to redraw the font which appears to fix the issue.

Keep an eye on the bug report to see when you can remove this code from your production servers.

This issue is closed as of 35.0.1867.2 canary. But keep the code in until your clients are updated to this version.

like image 189
dav_i Avatar answered Oct 19 '22 16:10

dav_i