3

I'm trying to set the default Japanese font. A while back my default font was UKai but after installing new fonts it changes to something else. I would like to get UKai back as the default Japanese font without having to uninstall all other fonts. ~/.fonts.conf has a note saying to modify ~/fontconfig/fonts.conf and I used the template on the Arch Wiki (https://wiki.archlinux.org/index.php/Fonts#Font_alias) to set my font to UKai:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Droid</family>
      <family>AR PL UKai CN</family>
    </prefer>
  </alias>
</fontconfig>

...and it doesn't do anything. It seems to be reading the file, e.g. if I break the XML file it will complain ("unmatched tags", "can't have two ", etc...). When I start conky I also get the warning "Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.", which is odd because that file was created by font-manager... The string for the font "AR PL UKai CN" is in several files under /etc/fonts/conf.avail, so it seems to be installed correctly.

I'm using OpenBox with Lubuntu 13.10 x64.

P.S.: What I'm asking is very similar to the question: How do I change the default Chinese font?, but the method does not seem to work anymore (Fontconfig complains it's deprecated).

3

I was looking around on how to replace the default Japanese font quite some time back as well. I found a solution by akai_kenshi at that time, but I don't know if it still works or not (it should). It shouldn't mess up your system even if it fails though, so give it a try:
http://ubuntuforums.org/showthread.php?t=1588772&p=9940183#post9940183

Quoting the solution here in case URL breaks in the near future:

1) Open a terminal.

2) Type:

sudo gedit /etc/fonts/conf.d/69-language-selector-ja-jp.conf

