LoginSignup
2
2

More than 5 years have passed since last update.

Amazon Linux WorkSpaces で既定のフォントを Noto にする

Last updated at Posted at 2018-09-08

Amazon WorkSpaces (Amazon Linux 2) で既定のフォント (sans-serif・serif・monospace) を Google Noto フォントに設定しました。Amazon Linux だからと言って、手順にどうという違いはなかったのですが、一応備忘録として残しておきます。

フォントをダウンロード

Google Noto Fonts のサイトから次のフォント (zip ファイル) をダウンロードします。

  • Noto Sans CJK JP1
  • Noto Serif CJK JP

zip ファイルを展開

ダウンロードした zip ファイルを展開します。

ここでは zip ファイルが ~/Downloads ディレクトリにあると仮定します。

cd ~/Downloads
unzip NotoSansCJKjp-hinted.zip
unzip NotoSerifCJKjp-hinted.zip

LICENSE_OFL.txt または README を上書きするかきかれたときの選択肢はどれでもかまいません。(この 2 つのファイルは不要なため。)

フォントをコピー

展開された otf ファイルをシステムディレクトリにコピーします。

sudo mkdir -p /usr/share/fonts/opentype/noto
sudo cp *.otf /usr/share/fonts/opentype/noto
sudo chmod 755 /usr/share/fonts/opentype/noto/*.otf

既定のフォントを Noto にする

以下の内容で /etc/fonts/local.conf ファイルを作成します。

/etc/fonts/local.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family"><string>sans-serif</string></test>
    <edit name="family" mode="prepend" binding="same"><string>Noto Sans CJK JP</string></edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family"><string>serif</string></test>
    <edit name="family" mode="prepend" binding="same"><string>Noto Serif CJK JP</string></edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family"><string>monospace</string></test>
    <edit name="family" mode="prepend" binding="same"><string>Noto Sans Mono CJK JP</string></edit>
  </match>
</fontconfig>

設定を有効化

sudo fc-cache -f

確認

fc-match "sans-serif"
fc-match "serif"
fc-match "monospace"

出力:

NotoSansCJKjp-Medium.otf: "Noto Sans CJK JP" "Medium"
NotoSerifCJKjp-Medium.otf: "Noto Serif CJK JP" "Medium"
NotoSansMonoCJKjp-Regular.otf: "Noto Sans Mono CJK JP" "Regular"

できました:tada:

おまけ

Noto を既定にすると、私にはターミナルのフォントがかなり小さく感じられます。このため、私はいつもフォントサイズを 11 pt に設定しなおしています。

参考


  1. yum のリポジトリにもありましたが、今回は公式サイトからダウンロードします。 

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2