qq15725 / modern-screenshot

📸 Quickly generate image from DOM node using HTML5 canvas and SVG
https://www.toolpkg.com/image/html-to-image
MIT License
457 stars 32 forks source link

Fonts not getting exported in the img ? #90

Open flazouh opened 2 months ago

flazouh commented 2 months ago

Hello,

I've encountered an issue with the "modern-screenshot" tool where the font does not render as expected when exporting an image. Below are the details of the issue:

Description: When using the domToJpeg method to export an image of a videoContainerElement, the resulting image does not display the text in the correct font. Instead of the expected font, the text appears in a default or fallback font. This issue occurs when exporting the image with a scale factor of 3.

Steps to Reproduce:

  1. Navigate to a page.
  2. Trigger the domToJpeg function with the following configuration:
    dataURL = await domToJpeg(element, {
     scale: 3,
    });
  3. Observe the exported image and compare the font style to the expected one.

Expected Behavior: The text in the exported image should match the font style used in the element.

Actual Behavior: The text in the exported image defaults to a different font, ignoring the specified font style in the element.

Screenshots:

Environment:

I've tried to look into the options and saw some css and fonts options but i'm not sure if those are the one I need. Is there a known workaround or fix for this issue?

Thank you for your assistance.

lzlife commented 1 month ago

Did you solve it?