概要
Guide for improving Arch Linux font rendering, emoji support, and font fallback for a cleaner desktop experience.
デザイン・メディア計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルArch Linux Font Improvement Guide
Table of Contents
- Synopsis
- Improving Font Rendering and Compatibility on Arch Linux
- Sources
- License
Synopsis
After installing Arch Linux, you may wonder why the fonts in Arch Linux look so bland compared to Windows and macOS. The reason is that out of the box, Arch Linux doesn't implement many font rendering techniques to make the fonts look clear and legible. Essentially, there isn't much happening behind the scenes, so the text appears rather plain. Additionally, some apps or websites may display tofu (□) due to missing font support. Fortunately, these issues are relatively easy to fix, and this guide will discuss the solutions.
[!TIP] Arch has actually started enabling a couple of these improvements by default in recent years. Basic hinting (
hintslight) and LCD filtering now come pre-enabled out of the box on a fresh install. So fonts aren't quite as bare as they used to be, but there's still plenty of room for improvement, which is what the rest of this guide covers.
[!CAUTION] The following tweaks should work fine for most people, but as with anything in life, results may vary. If you need further assistance, feel free to leave a comment or consult the Arch Wiki. Furthermore, if you wish not to have any emoji support, be sure to ignore packages ending in or containing the word "emoji" and remove them if present.
[!NOTE] These tips were created specifically for Arch Linux, but they should work for other Linux distributions with slight modifications. If something doesn't work for your particular distro, please use your distro's official documentation or support forum(s).
Improving Font Rendering and Compatibility on Arch Linux
Step 1: Install Recommended Fonts
Download and install the recommended fonts.
[!TIP] If the fonts aren't available in the main repositories, check the AUR.
Recommended Fonts
sudo pacman -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra
Optional but Highly Recommended Fonts
sudo pacman -S ttf-liberation ttf-dejavu ttf-roboto
Available on the AUR
[!TIP] For AUR packages you'll have to either install them manually or use an AUR helper. In this guide, I'll be using paru, but feel free to use whatever you want.
[!CAUTION]
ttf-symbola's upstream file is hosted on the font author's personal site, which frequently goes down or 404s. If the build fails, try building it again later.
paru -S ttf-symbola
Popular Monospaced Fonts
sudo pacman -S ttf-jetbrains-mono ttf-fira-code ttf-hack adobe-source-code-pro-fonts
Step 2: Create XML Configuration File
Create a local or global XML file to apply font rendering effects.
Global directory: /etc/fonts/local.conf
Per user directory: ~/.config/fontconfig/fonts.conf
Example XML File
[!TIP] Feel free to modify this XML file if you don't need emoji support or certain features. If you don't know what you're doing, just leave it as is.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<!-- Apply text rasterization, hinting, and anti-aliasing -->
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="lcdfilter" mode="assign">
<const>lcddefault</const>
</edit>
</match>
<!-- Configure default fonts & fallback fonts -->
<!-- Replace fonts with preferred fonts -->
<!-- Noto Color Emoji allows for emojis to render in all apps including the terminal, remove it if not needed -->
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias>
<family>sans</family>
<prefer>
<family>Noto Sans</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
<alias>
<family>mono</family>
<prefer>
<family>Noto Sans Mono</family>
<family>Noto Color Emoji</family>
</prefer>
</alias>
</fontconfig>
Step 3: Disable Bitmap Fonts
Bitmap fonts are used as fallbacks for some fonts. This can lead to some very blurry, pixelated, or abnormally large fonts. Some users have reported Microsoft fonts being affected by this, and therefore it's recommended for users to disable bitmap fonts on a per font basis or globally. Be careful with disabling it globally as it may break some fonts (additional testing is required). According to the Arch Wiki, users may use the 70-no-bitmaps-except-emoji.conf preset to disable this behavior or use an XML file instead.
Path: ~/.config/fontconfig/conf.d/20-no-embedded.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
</fontconfig>
[!NOTE] This excerpt was taken directly from the Arch Wiki so all credit goes to the Arch Wiki and all of its contributors.
[!TIP] Newer
fontconfigversions ship a ready-made preset for exactly this case, so you can skip writing XML by hand:sudo ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps-except-emoji.conf /etc/fonts/conf.d/Use the XML version below instead if you want finer control over which bitmap fonts (besides emoji) get kept.
[!TIP] If emojis stop working after using the previous XML file, then feel free to use this one instead:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
<match target="font">
<test name="family" qual="any">
<string>Noto Color Emoji</string>
</test>
<edit name="embeddedbitmap" mode="assign">
<bool>true</bool>
</edit>
</match>
</fontconfig>
Step 4: Configure X11 Settings (Only for X11)
[!NOTE] If you are using Wayland, you can skip this step as these settings are handled by Fontconfig or the compositor directly.
Install xorg-xrdb (if needed).
sudo pacman -S xorg-xrdb
Edit the ~/.Xresources file OR create one if not present.
[!TIP] Backup the file just in case.
vim ~/.Xresources
[!TIP] Replace
vimwith your preferred text editor.
Add the following lines to that file and save changes.
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintslight
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
Run this command when finished.
xrdb -merge ~/.Xresources
Step 5: Create Symbolic Links
Create required symbolic links for text rendering effects to work:
[!NOTE] On current Arch installs,
10-hinting-slight.confand11-lcdfilter-default.confare usually already enabled by default (fontconfig now pre-links some presets via/usr/share/fontconfig/conf.default/). If you seeFile existsfor those two, that just means they're already active, so there's nothing to fix.10-sub-pixel-rgb.confis typically the only one still missing. The-fflag below makes all three commands safe to run regardless.
sudo ln -sf /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
sudo ln -sf /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/
sudo ln -sf /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
Step 6: Edit freetype2.sh File
[!NOTE]
truetype:interpreter-version=40has been Arch's default since FreeType 2.7, so on a stock system this step currently has no visible effect. It's still worth doing explicitly if you (or a different guide) previously set a different interpreter version and want to reset it back to the default.
Edit the freetype2.sh file.
sudo vim /etc/profile.d/freetype2.sh
Uncomment the following line from the file.
export FREETYPE_PROPERTIES="truetype:interpreter-version=40"
Step 7: Refresh Font Cache
Fontconfig-aware software normally refreshes the cache when needed, so this step is usually unnecessary. If you want to rebuild the cache manually, run:
fc-cache -fv
Step 8: Restart Applications
Restart any applications that were already running so they load the new Fontconfig configuration. A full system reboot is normally unnecessary.
Optional Steps
Add the following line to your "/etc/environment" file.
FREETYPE_PROPERTIES="cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"
[!NOTE] This command enables stem darkening, which slightly thickens font "stems" to improve contrast and readability on low-DPI monitors. This results in a "richer" look similar to macOS font rendering.
cff:no-stem-darkening=0enables it for OpenType/CFF fonts.autofitter:no-stem-darkening=0enables it for other fonts (like TrueType) when using the auto-hinter.- Setting these to
0(false) enables the feature because the property is named "no-stem-darkening".
Sources
https://wiki.archlinux.org/title/Font_configuration
https://wiki.manjaro.org/index.php/Improve_Font_Rendering
https://www.freetype.org/freetype2/docs/reference/ft2-properties.html#no-stem-darkening
License
関連プロジェクトを探す
読み込み中…