1、把需要安装字体的tff文件放入springboot resource下,连同应用一起打包到镜像中
Dockerfile:
2、安装 fontconfig,fc-list:检查已存在的中文字体
rpm --rebuilddb && yum -y -q install fontconfig
Dockerfile:
3、拷贝字体文件到指定目录(/usr/share/fonts/)
cp -r .../fonts/* /usr/share/fonts/
4、java代码中使用字体 new Font("微软雅黑", Font.BOLD + Font.ITALIC, img.getWidth()/16);