Install the missing fonts under the ubuntu system (generally missing Chinese fonts)

Install missing fonts under ubuntu system

cite: Ubuntu LaTeX environment configuration: https://www.cnblogs.com/xqmeng/p/13931222.html

Step 1: Download the missing font (here, ensure that the capitalization and spaces of the downloaded font name are consistent with the error you reported for missing fonts)

You can directly search in the browser, most of them are free, and you don’t need any credits.
I uploaded several fonts (Arial.ttf, KaiTi.ttf, STKAITI.TTF, Courier New.ttf, Times New Roman.ttf, simsun. ttc), https://download.csdn.net/download/weixin_43686259/86946858 , want a point, hehe~
insert image description here

Step 2: Move the downloaded font to the folder /usr/share/fonts

  1. In order to avoid font conflicts with Ubuntu itself, create a folder winfonts in /usr/share/fonts

    sudo mkdir winfonts
    
  2. Move the font to winfonts (sudo is required to elevate the authority, and the mouse cannot be dragged directly)

    example:

    (base) fl@fl:~/Downloads$ sudo mv Times New Roman.ttf /usr/share/fonts/winfonts
    [sudo] password for fl: 
    mv: cannot stat 'Times': No such file or directory
    mv: cannot stat 'New': No such file or directory
    mv: cannot stat 'Roman.ttf': No such file or directory
    (base) fl@fl:~/Downloads$ sudo mv Times\ New\ Roman.ttf /usr/share/fonts/winfonts
    (base) fl@fl:~/Downloads$ sudo mv Arial.ttf /usr/share/fonts/winfonts
    [sudo] password for fl: 
    (base) fl@fl:~/Downloads$ sudo mv Courier\ New.ttf  /usr/share/fonts/winfonts
    
  3. Refresh font library

    sudo mkfontscale
    sudo mkfontdir
    sudo fc-cache
    
  4. Check the installation of Chinese fonts

    $ fc-list :lang=zh
    ... // 省略一些输出
    /usr/share/fonts/winfonts/simsun.ttc: SimSun,宋体:style=Regular,常规 // 表示宋体已经加载完成,字体名为 SimSun
    ... // 省略一些输出
    
    $ fc-list :lang=zh | grep KaiTi    # 使用grep找,不自己眼睛找
    
    (base) fl@fl:/usr/share/fonts/winfonts$ fc-list :lang=zh | grep simsun
    /usr/share/fonts/winfonts/simsun.ttc: SimSun,宋体:style=Regular,常规
    /usr/share/fonts/winfonts/simsun.ttc: NSimSun,新宋体:style=Regular,常规
    

Guess you like

Origin blog.csdn.net/weixin_43686259/article/details/127784887