1904labs / dom-to-image-more

Generates an image from a DOM node using HTML5 canvas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need embed fonts to be optional

davidburns573 opened this issue · comments

Our team uses a number of font families that are very large when included in the <style/> tag of the exported svg. This results in image files that are 10000x larger. We would like to optionally disable the embedFonts step of the conversion process.

We've temporarily forked this repo and made our change, but it would be great if we could include this here since others may benefit as well!

Forked repo: https://github.com/davidburns573/dom-to-image-more

Agree! Just can't disable it with current apis.

This should be relatively easy. I will dig into that this weekend. Do you have a test example jsfiddle

On Thu, Aug 8, 2024, 01:27 YujiaCheng1996 @.> wrote: Agree! Just can't disable it with current apis. — Reply to this email directly, view it on GitHub <#158 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGVMSZM3M4CB2SMFDDZEVTZQMFTPAVCNFSM6AAAAABMFY76G6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZVGA2DMMZTGY . You are receiving this because you are subscribed to this thread.Message ID: @.>

Doesn't need a test example.
It just adds all the font-face(s) found to the SVG without any means to disable it.
His solution is working.
0c4a634
Just add an option to disable the process or use a more intelligent algorithm to rule out the unrelated font-face(s).

https://jsfiddle.net/fu01mxh7/1/
This shows an example with totally unrelated and huge fonts included in the global CSS.