api-screenshot icon indicating copy to clipboard operation
api-screenshot copied to clipboard

I found that Chinese characters cannot be displayed correctly in screenshots while using.

Open rebron1900 opened this issue 10 months ago • 2 comments

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'; // 设置使用自定义字体
});

rebron1900 avatar Aug 26 '23 08:08 rebron1900

你好,这个问题后续有解决吗

liruifengv avatar Apr 02 '24 13:04 liruifengv

你好,这个问题后续有解决吗

没有。

rebron1900 avatar Apr 03 '24 05:04 rebron1900