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

Label resizing with dynamically loaded fonts #255

Closed
tomzx opened this issue Nov 12, 2015 · 3 comments
Closed

Label resizing with dynamically loaded fonts #255

tomzx opened this issue Nov 12, 2015 · 3 comments

Comments

@tomzx
Copy link

tomzx commented Nov 12, 2015

Hi,

This is more of a heads up than an actual issue (and this is probably more related to how dagre renders labels, but this may be of interest for mermaid), but if you use dynamically loaded fonts that are loaded through CSS, such as Google fonts, mermaid should wait for the whole page to have been loaded (dom + assets, particularly the font files).

Thus, developers that integrate mermaid into their own page should use

$(window).load(function() {
    mermaid.initialize();
});

over

$(document).ready(function() {
    mermaid.initialize();
});

Not doing so will most likely result in mermaid rendering graphs that have labels out of bounds.

Using ready
2015-11-11_20-43-54

Using load
2015-11-11_20-43-38

@knsv
Copy link
Collaborator

knsv commented Nov 12, 2015

Thanks @tomzx. That's a good point. I think this should be pointed out in the docs.

Also I think the domContentLoaded used by mermaid should be changed to loadEvent.

So good input, thanks.

@knsv knsv added the Fixed label Nov 15, 2015
@knsv
Copy link
Collaborator

knsv commented Nov 15, 2015

Using the load event in mermaid now. Not yet released though.

@knsv
Copy link
Collaborator

knsv commented Nov 22, 2015

Closing issue as it's resolution is included in release 0.5.6. Let me know if you do not agree.

@knsv knsv closed this as completed Nov 22, 2015
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

2 participants