jquery - Don't run Javascript function until custom font downloaded? -


There is no way to run a JavaScript function until a custom CSS font resource is downloaded.

I get the code to be & lt; I'm displaying in pre> and using custom downloaded font liberation mono. & Lt; Pre using Custom Scrollbar Custom Scrollbar requires a fixed width set when setting up JavaScript (Flexol). But I can not know the width until the liberation mono font is downloaded.

CSS is loaded to load the font (complete with smile syntax):

  @ font-face {font-family: 'Liberation Mono Regelerator'; 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; }  

I want to do the JavaScript function something like the following. I'm taking a shot in the dark, and in fact it does not think that it is possible.

  $ (function () {waitForFontExists ('Liberation Mono Regular', function) (& lt ; Do some and gt;});}); Google Project allows you to work with various web font providers, and callback is included in it.  Font loading  and  Factives . It can help with the font sources based on your flexibility I have not used it, but the state of the docs: 

In addition to Google and TypeKit options, there is also a custom module which The web-font provider can load the stylesheet. / P>

In addition, there is a lot to check the width of a sample presentation in the target font.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -