Don't run Javascript function until custom font downloaded?
<p>Is there a way to not run a Javascript function until after a custom css font resource is downloaded.</p>

<p>I am displaying code in a &lt;pre> and using the custom downloaded font Liberation Mono.  The &lt;pre> is also using custom scrollbars.  The custom scrollbars Javascript (flexcroll) needs a static width set when setting up.  But I can't know the width until the Liberation Mono font is downloaded.</p>

<p>The CSS to load the font is below (complete with smilie-face syntax):</p>

<pre><code>@font-face {
  font-family: 'LiberationMonoRegular';
  src: url('liberationmono-regular.eot');
  src: local('☺'),
    url('liberationmono-regular.woff') format('woff'),
    url('liberationmono-regular.ttf') format('truetype'),
    url('liberationmono-regular.svg#webfontkIKtf5pm') format('svg');
  font-weight: normal;
  font-style: normal;
}
</code></pre>

<p>The Javascript function I would like to do is something like the following.  I'm taking a shot in the dark, and really don't think this is possible..</p>

<pre><code>$(function() {
    waitForFontExists('LiberationMonoRegular', function() {
        &lt;do something&gt;
    });
});
</code></pre>
