When adding fonts to WSL, the following article introduced how to place a ttf file in a directory called ~ / .fonts and refer to it. https://qiita.com/query1000/items/4b0b8db872adc1a5e2e9
However, when referring to MS Mincho and Yu Mincho that are originally included in Windows 10, it is faster to use the Windows fonts that are included in the same machine directly because it is WSL. How to do it.
I referred to the following articles as a whole. https://www.atmarkit.co.jp/ait/articles/1812/27/news033.htmlc/
--Create a file called /etc/fonts/local.conf with root privileges and save it with the following contents.
/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/mnt/c/Windows/Fonts</dir>
</fontconfig>
with this
$ fc-cache -fv
Then you can use the files installed in Windows directly.
I referred to the following article. https://ponu2.blogspot.com/2016/03/fontconfig.html
On Linux, fonts are specified in /etc/fonts/fonts.conf, which is installed by default. However, if you mess with this file directly, it will be overwritten in a later update or you will not be able to follow the update.
So, write local.conf in the same directory and put the root-specific settings of that machine. local.conf takes precedence over fonts.conf.
Furthermore, if you put the font file in the directory ~ / .fonts / for each user, that one will be given priority.
Summary
--User's ~ / .fonts / --/Etc/fonts/local.conf created by root on that machine --Installed and updated by default /etc/fonts/fonts.conf Priority is given in the order of.
I only use my own Windows machine, so I decided to set up local.conf.
(The above article seems to have more detailed settings)
I referred to the following article. https://opentype.jp/fontinst10.htm
The first article I mentioned shows how to insert font files directly into ~ / .fonts.
However, if you install fonts on Windows and use them with WSL, you can't just put the font files in C: \ Windows \ Fonts. In this case, right-click the downloaded font file (* .ttf or ttc) and select "Install for all users". (Administrator authority required) Note that if you simply "install", this time you will go to the folder "C: \ Users \ (user name) \ AppData \ Local \ Microsoft \ Windows \ Fonts" for each Windows user.
I don't know anything. ..
(End of this section)
Recommended Posts