The project deployed in the docker container uses the window font

1. Place the font file in the window under the [ly-cea-cultivation-process-server] directory of the project

2. Configure the 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;
    }

 

Guess you like

Origin blog.csdn.net/qq_36336332/article/details/111190966
Recommended