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

Fonts are not applied in resulting PNG #70

Open
Sashkan opened this issue Feb 5, 2020 · 2 comments
Open

Fonts are not applied in resulting PNG #70

Sashkan opened this issue Feb 5, 2020 · 2 comments

Comments

@Sashkan
Copy link

Sashkan commented Feb 5, 2020

I'm using this lib to convert an SVG string to a PNG. My SVG includes a google font, which is imported in its style tag.

On the SVG, the font is properly applied. Unfortunately, after using the convert method, it gets back to standard browser font.

Is there anything to add to keep styling in place ?

Here's my piece of code for converting:

		// get my SVG
        .then((html) => {
          return html.toString()
        })
        .then(htmlString => convert(htmlString))
        .then((productText) => {
          res.set('Content-Type', 'image/png');
          res.send(productText);
        })
@neocotic
Copy link
Owner

I'm sorry for the incredibly long delay in replying in responding to you but life sometimes gets in the way of OSS development. I thank you for your patience and wonder if you could please provide a reproducible SVG along with actual output. Also, a complete code sample would go along way to helping me investigate further.

@nick-keller
Copy link

To embed a Google font in your SVG:

<svg>
  <defs>
    <style type="text/css">@import url(http://fonts.googleapis.com/css?family=Inter);</style>
  </defs>
  ...
</svg>

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

3 participants