Linux font cache update

Rebuild Font Cache on Linux

When you add fonts, for instance to your ~/.fonts folder, you’ll need to force rebuild the font cache.

Help docs

fc-cache --help Build font information caches in [dirs] (all directories in font configuration by default). -f, --force scan directories with apparently valid caches -v, --verbose display status information while busy 

Rebuild

We can force it to re scan the valid caches to find our new fonts.

➜ fc-cache -f -v Font directories: /usr/share/fonts /usr/local/share/fonts /home/rockerboo/.config/local/share/fonts /home/rockerboo/.fonts /usr/share/fonts/100dpi /usr/share/fonts/75dpi /usr/share/fonts/OTF /usr/share/fonts/TTF /usr/share/fonts/adobe-source-code-pro /usr/share/fonts/cantarell /usr/share/fonts/encodings /usr/share/fonts/gnu-free /usr/share/fonts/gsfonts /usr/share/fonts/liberation /usr/share/fonts/nerd-fonts /usr/share/fonts/noto /usr/share/fonts/tex-gyre /usr/share/fonts/util /usr/share/fonts/wenquanyi /home/rockerboo/.fonts/otf /home/rockerboo/.fonts/public-sans /usr/share/fonts/encodings/large /usr/share/fonts/wenquanyi/wqy-zenhei /home/rockerboo/.fonts/public-sans/otf /usr/share/fonts: caching, new cache contents: 0 fonts, 15 dirs /usr/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs /usr/share/fonts/75dpi: caching, new cache contents: 398 fonts, 0 dirs /usr/share/fonts/OTF: caching, new cache contents: 14 fonts, 0 dirs /usr/share/fonts/TTF: caching, new cache contents: 304 fonts, 0 dirs /usr/share/fonts/adobe-source-code-pro: caching, new cache contents: 30 fonts, 0 dirs /usr/share/fonts/cantarell: caching, new cache contents: 11 fonts, 0 dirs /usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/gnu-free: caching, new cache contents: 12 fonts, 0 dirs /usr/share/fonts/gsfonts: caching, new cache contents: 35 fonts, 0 dirs /usr/share/fonts/liberation: caching, new cache contents: 12 fonts, 0 dirs /usr/share/fonts/nerd-fonts: caching, new cache contents: 24 fonts, 0 dirs /usr/share/fonts/noto: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/tex-gyre: caching, new cache contents: 33 fonts, 0 dirs /usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/wenquanyi: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/wenquanyi/wqy-zenhei: caching, new cache contents: 3 fonts, 0 dirs /usr/local/share/fonts: skipping, no such directory /home/rockerboo/.config/local/share/fonts: skipping, no such directory /home/rockerboo/.fonts: caching, new cache contents: 0 fonts, 2 dirs /home/rockerboo/.fonts/otf: caching, new cache contents: 18 fonts, 0 dirs /home/rockerboo/.fonts/public-sans: caching, new cache contents: 20 fonts, 1 dirs /home/rockerboo/.fonts/public-sans/otf: caching, new cache contents: 18 fonts, 0 dirs /usr/share/fonts/100dpi: skipping, looped directory detected /usr/share/fonts/75dpi: skipping, looped directory detected /usr/share/fonts/OTF: skipping, looped directory detected /usr/share/fonts/TTF: skipping, looped directory detected /usr/share/fonts/adobe-source-code-pro: skipping, looped directory detected /usr/share/fonts/cantarell: skipping, looped directory detected /usr/share/fonts/encodings: skipping, looped directory detected /usr/share/fonts/gnu-free: skipping, looped directory detected /usr/share/fonts/gsfonts: skipping, looped directory detected /usr/share/fonts/liberation: skipping, looped directory detected /usr/share/fonts/nerd-fonts: skipping, looped directory detected /usr/share/fonts/noto: skipping, looped directory detected /usr/share/fonts/tex-gyre: skipping, looped directory detected /usr/share/fonts/util: skipping, looped directory detected /usr/share/fonts/wenquanyi: skipping, looped directory detected /home/rockerboo/.fonts/otf: skipping, looped directory detected /home/rockerboo/.fonts/public-sans: skipping, looped directory detected /usr/share/fonts/encodings/large: skipping, looped directory detected /usr/share/fonts/wenquanyi/wqy-zenhei: skipping, looped directory detected /home/rockerboo/.fonts/public-sans/otf: skipping, looped directory detected /var/cache/fontconfig: not cleaning unwritable cache directory /home/rockerboo/.config/cache/fontconfig: cleaning cache directory /home/rockerboo/.fontconfig: not cleaning non-existent cache directory fc-cache: succeeded 

Now your fonts will be in your font cache. Allow them to show up properly in the font list of various programs. You may need to restart a program to get it to populate in their font index.

Читайте также:  Линукс добавление статического маршрута

Источник

How to Configure Multilingual Fonts on Linux

announcement - icon

The Kubernetes ecosystem is huge and quite complex, so it’s easy to forget about costs when trying out all of the exciting tools.

To avoid overspending on your Kubernetes cluster, definitely have a look at the free K8s cost monitoring tool from the automation platform CAST AI. You can view your costs in real time, allocate them, calculate burn rates for projects, spot anomalies or spikes, and get insightful reports you can share with your team.

