Windows 10 font on Arch

Japanese font for Linux is quite limited. It is always easier to just install windows font to have all the font needed to view websites pretty. Here is how to install windows font on Linux.
# Please note, that usage of Microsoft fonts outside running Windows
# system is prohibited by EULA (although in certain countries EULA is invalid).
# Please consult Microsoft license before using fonts.

1. Install following necessary packages for building
sudo pacman -S fontconfig xorg-fonts-encodings xorg-mkfontscale xorg-mkfontdir

2. Get the font from windows. In my case, I make a tar ball of C:\Windows\Fonts directory and send to Linux and untar by “tar xf Fonts.tar” command.

3. Run “ls -1 | grep -e ttf -e ttc” command in the font directory and copy the output.

2. Get ttf-ms-win10 tar.gz from AUR, and extract it and copy all font files to the extracted directory.

3. Edit PKGBUILD
i. Commend out _package() section’s second install command.

ii. Remeve all the font variables and pasted the previously copied clipboard.
_ttf_ms_win10=(
)

iii. Remove all functions excluding package_ttf-ms-win10() and _package()

iv. pkgname variable should be changed to the following.
pkgname=$pkgbase

4. Edited PKGBUILD looks like the following snippet .
pkgbase=ttf-ms-win10
pkgname=$pkgbase
pkgver=10.0.10240
pkgrel=3
arch=(any)
url='http://www.microsoft.com/typography/fonts/product.aspx?PID=164'
license=(custom)
depends=(fontconfig xorg-fonts-encodings xorg-mkfontscale xorg-mkfontdir)
provides=(ttf-font)
conflicts=(ttf-{vista,win7}-fonts)
install=$pkgbase.install

_ttf_ms_win10=(
arialbd.ttf
.
.
)

source=(${_ttf_ms_win10[@]/#/file://}

sha256sums=(…
)

_package() {
conflicts+=(${pkgname/10/8})

for font in $@; do
install -Dm644 $font -t “$pkgdir/usr/share/fonts/TTF”
done
}

package_ttf-ms-win10() {
pkgdesc=’Microsoft Windows 10 TrueType fonts’
provides+=(ttf-tahoma ttf-ms-fonts)
conflicts+=(ttf-tahoma ttf-ms-fonts)
_package ${_ttf_ms_win10[@]}
}

# vim: ts=4 sw=4 et

5. Leave .install file as it is.
post_install() {
fc-cache -s
mkfontscale usr/share/fonts/TTF
mkfontdir usr/share/fonts/TTF
}

post_upgrade() {
post_install
}

post_remove() {
post_install
}

5. Build the package by running the command below.
makepkg --skipinteg

6. Install the package.
sudo pacman -U *.pkg.tar.xz

7. Run fc-cache
fc-cache -vf /usr/share/fonts

Advertisements
Previous Post
Leave a comment

2 Comments

  1. Infinality is dead. Do you mind editing last step?

    Reply
    • Thank you for commenting on my old garbage. 🙂
      You don’t need infinality anymore, it is beautiful enough by default.
      Run just fc-cache.
      I only copy Yu-gothic from Windows 10 and run fc-cache instead of creating the package, because some windows default fonts are really ugly yet some websites request to use those fonts. I just show everything as Yu-gothic.

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: