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

doesn't support font-family property with multiple value #796

Closed
rayax86 opened this issue Feb 13, 2016 · 8 comments
Closed

doesn't support font-family property with multiple value #796

rayax86 opened this issue Feb 13, 2016 · 8 comments
Labels

Comments

@rayax86
Copy link

rayax86 commented Feb 13, 2016

Using 0.5.0-beta4, thanks so much for this great module!

The problem I am having is, say I have a class
.class { font-family: "somefont", "Arial" }
where "somefont" doesn't apply, the end result is elements that are .class would be rendered using Arial in the page, but in the canvas the default font is applied instead.

Any idea?

@eZ0
Copy link

eZ0 commented Feb 18, 2016

I'm having the same issue.

This is Roboto font, in Google chrome canary
screen shot 2016-02-18 at 15 18 27

This is rendered image
img055

@eZ0
Copy link

eZ0 commented Feb 18, 2016

I found the reason: parent of canvas has to have explicit font declaration like so:
.container { font-family: Roboto, "Helvetica Neue", sans-serif; }

@alana314
Copy link

The join/split in CanvasRenderer.prototype.font was stripping out additional fonts. I submitted a fix for it

@rsbondi
Copy link

rsbondi commented Jun 13, 2016

I am not sure if this is related, but here I think I am seeing the font rendered correctly, but then layered over with an erroneous font?

@getJv
Copy link

getJv commented Sep 28, 2016

@eZ0 you are correct! Thank you!
As you said, i put font-family: arial at canvas parent element and works!.

Thank you! Thank you!

@niklasvh niklasvh added the Bug label Dec 12, 2017
@niklasvh niklasvh added this to Backlog in Backlog Dec 12, 2017
@niklasvh niklasvh moved this from Backlog to In Progress in Backlog Dec 12, 2017
@niklasvh niklasvh moved this from In Progress to v1.0.0 in Backlog Dec 12, 2017
@niklasvh
Copy link
Owner

Should be fixed in 77d258f

@ruslankonev
Copy link

ruslankonev commented Oct 9, 2018

not work, I got the same error
image

rendered by

html2canvas(this.$refs.iFr, { useCORS: true }).then(canvas => {
        console.log(canvas)

        document.body.appendChild(canvas)

        canvas.toBlob(function(blob) {
          saveAs(blob, 'Dashboard.png')
        })
      })

Custom loaded fonts from server (not CORS) is not render. Used font — based64 css file as font-face to Liberation Serif

@camohub
Copy link

camohub commented Jan 21, 2022

I have the same problem. You can fix it via clone callback and style it separately.

               onclone: (document) => {
                        document.querySelectorAll('.button span').forEach(element => {
                            element.style['font-family'] = 'sans-serif';
                        });
		}

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

No branches or pull requests

8 participants