![如何在 20.04 中安装字体](https://linux22.com/image/939291/%E5%A6%82%E4%BD%95%E5%9C%A8%2020.04%20%E4%B8%AD%E5%AE%89%E8%A3%85%E5%AD%97%E4%BD%93.png)
我新版的 ubuntu 20.04 没有“Times new roman”等字体。我该如何获取它们?我尝试了以下方法:
https://linuxconfig.org/install-microsoft-fonts-on-ubuntu-20-04-focal-fossa-desktop
这没用。我也试过重启。我也试过
如何在 ubuntu 中安装 Arial 字体(和其他 Windows 字体)?
在评论部分我找到了另一种方法,但我卡在最后一步。任何帮助都值得感激,提前谢谢 :)。
Stefan1 的替代方法:
sudo mkdir ~/ms-fonts/ cd ms-fonts sudo wget ***.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz sudo tar -xzf webfonts.tar.gz cd msfonts sudo apt install cabextract sudo cabextract *.exe sudo cp *.ttf *.TTF ~/.local/share/fonts/ sudo fc-cache -vr
我将 *** 替换为 www,否则它将无法工作。但接下来的最后一步 ( sudo cp *.ttf *.TTF ~/.local/share/fonts/
) 给我带来了问题。终端“显示”没有文件夹。该怎么办?我有一个名为 的文件夹,usr/local/share/fonts
但它是空的,这是他们需要去的那个文件夹吗?我该如何将它们带到那里?
这是尝试替代方法后的终端输出:
m@m-ThinkPad-T520:~$ sudo mkdir ~/ms-fonts/
[sudo] password for m:
m@m-ThinkPad-T520:~$ cd ms-fonts
m@m-ThinkPad-T520:~/ms-fonts$ sudo wget ***.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz
--2021-07-03 18:17:58-- http://***.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz
Resolving ***.freedesktop.org (***.freedesktop.org)... failed: Name or service not known.
wget: unable to resolve host address ‘***.freedesktop.org’
m@m-ThinkPad-T520:~/ms-fonts$ sudo wget www.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz
--2021-07-03 18:18:47-- http://www.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz
Resolving www.freedesktop.org (www.freedesktop.org)... 131.252.210.176, 2610:10:20:722:a800:ff:feda:470f
Connecting to www.freedesktop.org (www.freedesktop.org)|131.252.210.176|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://www.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz [following]
--2021-07-03 18:18:48-- https://www.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz
Connecting to www.freedesktop.org (www.freedesktop.org)|131.252.210.176|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3326635 (3.2M) [application/x-gzip]
Saving to: ‘webfonts.tar.gz’
webfonts.tar.gz 100%[===================>] 3.17M 860KB/s in 3.9s
2021-07-03 18:18:52 (826 KB/s) - ‘webfonts.tar.gz’ saved [3326635/3326635]
m@m-ThinkPad-T520:~/ms-fonts$ ls
webfonts.tar.gz
m@m-ThinkPad-T520:~/ms-fonts$ sudo tar -xzf webfonts.tar.gz
m@m-ThinkPad-T520:~/ms-fonts$ ls
msfonts webfonts.tar.gz
m@m-ThinkPad-T520:~/ms-fonts$ cd msfonts/
m@m-ThinkPad-T520:~/ms-fonts/msfonts$ sudo apt install cabextract
Reading package lists... Done
Building dependency tree
Reading state information... Done
cabextract is already the newest version (1.9-3).
cabextract set to manually installed.
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi
libgstreamer-plugins-bad1.0-0 libva-wayland2
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
m@m-ThinkPad-T520:~/ms-fonts/msfonts$ sudo cabextract *.exe
Extracting cabinet: andale32.exe
extracting fontinst.inf
extracting andale.inf
extracting fontinst.exe
extracting AndaleMo.TTF
extracting ADVPACK.DLL
extracting W95INF32.DLL
extracting W95INF16.DLL
Extracting cabinet: arial32.exe
extracting FONTINST.EXE
extracting fontinst.inf
extracting Ariali.TTF
extracting Arialbd.TTF
extracting Arialbi.TTF
extracting Arial.TTF
Extracting cabinet: arialb32.exe
extracting fontinst.exe
extracting fontinst.inf
extracting AriBlk.TTF
Extracting cabinet: comic32.exe
extracting fontinst.inf
extracting Comicbd.TTF
extracting Comic.TTF
extracting fontinst.exe
Extracting cabinet: courie32.exe
extracting cour.ttf
extracting courbd.ttf
extracting courbi.ttf
extracting fontinst.inf
extracting couri.ttf
extracting fontinst.exe
Extracting cabinet: georgi32.exe
extracting fontinst.inf
extracting Georgiaz.TTF
extracting Georgiab.TTF
extracting Georgiai.TTF
extracting Georgia.TTF
extracting fontinst.exe
Extracting cabinet: impact32.exe
extracting fontinst.exe
extracting Impact.TTF
extracting fontinst.inf
Extracting cabinet: times32.exe
extracting fontinst.inf
extracting Times.TTF
extracting Timesbd.TTF
extracting Timesbi.TTF
extracting Timesi.TTF
extracting FONTINST.EXE
Extracting cabinet: trebuc32.exe
extracting fontinst.exe
extracting Trebucit.TTF
extracting Trebuc.TTF
extracting Trebucbd.TTF
extracting Trebucbi.TTF
extracting fontinst.inf
Extracting cabinet: verdan32.exe
extracting fontinst.exe
extracting fontinst.inf
extracting Verdanab.TTF
extracting Verdanai.TTF
extracting Verdanaz.TTF
extracting Verdana.TTF
Extracting cabinet: webdin32.exe
extracting fontinst.exe
extracting Webdings.TTF
extracting fontinst.inf
extracting Licen.TXT
All done, no errors.
m@m-ThinkPad-T520:~/ms-fonts/msfonts$ sudo cp *.ttf *.TTF ~/.local/share/fonts/
cp: target '/home/m/.local/share/fonts/' is not a directory
答案1
按照 Michal Przybylowicz 的建议后,它开始发挥作用。
我使用以下命令安装字体:
sudo apt install ttf-mscorefonts-installer
然后:
sudo fc-cache -fv
更新字体缓存和
fc-list
列出所有已安装的字体。
答案2
这个怎么样 点击下载新 Times Romanhttps://freefontsfamily.com/times-new-roman-font-free/ 解压 zip 文件。打开解压的