1、将window中字体文件放在项目的【ly-cea-cultivation-process-server】目录下
2、配置Dockerfile文件
RUN mkdir /usr/lib/jvm/java-1.8-openjdk/jre/lib/fonts
RUN mkdir /usr/lib/jvm/java-1.8-openjdk/jre/lib/fonts/fallback
ADD ly-cea-cultivation-process-server/simkai.ttf /usr/lib/jvm/java-1.8-openjdk/jre/lib/fonts/fallback
ADD ly-cea-cultivation-process-server/STLITI.TTF /usr/lib/jvm/java-1.8-openjdk/jre/lib/fonts/fallback
3、
//隶书
private static BaseFont baseFontLs() {
try {
String font = "";
if (Common.isLinux()) {
font = "/usr/lib/jvm/java-1.8-openjdk/jre/lib/fonts/fallback/STLITI.TTF";
} else {
font = "c:\\windows\\fonts\\STLITI.TTF";
}
return BaseFont.createFont(font, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
} catch (DocumentException | IOException e) {
e.printStackTrace();
}
return null;
}