添加中文字體其實很簡單,往容器里COPY一個ttf字體文件就生效了,不需要執行fc-cache。
基於debian 8的tomcat容器,Dockerfile:
COPY msyh.ttf /usr/share/fonts/msyh.ttf
容器啟動的時候這個ttf就已經生效了。
1. 到windows 下載微軟雅黑字體
字體路徑 C:/WINDOWS/Fonts
雅黑:msyh
1、檢查字體是否已經安裝:
fc-list ----------檢查所有已有的字體 fc-list :lang=zh -----------只檢查中文
實例配置
RUN yum -y install kde-l10n-Chinese net-tools && \
yum -y reinstall glibc-common &&\
yum clean all && \
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
ENV LC_ALL "zh_CN.UTF-8"
COPY msyh.ttc /usr/share/fonts/msyh.ttc
