LoginSignup
9
5

More than 3 years have passed since last update.

Linuxでアップデートしたら中華フォントになった件について(修正方法)

Last updated at Posted at 2020-08-02

与太話

 巷では中国本土で使われる漢字(簡体字)の字形が表示される現象を「中華フォント現象」と呼ぶらしい.最も簡体字を利用する中国語利用者にとっては「なんのこっちゃ」というこの現象名なのだが,この表示現象をひと括りの単語として認識するまで時間がかかってしまった.そして,この現象を「問題」として認識するのはおそらく日本語利用者しかいないだろう.

 先日,久々にOSのアップデートをしようとsudo dnf update(筆者はFedoraを利用.Ubuntuでいうsudo apt-get updateと同義)をかけて再起動したところ,ログイン画面から中華フォント現象が起きていた.もちろんOSの設定言語は「日本語」であるにもかかわらず!

 これはめんどくさいことに多くの時間を費やすなと思いながら,早速改善策を調べる.

解決策

  • /etc/fonts以下の設定(etcはOSの設定ファイルが格納されているディレクトリ):
    • コマンドls /etc/fonts/を実行したところ,conf.dディレクトリとfonts.confの設定ファイルがある.一度,fonts.confを開いてみると,X Window開発者のKeith Packard氏のコメントが書かれてあった.
<!--
        DO NOT EDIT THIS FILE.
        IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
        LOCAL CHANGES BELONG IN 'local.conf'.

        The intent of this standard configuration file is to be adequate for
        most environments.  If you have a reasonably normal environment and
        have found problems with this configuration, they are probably
        things that others will also want fixed.  Please submit any
        problems to the fontconfig bugzilla system located at fontconfig.org

        Note that the normal 'make install' procedure for fontconfig is to
        replace any existing fonts.conf file with the new version.  Place
        any local customizations in local.conf which this file references.

        Keith Packard
-->

つまり,ここに直接書き込んではだめということがわかる.その代わりにlocal.confに設定を書き込めと.でも,local.conflsで見当たらなかったので,/etc/fonts/下で作成した.

# vi /etc/fonts/local.conf

フォントファミリー "serif", "sans-serif", "monospace" それぞれ,Noto * フォントファミリを読み込ませるように以下のように記述した.記述方法はfontconfigのユーザードキュメントを参考にする.

local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <alias>
        <family>serif</family>
        <prefer>
            <family>Noto Serif</family>
        </prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer>
            <family>Noto Sans</family>
            <family>Noto Sans CJK JP</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer>
            <family>Noto Sans Mono CJK JP</family>
        </prefer>
    </alias>
</fontconfig>

これで再起動したところ,無事中華フォント現象から脱却できていた.

9
5
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
9
5