
我已經在 Ubuntu 18.04 伺服器上安裝了自訂字體,但 Chrome 無法識別它們。一共有四種,而且都是.otf字體。這不是 Ubuntu 的桌面版本,它是一個雲端伺服器,所以都是命令列。
我安裝的字體位於/home/$USER/.fonts
,但還有一個字體資料夾位於 ,/usr/local/share/fonts
另一個位於/usr/share/fonts/truetype
(用於.ttf
字體)。
我在 2010 年在 Stack Exchange 上讀到的一個答案說將它們放入/usr/local/share/fonts
,然後使用 重建字體快取fc-cache -f -v
。
所以我很困惑。在重建字體快取之前我應該將字體放入哪個資料夾?我應該同時安裝.otf
和.ttf
版本嗎?
非常感謝您的幫忙。
答案1
如果您想在系統範圍內使用字體,請/usr/share/fonts
根據其類型將它們放入,就像您的情況一樣,目錄是opentype
.這是我的字體資料夾中的樣子:
user@ubuntu:/usr/share/fonts$ l
AppleGaramond-BoldItalic.ttf 'Lucida MAC Bold.pfm'
AppleGaramond-Bold.ttf 'Lucida MAC.PFB'
AppleGaramond-Italic.ttf 'Lucida MAC.pfm'
AppleGaramond-LightItalic.ttf LucidaMAC.ttf
AppleGaramond-Light.ttf lucon.ttf
AppleGaramond.ttf MACGRAND.PFB
Aquabase.ttf MACGRAND.PFM
cmap/ opentype/
cMap/ svg/
eot/ truetype/
LITHOGRL.TTF type1/
'Lucida Grande Bold.ttf' woff/
'Lucida Grande.ttf' X11/
'Lucida MAC Bold.PFB'
只需將.ttf
s 放入truetype
此處的資料夾中,然後.otf
將 s 放入opentype
.然後重新載入快取(注意:sudo
也複製到這些資料夾中):
$ sudo fc-cache -f -v
您很可能正在與用戶一起使用伺服器應用程序root
,因此您需要在系統範圍內安裝它們。是的,每次新增字體時,都應該刷新字體快取。