Playwright 在Ubuntu 系统截图乱码

截图发现出现的问题是一堆小方块。

playwright截图错误

这里其实显而易见的就是中文乱码。

出现这个问题就是因为服务器没有安装中文字体,所以无法解析。

所以只需要在服务器上安装上对应的中文字体就可以了,

首先从本地Windows (C:\Windows\Fonts ) 上随便找一个中文字体。

Windows字体文件

然后上传到服务器的/usr/share/fonts文件夹中,之后输入

fc-cache -fv

root@:/usr/share/fonts# fc-cache -fv

/usr/share/fonts: caching, new cache contents: 8 fonts, 1 dirs

/usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 2 dirs

/usr/share/fonts/truetype/dejavu: caching, new cache contents: 6 fonts, 0 dirs

/usr/share/fonts/truetype/lato: caching, new cache contents: 18 fonts, 0 dirs

/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs

/root/.local/share/fonts: skipping, no such directory

/root/.fonts: skipping, no such directory

/usr/share/fonts/truetype: skipping, looped directory detected

/usr/share/fonts/truetype/dejavu: skipping, looped directory detected

/usr/share/fonts/truetype/lato: skipping, looped directory detected

/var/cache/fontconfig: cleaning cache directory

/var/cache/fontconfig: invalid cache file: 3830d5c3ddfd5cd38a049b759396e72e-le64.cache-7

/root/.cache/fontconfig: not cleaning non-existent cache directory

/root/.fontconfig: not cleaning non-existent cache directory

fc-cache: succeeded

即可

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容