api-screenshot
api-screenshot copied to clipboard
I found that Chinese characters cannot be displayed correctly in screenshots while using.
I found that Chinese characters cannot be displayed correctly in screenshots while using. I tried to make some modifications based on the prompts from ChatGPT (downloaded a Chinese font and placed it in the same directory as the script), but it doesn't seem to work.
我在使用过程中发现中文字符在截图中无法正常显示, 我尝试着通过 ChatGPT 的提示做了一些修改(下载了一个中文字体放在脚本的同目录下),但是似乎并不起作用。
await page.evaluate(() => {
const font = new FontFace('Microsoft YaHei', 'url(./微软雅黑.ttf)'); // 这里使用相对路径引用字体文件
document.fonts.add(font);
document.body.style.fontFamily = 'Microsoft YaHei,sans-serif !important'; // 设置使用自定义字体
});
你好,这个问题后续有解决吗
你好,这个问题后续有解决吗
没有。