Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fires before custom font is applied #45

Open
andrewtibbetts opened this issue Nov 19, 2014 · 5 comments
Open

Fires before custom font is applied #45

andrewtibbetts opened this issue Nov 19, 2014 · 5 comments

Comments

@andrewtibbetts
Copy link

I'm having to use jquery.fontspy.js to hold off balancing until my @font-face applies. Otherwise it balances according to default font.

@redmunds
Copy link
Contributor

@andrewtibbetts Yes, waiting for fonts to load is a pain. Do you have a link to your solution that I could look at? If it's not too involved maybe we could integrate it with this polyfill, but at least I'd like to provide info to others that have same problem. Thanks.

@andrewtibbetts
Copy link
Author

I’m using this: https://github.com/patrickmarabeas/jQuery-FontSpy.js https://github.com/patrickmarabeas/jQuery-FontSpy.js

Then call it like so: $('p').fontSpy({ onLoad: 'balance-text' }); when the dom is ready.

@CupOfTea696
Copy link

I don't know about the fontSpy plugin, but I know for TypeKit you can make sure balance-text only gets executed after the font is loaded like this:

var balanceSelector = ':header:not(:has(*)), p:not(:has(*))';
if($('html').is('.wf-active')){
    console.log('balance');
    $(balanceSelector).balanceText();
}else{
    try {
        Typekit.load({
            active: function(){
                console.log('balance');
                $(balanceSelector).balanceText();
            }
        });
    } catch(e) {console.log(e);}
}

Make you can check the fontSpy API for anything similar.

@andrewtibbetts
Copy link
Author

Found a better script: https://github.com/JenniferSimonds/FontDetect

@fregante
Copy link
Contributor

Unfortunately this is not easy to automatically track, the only thing we could do is add a note about it and a suggested solution(s) in the readme. Embedding FontDetect and trying to figure out whether it's needed is probably too much for this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants