summaryrefslogtreecommitdiff
path: root/root_scripts/font_config.sh
blob: 9f3e07bdf7a4b8af01c95781ab6db9627f6bc90b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
# Craig Jennings <c@cjennings.net>
# Script to install and configure fonts

# ensure root
if ! [ $(id -u) -eq 0 ]
then
    echo "Must run as root. Exiting."
    exit
fi

# install packaged fonts
pkg install -y noto-emoji
pkg install -y urwfonts-ttf
pkg install -y webfonts

# font utilities
pkg install -y fontconfig
pkg install -y mkfontscale


# install non-packaged fonts
mkdir -p /usr/local/share/fonts/coding

# install FiraCode Nerd Font
wget -qO- https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.1/FiraCode.zip  | \
    tar -xvf- --directory /usr/local/share/fonts/coding/

# install Hack Nerd Font
wget -qO- https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.1/Hack.zip  | \
    tar -xvf- --directory /usr/local/share/fonts/coding/

# install local font files
if  [ -d "/usr/home/$username/.local/share/fonts" ]; then
    [ ! -d /usr/local/share/fonts/misc ] && mkdir /usr/local/share/fonts/misc/
    cp ../assets/fonts/* /usr/local/share/fonts/misc/
    mkfontscale /usr/local/share/fonts/misc
fi

# don't enable antialiasing
rm  /usr/local/etc/fonts/conf.d/10-yes-antialias.conf
# don't accept bitmap fonts
rm  /usr/local/etc/fonts/conf.d/70-yes-bitmaps.conf
# don't disable sub-pixel-rendering
rm  /usr/local/etc/fonts/conf.d/10-sub-pixel-none.conf
# enable sub-pixel rendering with the RGB stripes layout
ln -s /usr/local/etc/fonts/conf.avail/10-sub-pixel-rgb.conf /usr/local/etc/fonts/conf.d/10-sub-pixel-rgb.conf
# disable hinting
ln -s /usr/local/etc/fonts/conf.avail/10-unhinted.conf /usr/local/etc/fonts/conf.d/10-unhinted.conf
# set hintnone to hintstyle
ln -s /usr/local/etc/fonts/conf.avail/10-hinting-none.conf /usr/local/etc/fonts/conf.d/10-hinting-none.conf
# index the scalable fonts
mkfontscale /usr/local/share/fonts/coding

# create font.dir file index
mkfontdir /usr/local/share/fonts/coding/

# update the font cache
fc-cache -vf