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

specify fontFamily to filter fonts #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 ;

@@ -135,6 +135,8 @@
}

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