0

In my rails 3.2 app I have my font assets that don't always show up on page load (see screenshots). Sometimes it does...

If I open my Chrome developer tools or if I open a modal box, the fonts re-appear.

This happens both in development and in production (precompiled assets).

Is there any way to debug to find the source of the problem?

Also this problem appeared recently and suddenly. I checked my changes these past months, but I can't find anything related.

fonts assets not loading

after opening a pop up

and in my Javascript Chrome developer console (don't mind the weibo error, I had this issue before I added Weibo scripts).

enter image description here

EDIT: Also when I hover over a zone where I know I have my font (like fontawesome) it will make the icon re-appear.

EDIT2: My fonts are stored in assets/stylesheets/fonts enter image description here

I have a css for each webfont.

For Susa (susa.css) I have the following CSS

@font-face {
   font-family: 'SusaRegular';
   src: url('fonts/susa.eot');
   src: url('fonts/susa.eot?#iefix') format('embedded-opentype'),
        url('fonts/susa.woff') format('woff'),
        url('fonts/susa.ttf') format('truetype');
}

EDIT 3: We tried reloading a bunch of times on Safari (OSX) and IE10 (Windows 8) and there aren't any problems. But with Chrome v33 (OSX and Windows 8) the problem occurs often. Maybe the issue is related to Chrome?

Zedrian
  • 909
  • 9
  • 29
  • 1
    FYI the `event.returnValue is deprecated` error in the Chrome dev console is unrelated. It's just Chrome saying they've deprecated a backwards-compatibility IE fix using the return value, and shouldn't affect your code. See more details [here](http://stackoverflow.com/questions/20045162/event-returnvalue-is-deprecated-please-use-the-standard-event-preventdefault) – hunteros Mar 11 '14 at 05:27
  • Yes I have always had this warning. I'm just showing the console to state that I have no errors related to my disappearing assets. – Zedrian Mar 11 '14 at 05:29
  • 1
    Hello, how did you use your custom fonts? You use a *.otf file in your `assets/fonts`? – ifyouseewendy Mar 11 '14 at 07:10
  • 1
    I updated my question with the way the fonts are organised. The fonts do work as explained in the example above and they do exist on page load. They "sometimes" are invisible when you first load the page, and if you mouse over or launch modal they become visible. Very strange – Zedrian Mar 11 '14 at 07:21
  • 1
    i remembered it happened to me with my rails 3.2.2 application, but only in dev, whereas in production environment the problem disappeared and still dunno why. Now i switched to rails 4 and this problem seems to be disappeared so i can't really help, just to say this is not the only case. – sissy Mar 11 '14 at 08:25
  • Thank you @sissy it is good to know that others might have the same problem. In production I have the same problem. The rails app is 3.2.16 but I remember the problem was there in 3.2.8. I am considering upgrading to rails 4, but that would mean to update a lot of things. – Zedrian Mar 11 '14 at 08:31
  • Yea i know it can be a big and painful change... and i also know it's such a frustrating issue! sorry there seem to be no other solution... But as they're saying here http://stackoverflow.com/questions/12124025/image-disappears-after-page-finished-load, i remember that changing image name was like forcing rails to send the image. It's not a solution anyway.. :( – sissy Mar 11 '14 at 08:38

0 Answers0