Skip to content

Conversation

@NotsayJustdo
Copy link

Hi, if many fonts in stylesheets, dom-to-image will download all fonts, it will cause some problems: 1. waiting long time to load all fonts 2. use large computer memories, maybe make the browser breakdown. I suggest to add fontFamily option for user, user can specify they use fontFamily, it will avoid that problems!

if many fonts in stylesheets, dom-to-image will download all fonts, it will cause some problems: 1. waiting long time to load all fonts  2. use large computer memories, maybe make the browser breakdown. I suggest to add fontFamily option for user, user can specify they use fontFamily, it will avoid that problems!
Copy link

@IDisposable IDisposable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting fix, but a breaking change as it will not add a rule that sets multiple properties and a font-face... so some styling that might be applied/overridden will be lost.

for (let i = 0; domtoimage.impl.options.fontFamily[i]; i++) {
if (rule.cssText.indexOf(domtoimage.impl.options.fontFamily[i]) !== -1) {
flag = true
break

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick code style of this repository requires trailing ;


function copyOptions(options) {
// get user specifiy fontFamily
domtoimage.impl.options.fontFamily = options.fontFamily || []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should alias this to a local var to reduce double-dotting

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

Successfully merging this pull request may close these issues.

2 participants