Connect your cluster and start monitoring your K8s costs right away:

1. Overview

In this tutorial, we’ll discuss how to configure fonts that support multiple languages on Linux. First, we’ll begin by having a general overview of how multilingual fonts on Linux work and how we can find fonts that support a specific orthography.

Afterward, we’ll learn how to install and configure these multilingual fonts using fontconfig.

2. Multilingual Fonts on Linux

Major distributions like Ubuntu and Fedora should have support for multiple languages out-of-the-box. If that is not the case, we can install a language pack for our language in the distribution settings.

However, if we have a minimal installation of these distributions or use other distributions like Gentoo, we’ll need to manually configure fonts for other languages. Therefore, it’s good to have a basic understanding of how Linux handles multilingual fonts.

When there are no suitable fonts for the target language, we’ll see placeholder characters as depicted in the image:

Linux Page on Wikipedia

As we can see, the Japanese characters don’t make much sense because there is no suitable font available for the language. In the next section, we’ll take a look at a couple of font families that support multiple languages.

Читайте также:  Arch linux office 2010

2.1. Fonts That Support Multiple Orthographies

We can install a single font package for a single target language. For instance, we can install the IPA fonts for the Japanese language—the default Japanese font on OpenSUSE. However, there might be some characters in the font file that might be missing.

For that reason, it’s usually better to have a one-stop solution for a wide range of languages. This way, we won’t see the strange ligatures on web pages that contain multiple languages.

Currently, there are two reliable multilingual font families that are free to use:

These two font families are available on most package repositories and contain many font files for a plethora of languages. Of course, there are paid solutions as well, but they are not backed up by such companies, and they are expensive.

In the next section, we’ll install and configure the Noto fonts for Ubuntu. However, this method applies to other distributions as well.

2.2. Installing Multilingual Fonts

The most straightforward way to install multilingual fonts is to use a package manager. We can search through our package repository to find the suitable names of the packages, as they might vary for different distributions.

On Ubuntu, we can use apt to install the Noto fonts:

$ sudo apt install -y fonts-noto fonts-noto-cjk

Similarly, we can also download and install the fonts manually:

$ curl -L https://github.com/notofonts/noto-fonts/archive/refs/heads/main.zip -o noto-fonts.zip

Once downloaded, we can unzip the archive and copy the relevant font files to ~/.local/share/fonts:

$ unzip noto-fonts.zip -d ~/.local/share/fonts/noto-fonts

In the same way, we can also download and install the CJK font files for Chinese, Japanese, and Korean languages.

2.3. Updating the Font Cache

Once the fonts are installed, we’ll update the font cache so that it’s available for immediate use:

Linux Page on Wikipedia (Japanese)

3. Configuring Multilingual Fonts

Sometimes, the fonts for a target language are overridden by other fonts. Therefore, the glyphs will not be rendered correctly. As an example, let’s take a look at the article below in Pashto:

Computer System Wikipedia Pashto

In this case, another font took precedence over the Noto fonts that support this language. Therefore, we’ll need to configure a Pashto font, which we’ll cover in the next section.

Читайте также:  Linux mint определение файловых систем

3.1. fontconfig Configuration

fontconfig is a utility we can use to configure fonts on a Linux machine.

The config file for fontconfig is located in ~/.config/fontconfig/fonts.conf. We can create it manually if it’s not there:

$ mkdir -p ~/.config/fontconfig&& touch ~/.config/fontconfig/fonts.conf

The fonts.conf file is a plain XML file that we can modify easily. Let’s add the following properties to the file:

     serif Noto Serif Noto Sans Arabic Joy Pixels   sans-serif Noto Sans Noto Sans Arabic Fira Sans Joy Pixels   sans Noto Sans Noto Sans Arabic Fira Sans Joy Pixels   monospace Cascadia Code Noto Sans Mono Joy Pixels   
  • all the configurations reside inside the root fontconfig tag
  • the tag creates an alias that we can refer to in applications
  • the tag specifies a font family — serif in the first instance
  • the tag specifies the order of preference

Now, we can refer to these fonts as “serif”, “sans-serif”, “sans”, and “monospace” when selecting the font in an application. fontconfig will map these names to our target fonts automatically. We can add as many fonts here as we desire. However, these should cover most languages.

For our example above, we explicitly specified Noto Fonts Arabic for our target language Pashto. Therefore, we should now see the fonts render correctly on the page:

Computer System Page on Wikipedia in Pashto

3.2. Adding Aliases for Unavailable Fonts

Oftentimes, web pages choose their own fonts for a specific language. For instance, most front-end developers will choose “Arial” for languages like Arabic and Persian. Of course, it’s their fault for not taking other platforms into account and hardcode the font name in the stylesheets.

Fortunately, we can create aliases for some of these famous font families. As an example, we’ll create an alias, “Arial”, that will be mapped to Noto fonts in our fonts.conf:

   .  Arial Noto Sans Noto Sans Arabic Joy Pixels   

Now, when we visit a page that requires the “Arial” font, the browser will render the text in Noto fonts.

4. Conclusion

In this article, we discussed how to configure fonts for multiple languages. We looked at the installation of Noto fonts, which is a one-stop solution for most languages.

Afterward, we saw how to configure multilingual fonts using fontconfig.

Источник

Оцените статью
Adblock
detector