Linux下安裝阿里巴巴普惠字體

OS:RHEL8
首先下載需要安裝的字體,我這邊下載的是阿里巴巴的字體。打開https://alibabafont.taobao.com/,按照要求下載自己需要的字體。
首先安裝 :fontconfig mkfontscale

yum install -y fontconfig mkfontscale

安裝完畢就可以使用fc-list 命令查看系統中已經安裝的字體.

fc-list
/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/paratype-pt-sans/PTS76F.ttf: PT Sans:style=Bold Italic
/usr/share/fonts/google-droid/DroidSansHebrew-Regular.ttf: Droid Sans:style=Regular
/usr/share/fonts/julietaula-montserrat/MontserratAlternates-Bold.ttf: Montserrat Alternates:style=Bold
/usr/share/fonts/urw-base35/NimbusMonoPS-Italic.otf: Nimbus Mono PS:style=Italic
/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf: DejaVu Serif:style=Italic
/usr/share/fonts/AlibabaSans-Italic.otf: Alibaba Sans:style=Italic
/usr/share/fonts/urw-base35/D050000L.t1: D050000L:style=Regular
/usr/share/fonts/urw-base35/NimbusSansNarrow-Regular.t1: Nimbus Sans Narrow:style=Regular
/usr/share/fonts/urw-base35/NimbusSansNarrow-BoldOblique.t1: Nimbus Sans Narrow:style=Bold Oblique
/usr/share/fonts/sil-padauk/Padauk-Regular.ttf: Padauk:style=Regular
/usr/share/fonts/paktype-naskh-basic/PakTypeNaskhBasic.ttf: PakType Naskh Basic:style=Regular
/usr/share/fonts/urw-base35/NimbusMonoPS-Bold.otf: Nimbus Mono PS:style=Bold
/usr/share/fonts/liberation/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
......

查看系統中已經安裝的中文字體 fc-list :lang=zh

fc-list :lang=zh
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold
/usr/share/fonts/google-droid/DroidSansFallback.ttf: Droid Sans:style=Regular
......

以上可以看到字體都放在/usr/share/fonts/這個目錄下,我們將下載的字體上傳到這個目錄下。
進入到/usr/share/fonts/ 目錄下:依次運行以下命令 建立字體索引信息,更新字體緩存。

cd /usr/share/fonts
mkfontscale
mkfontdir
fc-cache -fv

至此,字體安裝完畢。可以通過fc-list :lang=zh來查看安裝的字體:

fc-list :lang=zh
/usr/share/fonts/Alibaba-PuHuiTi-Bold.otf: Alibaba PuHuiTi,阿里巴巴普惠體,Alibaba PuHuiTi B,阿里巴巴普惠體 B:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold
/usr/share/fonts/google-droid/DroidSansFallback.ttf: Droid Sans:style=Regular
/usr/share/fonts/Alibaba-PuHuiTi-Medium.otf: Alibaba PuHuiTi,阿里巴巴普惠體,Alibaba PuHuiTi M,阿里巴巴普惠體 M:style=Medium,Regular
/usr/share/fonts/Alibaba-PuHuiTi-Light.otf: Alibaba PuHuiTi,阿里巴巴普惠體,Alibaba PuHuiTi L,阿里巴巴普惠體 L:style=Light,Regular
/usr/share/fonts/Alibaba-PuHuiTi-Heavy.otf: Alibaba PuHuiTi,阿里巴巴普惠體,Alibaba PuHuiTi H,阿里巴巴普惠體 H:style=Heavy,Regular
/usr/share/fonts/Alibaba-PuHuiTi-Regular.otf: Alibaba PuHuiTi,阿里巴巴普惠體,Alibaba PuHuiTi R,阿里巴巴普惠體 R:style=Regular
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Regular.ttc: Noto Serif CJK TC:style=Regular
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Regular.ttc: Noto Serif CJK SC:style=Regular
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Regular.ttc: Noto Serif CJK JP:style=Regular
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Regular.ttc: Noto Serif CJK KR:style=Regular
......
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章