Skip to content

Instantly share code, notes, and snippets.

@EnterTheVoid-x86
Created May 24, 2023 01:27
Show Gist options
  • Save EnterTheVoid-x86/8ee4f9abdb16c8b4505390dad4d4cc72 to your computer and use it in GitHub Desktop.
Save EnterTheVoid-x86/8ee4f9abdb16c8b4505390dad4d4cc72 to your computer and use it in GitHub Desktop.
Change system font on ChromeOS

WARNING! This will replace all use of Roboto in Chrome (and websites) with your choice of font.

Changing the system font of ChromeOS (Roboto)

-> = Replacing

Tested with Google Sans -> Roboto, example using Inter -> Roboto

1

First, download the font family of your choice. If you want to replace the ChromeOS font with one that's already included, you can skip to Chapter 3.

This example will use the Inter family available at https://fonts.google.com/specimen/Inter.

Download the font's zip, and make a new directory with the name as the font's name.

Extract the font's zip into the new directory. If it has one static folder, refer to Chapter 2. If it has a static and a variable folder, refer to Chapter 2.1.

If it has neither, and it just looks like a bunch of ttf files, refer to 2.

2

Open up a bash shell by pressing CTRL + ALT + T and typing in "shell". Now, type in "cd ~/Downloads/NameOfFontDir".

Now, type in the following:

sudo mkdir /usr/share/fonts/FontName/

sudo cp static/* /usr/share/fonts/FontName/

Verify that all of the ttf files are in the FontName directory by running:

ls /usr/share/fonts/FontName/

2.1

Follow all instructions from Chapter 2 up until the cp static part.

This time, we will instead run:

sudo cp static/ /usr/share/fonts/FontName/ && sudo cp variable/ /usr/share/fonts/FontName/

Verify that the static in variable folders are in the FontName directory by running:

ls /usr/share/fonts/FontName

3

Now we need to edit the fontconfig. This is found at /etc/fonts/local.conf

In the shell, type in "sudo nano /etc/fonts/local.conf".

Near the beginning where it says "Font directory list" add a new line (spacing intact) and type in the following:

<dir>/usr/share/fonts/FontName</dir>

Scroll all the way to the 2nd last before the end of the text with the arrow keys. (right before </fontconfig.>

Now, paste in the following.

      <test name="family"><string>Roboto</string></test>
      <edit name="family" mode="prepend" binding="strong">
          <string>NewFontName (e.g, Inter)</string>
      </edit>
  </match>

Make sure the spacing is intact, the final product will look similar to this.

  <!-- Treat Noto Color Emoji as scalable. It's scalable even though
       it's a bitmap font. -->
  <match target="scan">
    <test name="family"><string>Noto Color Emoji</string></test>
    <edit name="scalable" mode="assign"><bool>true</bool></edit>
  </match>

  <match>
     <test name="family"><string>Roboto</string></test>
     <edit name="family" mode="prepend" binding="strong">
         <string>Inter</string>
     </edit>
 </match>
</fontconfig>

Press CTRL + O to save your changes. Then, press CTRL + X to exit.

Finally, run sudo fc-cache -fv in the shell. If no errors are reported, then all should be well. Reboot your chromeOS device or type chrome://restart into the URL bar on Chrome, and say hello to the new font!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment