[LINUX] Use Windows 10 fonts with WSL

About the title part

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.

About /etc/fonts/local.conf

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)

Install fonts on Windows 10

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

Use Windows 10 fonts with WSL
Use Linux on Windows 10 (WSL2)
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
Use Windows 10 speech synthesis with Python
Use a custom kernel with WSL2
How to use Cmder with PyCharm (Windows)
Use dein.vim and ckw-mod with Windows7 32bit PowerShell
Organize files on Windows with Linux commands-using WSL-
Use Python / Django with Windows Azure Cloud Service!
Use mecab-ipadic-neologd with igo-python
Use ansible with cygwin
Use pipdeptree with virtualenv
[Python] Use JSON with Python
Use Mock with pytest
Use indicator with pd.merge
Linux (WSL) on Windows
Use Gentelella with django
Use mecab with Python3
Use tensorboard with Chainer
Use DynamoDB with Python
Use pip with MSYS2
Use pyvenv on Windows
Python starting with Windows 7
Use Python 3.8 with Anaconda
Use pyright with Spacemacs
Use python with docker
Use TypeScript with django-compressor
Use LESS with Django
Use Ansible on Windows
Use MySQL with Django
Use QuTiP on Windows
Use pip on Windows
Use Enums with SQLAlchemy
Use tensorboard with NNabla
Use GPS with Edison
Use nim with Jupyter
Problems with windows python being called on pipenv on WSL
Python with VS Code (Windows 10)
Use Trello API with python
Use shared memory with shared libraries
Use custom tags with PyYAML
Use directional graphs with networkx
Run python with PyCharm (Windows)
Use TensorFlow with Intellij IDEA
Use Twitter API with Python
Use pip with Jupyter Notebook
Use DATE_FORMAT with SQLAlchemy filter
Use TUN / TAP with Python
Use chainer with Jetson TK1
Use SSL with Celery + Redis
Use Cython with Jupyter Notebook
Use Maxout + CNN with Pylearn2
Use WDC-433SU2M2 with Manjaro Linux
Use OpenBLAS with numpy, scipy
Use subsonic API with python3
Use Sonicwall NetExtener with Systemd
Use Python on Windows (PyCharm)
Time synchronization (Windows) with Python
Use prefetch_related conveniently with Django
Blogging with Pelican on Windows
Use AWS interpreter with Pycharm