html-to-image
html-to-image copied to clipboard
export image very slowly when use custom fonts
I have defined some custom fonts: @font-face { font-family: 'SourceHanSansCN-Medium'; src: url(../../assets/fonts/SourceHanSansSC-Medium.otf); }
@font-face { font-family: 'SourceHanSansCN-Bold'; src: url(../../assets/fonts/SourceHanSansSC-Bold.otf); }
@font-face { font-family: 'SourceHanSansSC-Normal'; src: url(../../assets/fonts/SourceHanSansSC-Normal.otf); }
import { toJpeg, toPng } from 'html-to-image'; toJpeg(element, { // skipFonts: true, useCORS: true, preferredFontFormat:'embedded-opentype', allowTaint: true, height: element.scrollHeight, // width: element.scrollWidth, scale: 1, backgroundColor: '#ffffff', pageBreak: { mode: 'avoid-all' } }) It will take more then 20s to export jpeg... if I set 'skipFonts: true', It will take 3s to export jpeg...
so how should I do to apply custom fonts?
👋 @klower
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
same issue,no idea to resolve it
any luck figuring that out?