コンテンツにスキップ

Ubuntuでフォントを設定

準備

Terminal window
sudo apt update
sudo apt install curl unzip

フォントをダウンロード

ここでは、Cascadia Monoをダウンロードします。

Terminal window
curl -OL https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CascadiaMono.zip
unzip CascadiaMono.zip -d CascadiaMono
ls -1 CascadiaMono/*.ttf
実行結果
CascadiaMono/CaskaydiaMonoNerdFont-Bold.ttf
CascadiaMono/CaskaydiaMonoNerdFont-BoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFont-ExtraLight.ttf
CascadiaMono/CaskaydiaMonoNerdFont-ExtraLightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFont-Italic.ttf
CascadiaMono/CaskaydiaMonoNerdFont-Light.ttf
CascadiaMono/CaskaydiaMonoNerdFont-LightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFont-Regular.ttf
CascadiaMono/CaskaydiaMonoNerdFont-SemiBold.ttf
27行の折りたたみ
CascadiaMono/CaskaydiaMonoNerdFont-SemiBoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFont-SemiLight.ttf
CascadiaMono/CaskaydiaMonoNerdFont-SemiLightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-Bold.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-BoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-ExtraLight.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-ExtraLightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-Italic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-Light.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-LightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-Regular.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-SemiBold.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-SemiBoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-SemiLight.ttf
CascadiaMono/CaskaydiaMonoNerdFontMono-SemiLightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-Bold.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-BoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-ExtraLight.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-ExtraLightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-Italic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-Light.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-LightItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-Regular.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-SemiBold.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-SemiBoldItalic.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-SemiLight.ttf
CascadiaMono/CaskaydiaMonoNerdFontPropo-SemiLightItalic.ttf

~/.fonts/に配置

フォントファイルを用意できたので、これらを~/.fonts/に配置します。

Terminal window
mv CascadiaMono ~/.fonts/

フォントキャッシュを更新

Terminal window
fc-cache -fv

利用可能なフォント一覧

Terminal window
fc-list
日本語
fc-list :lang=ja

VS Code

.vscode/settings.json
{
"editor.formatOnSave": true,
// ...
// "editor.fontFamily": 'Droid Sans Mono', 'monospace', monospace",// default
"editor.fontFamily": "'CaskaydiaMono Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace",
"editor.fontSize": 16,
"terminal.integrated.fontFamily": "'CaskaydiaMono Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace",
"terminal.integrated.fontSize": 16
}

Font Manager

GUI で管理したい場合は Font Manager を使用するのが良いかと思います。

https://github.com/FontManager/font-manager#ubuntu-personal-package-archive

インストール

Terminal window
sudo add-apt-repository ppa:font-manager/staging
sudo apt-get update
sudo apt-get install font-manager