EPPlus.Core 1.5.4 报错 font '?' cannot be found docker core运行时2.1.0 alpine镜像 缺失微软字体

将项目运行时环境升级到2.1后,EPPlus.Core导出报错,无法初始化“Gdip”,此问题需要在镜像中安装libgdiplus包,即可解决!dockerfile命令如下:

apk add libgdiplus --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ && \ apk add --no-cache ttf-dejavu && \ ln /usr/lib/libgdiplus.so.0 /usr/lib/libgdiplus.so

安装包以后又提示  font '?' cannot be found,找资料显示微软的System.Drawing.Common库未按照如下顺序查找字体:

就其而言GenericSansSerif,它将尝试按照以下字体以“Microsoft San Serif”,“Arial”,“Tahoma”的顺序返回该家族。如果没有安装这些字体,则会显示它选择按名称排序的第一个安装字体系列。

就其而言GenericSerif,它试图从名为“Times New Roman”的字体中返回家人。如果没有安装与使用相同的规则GenericSanSerif即如果删除“Times New Roman”字体,则与调用相同GenericSanSerif

总而言之,少字体,解决方法就是安装缺少的字体

过程如下:

apk --no-cache add msttcorefonts-installer fontconfig && \
    update-ms-fonts && \
    fc-cache -f

打完收工

猜你喜欢

转载自www.cnblogs.com/rokeyyan/p/9150392.html
今日推荐