-
Notifications
You must be signed in to change notification settings - Fork 256
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
Load all fonts before rendering #660
Conversation
Whether or not the used fonts have been loaded, affects the layout of the boxes that Mermaid renders. For consistent results, fonts must be loaded before the diagrams are rendered. Closes mermaid-js#539
Thank you! LGTM :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! That bug has been bugging me for a while :)
This was taken from mermaid-isomorphic. You may want to leverage that package instead.
Unfortunately, I don't think that would be possible, since that library uses Playwright instead of Puppeteer.
Although, it would be cool if there was some way of making something like a @mermaid-js/mermaid-isomorphic-puppeteer
library that shared all of the same code as the mermaid-isomorphic package, with the exception of playwright, but that might get pretty convoluted.
Another factor that causes similar issues is the use of a default font that’s not available everywhere. IIRC it’s helvetica? To solve that, I don’t know how much more work it would be to support Puppeteer in |
Close, it's If I have time, I might make a PR to @mermaid-js to change the official font to something like
Probably quite a bit from an infrastructure standpoint, unfortunately :(. There needs to be two different packages with different
I know what you mean. I can't wait until https://github.com/servo/servo (or another browser engine) is advanced enough that we no longer need puppeteer/playwright! |
The test fixtures for |
📑 Summary
Whether or not the used fonts have been loaded, affects the layout of the boxes that Mermaid renders. For consistent results, fonts must be loaded before the diagrams are rendered.
This was taken from
mermaid-isomorphic
. You may want to leverage that package instead.Resolves #539
📏 Design Decisions
This preloads all fonts in the document.
📋 Tasks
Make sure you
master
branch