How Linux system renders Chrome browser fonts

Time: 2017-05-19Source: Huajun News NetworkAuthor: Itachi Uchiha

This article will introduce how the Linux system renders the fonts of the Chrome browser.

How Linux system renders Chrome browser fonts

Chrome's font rendering relies on two things: the font rendering settings of the Linux operating system and Chrome's own web page font rendering control.

In the Fedora 22 GNOME 3.16 environment, even if gnome-tweak-tool is used to set the font rendering fine-tuning to none and anti-aliasing to Rgba, it has no effect on Chrome. Chrome still uses the "full" fine-tuning mode for font rendering, which causes many Chinese fonts to be displayed ugly. The reason is that Chrome reads the Linux system fontconfig configuration. By default, the font global hint is not configured in the system fontconfig, so we only need to create a local.conf in the /etc/fonts directory and write the following content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>false</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>none</const>
</edit>
</match>
</fontconfig>

After saving, you can find that all programs in the system can follow this setting. If the font rendering fine-tuning is turned off, the Chinese font rendering will look very good. Next, install the stylish plug-in in Chrome and create a style that is valid for all websites. Its application scope is "all" and the content is as follows:

body * {

font-family: "Source Han Sans CN"! important;

}

pre, code, kbd, samp, var {

font-family: "Monospace", "Source Han Sans CN"! important;

}

This ensures that Chrome will use this style for any website it visits.

       Okay, the above is all the content brought to you by the editor of Huajun. Isn’t it very simple? Have you learned it? If you want to know more related content, please pay attention to Huajun information at any time. Welcome to Huajun to download!

Related articles更多>>

Popular recommendations