3) Copy and paste this code into the opened file:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <!-- Japanese (ja) -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Serif</string>
            <string>Takao P明朝</string>
            <string>IPA P明朝</string>
            <string>IPA モナー P明朝</string>
            <string>梅P明朝</string>
            <string>さざなみ明朝</string>
            <string>東風明朝</string>
        </edit>
    </match>

    <match target="pattern">
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Sans</string>
            <string>Takao Pゴシック</string>
            <string>IPA Pゴシック</string>
            <string>IPA モナー Pゴシック</string>
            <string>UmePlus P Gothic</string>
            <string>梅Pゴシック</string>
            <string>VL Pゴシック</string>
            <string>さざなみゴシック</string>
            <string>東風ゴシック</string>
        </edit>
    </match>

    <match target="pattern">
        <test qual="any" name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Sans Mono</string>
            <string>Takaoゴシック</string>
            <string>IPAゴシック</string>
            <string>IPA モナー ゴシック</string>
            <string>UmePlus Gothic</string>
            <string>梅ゴシック</string>
            <string>VL ゴシック</string>
            <string>さざなみゴシック</string>
            <string>東風ゴシック</string>
        </edit>
    </match>

    <match target="pattern">
        <test qual="any" name="family">
            <string>Ryumin</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Takao P明朝</string>
            <string>IPA P明朝</string>
            <string>IPA モナー P明朝</string>
            <string>梅P明朝</string>
            <string>さざなみ明朝</string>
            <string>東風明朝</string>
        </edit>
    </match>

    <match target="pattern">
        <test qual="any" name="family">
            <string>GothicBBB</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Takao Pゴシック</string>
            <string>IPA Pゴシック</string>
            <string>IPA モナー Pゴシック</string>
            <string>UmePlus P Gothic</string>
            <string>梅Pゴシック</string>
            <string>VL Pゴシック</string>
            <string>さざなみ ゴシック</string>
            <string>東風ゴシック</string>
        </edit>
    </match>

    <match target="font">
        <test name="family" compare="contains">
            <string>Takaoゴシック</string>
            <string>Takao Pゴシック</string>
            <string>TakaoExゴシック</string>
            <string>Takao明朝</string>
            <string>Takao P明朝</string>
            <string>TakaoEx明朝</string>
            <string>IPAゴシック</string>
            <string>IPA Pゴシック</string>
            <string>IPAexゴシック</string>
            <string>IPA明朝</string>
            <string>IPA P明朝</string>
            <string>IPAex明朝</string>
            <string>IPA モナー ゴシック</string>
            <string>IPA モナー Pゴシック</string>
            <string>IPA モナー UIゴシック</string>
            <string>IPA モナー 明朝</string>
            <string>IPA モナー P明朝</string>
            <string>梅ゴシック</string>
            <string>梅ゴシックC4</string>
            <string>梅ゴシックC5</string>
            <string>梅ゴシックO5</string>
            <string>梅ゴシックS4</string>
            <string>梅ゴシックS5</string>
            <string>梅Pゴシック</string>
            <string>梅PゴシックC4</string>
            <string>梅PゴシックC5</string>
            <string>梅PゴシックO5</string>
            <string>梅PゴシックS4</string>
            <string>梅PゴシックS5</string>
            <string>梅明朝</string>
            <string>梅明朝S3</string>
            <string>梅P明朝</string>
            <string>梅P明朝S3</string>
            <string>梅UIゴシック</string>
            <string>梅UIゴシックO5</string>
            <string>UmePlus Gothic</string>
            <string>UmePlus P Gothic</string>
            <string>VL ゴシック</string>
            <string>VL Pゴシック</string>
            <string>さざなみゴシック</string>
            <string>さざなみ明朝</string>
            <string>東風ゴシック</string>
            <string>東風明朝</string>
            <string>TakaoGothic</string>
            <string>TakaoPGothic</string>
            <string>TakaoExGothic</string>
            <string>TakaoMincho</string>
            <string>TakaoPMincho</string>
            <string>TakaoExMincho</string>
            <string>IPAGothic</string>
            <string>IPAPGothic</string>
            <string>IPAexGothic</string>
            <string>IPAMincho</string>
            <string>IPAPMincho</string>
            <string>IPAexMincho</string>
            <string>IPAMonaGothic</string>
            <string>IPAMonaPGothic</string>
            <string>IPAMonaUIGothic</string>
            <string>IPAMonaMincho</string>
            <string>IPAMonaPMincho</string>
            <string>Ume Gothic</string>
            <string>Ume Gothic C4</string>
            <string>Ume Gothic C5</string>
            <string>Ume Gothic O5</string>
            <string>Ume Gothic S4</string>
            <string>Ume Gothic S5</string>
            <string>Ume P Gothic</string>
            <string>Ume P Gothic C4</string>
            <string>Ume P Gothic C5</string>
            <string>Ume P Gothic O5</string>
            <string>Ume P Gothic S4</string>
            <string>Ume P Gothic S5</string>
            <string>Ume Mincho</string>
            <string>Ume Mincho S3</string>
            <string>Ume P Mincho</string>
            <string>Ume P Mincho S3</string>
            <string>Ume UI Gothic</string>
            <string>Ume UI Gothic O5</string>
            <string>Ume Gothic</string>
            <string>Ume P Gothic</string>
            <string>VL Gothic</string>
            <string>VL PGothic</string>
            <string>Sazanami Gothic</string>
            <string>Sazanami Mincho</string>
            <string>Kochi Gothic</string>
            <string>Kochi Mincho</string>
        </test>
        <test name="pixelsize" compare="less_eq">
            <double>18</double>
        </test>
        <edit name="hintstyle" mode="assign">
            <const>hintnone</const>
        </edit>
        <edit name="embeddedbitmap">
             <bool>false</bool>
        </edit>
    </match>
    <!-- Japanese (ja) ends -->
</fontconfig>

4) Save the file, close it, and restart your computer.

You should now have a desktop with a nice looking English and Japanese font display, and you can install as many Japanese fonts as you like without altering it.

The only difference here is that you'll want to place whatever you want to be loaded first at the top of every font family if you want them to be the first font candidate for loading.





Another method which is far simpler and faster, and doesn't involve a reboot. Not the proper way of going about it, but it's an alternative and probably the fastest way.

Install something that you have no need for, but would replace your current default font.
I used the example that I found fonts-arphic-uming, it's a Chinese font but it overwrites your default Japanese font:

sudo apt-get install fonts-arphic-uming

Change your working directory to /etc/share/fonts/truetype for convenience' sake since the fonts are all in that directory:

cd etc/share/fonts/truetype

Replace /etc/share/fonts/truetype/arphic/uming.ttc with the font of your choice (I assume your ukai.ttc font is in /etc/share/fonts/truetype/arphic/ in this case):

sudo cp arphic/ukai.ttc arphic/uming.ttc

Should do the job pretty well. Every time I notice my Japanese fonts changed after installing something, I remove and reinstall fonts-arphic-uming and do the same thing again.





I highly recommend using something else other than UKai though, as it's a Chinese font and some kanji characters won't load, in which case it will switch to loading the next available Japanese font if available, or simply showing a box for said kanji.

  • 1
    I can confirm this answer still works :) – Brallan Aguilar May 1 '17 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.