title: Installing Windows Fonts on Arch-based Distributions
date: 2020-07-16 23:54:28
tags: [archlinux,font]
categories: System Optimization
photos: /img/banner/images/18.jpg
description: Installing Windows fonts on Arch-based distributions for single system use.
Background#
In daily life, there are always some strange requirements that require the use of "office". For Linux users, although they can use WPS instead of MS Office suite, they still face a big problem: there is no Windows font library!
Imagine this, you need to submit a Word document for your assignment that requires the use of the font "Microsoft YaHei", but this font is not available on Linux. What do you do? You open a PowerPoint presentation made by your teacher, and everything is misaligned due to missing fonts. What do you do?...
After facing this problem countless times, I came up with the idea of installing Windows fonts.
Note: This article documents the entire packaging process. If you want to directly obtain the packaged software, please click here.
Installation#
After searching, most of the solutions found online involve mounting the Windows font directory. However, as a Linux single system user like me, this is not a feasible option XD
So, I opened the all-knowing Arch Wiki and followed the instructions to the ttf-ms-win10
AUR page. Before installing, let's take a look at the author's top comment:
FAQ, please read before posting:
- I get an error that the sources cannot be downloaded: Please read the instructions on the top of the PKGBUILD.
- Some fonts are missing in my copy of Windows (e.g., holomdl2, corbel, chandra, …): It seems that Microsoft distributes some fonts only with some Windows versions. You can just comment out the corresponding line in the PKGBUILD and then build with “makepkg –skipchecksums”.
- Some fonts have different checksums: We keep the checksums synchronized with our own Windows installations that are regularly updated. Different Windows versions, different ISOs etc. may contain fonts in different versions/variants. Just build the package using “makepkg –skipchecksums”.
- Why does the version not correspond to the latest Windows 10 build: If fonts have not changes between builds, there is no reason to change the version number of this package.
- Why are some fonts (e.g., traditional chinese, japanese etc.) not included here, not even in the corresponding split packages: We currently only include fonts that are installed on a standard Windows installation, without additional feature-on-demand packages (see: https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list).
Hmm... it's already very clear. Let's clone the project first:
git clone https://aur.archlinux.org/ttf-ms-win10.git
cd ttf-ms-win10
Following their instructions, let's take a look at the PKGBUILD
:
vim PKGBUILD
First, there is a copyright statement that using "Microsoft fonts" outside of Windows is illegal.
To avoid legal issues, the package does not come with Windows fonts. Instead, it provides two methods:
- Obtain from an existing Windows system (if I had one, I would just mount it!)
- Extract from the Windows installation package
So let's follow their steps:
-
Download the Windows 10 installation package from here
-
Open the ISO image and extract
sources/install.wim
-
Install
wimlib
and extract thewim
formatsudo pacman -S wimlib # Switch to the directory where install.wim is located wimextract install.wim 1 /Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf} --dest-dir fonts
-
Place all the extracted fonts in the same directory as
PKGBUILD
, and execute:makepkg
As expected, the third issue mentioned by the author occurred. Different Windows versions may contain different versions/variants of the same font, causing the hash value check to fail and the script to exit.
The solution is also mentioned by the author, just skip the checksums check:
makepkg –skipchecksums
After a long wait, the packages for various languages should have been built. Now, all you need to do is:
sudo pacman -U ./ttf-ms-win10-zh_cn-version.pkg.tar.xz
And you're done!