qq15725 / modern-screenshot

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

当使用 `document.fonts` 的方式添加字体,生成的图片会丢失文字的字体样式 #39

Closed chenzn1 closed 12 months ago

chenzn1 commented 1 year ago

Steps To Reproduce

const fontFile = new FontFace(fontFamily, `url(${fontUrl})`);
document.fonts.add(fontFile);
fontFile.load();

dom 是有添加的字体样式,但生成的图片没有

Your Environment

qq15725 commented 12 months ago

document.fonts 没有附加对应的 DOM 对象,无法内嵌到 svg+xml 中,在 Web 标准没支持前应该无法处理。只能处理 style 方式新增的字体。