Skip to content

Instantly share code, notes, and snippets.

@anujkumarnath
Last active March 2, 2025 10:44
Show Gist options
  • Save anujkumarnath/c703787d1ef70a322e6b8eeb7676ef44 to your computer and use it in GitHub Desktop.
Save anujkumarnath/c703787d1ef70a322e6b8eeb7676ef44 to your computer and use it in GitHub Desktop.
How to create your own Nerd Fonts.

The steps are written assuming you are in a Ubuntu distro. Please adjust the installation instructions according to your distros. Follow the official docs for other environments.

Steps:

  1. Make sure you have python3 installed in your system

  2. Download the required script and helper files: archive

  3. Extract the zip file

  4. Collect the source font files and put them somewhere in a folder

  5. Download the dependencies: sudo apt install fontforge python3-fontforge

  6. If your default python version is not set to Python 3, open the font-patcher file from the extracted directory and change the first line: from #!/usr/bin/env python to #!/usr/bin/env python3

  7. Now execute the following command:

    ./font-patcher --complete --adjust-line-height --out , <DESIRED OUTPUT LOCATION> <FONT FILE PATH>

    Example: ./font-patcher --complete --adjust-line-height --out output/ fonts/JetBrainsMono-Regular.ttf

You should see the output something like this:

Adding 169 Glyphs from Octicons Set
╢████████████████████████████████████████╟ 100%
Adding 1 Glyphs from Octicons Set
╢████████████████████████████████████████╟ 100%
Adding 1 Glyphs from Octicons Set
╢████████████████████████████████████████╟ 100%
Adding 139 Glyphs from Octicons Set
╢████████████████████████████████████████╟ 100%

You may see some messages like the following, somewhere during the execution:

The glyph named ampersand is mapped to U+F0A8D.
But its name indicates it should be mapped to U+0026.
The glyph named diamond is mapped to U+F0B8A.
But its name indicates it should be mapped to U+2666.
The glyph named bullet is mapped to U+F0CF3.
But its name indicates it should be mapped to U+2022.
The glyph named comma is mapped to U+F0E23.
But its name indicates it should be mapped to U+002C.
The glyph named rectangle is mapped to U+F0E5E.
But its name indicates it should be mapped to U+25AD.

But you can ignore most of them.

After this you should be able to install the output font files in your desired environment.


To patch a lot of font files in a folder together, you can write a script say (patch-all):

for file in <PATH TO THE FOLDER CONTAINTING THE SOURCE FONTS>/*.<FONT FILE EXTENSION>'
        do
                ./font-patcher --complete --adjust-line-height --out output/ $file
        done

For example:

for file in fonts/*.ttf
        do
                ./font-patcher --complete --adjust-line-height --out output/ $file
        done

Don't forget to make the script executable with the following command:

chmod +x <YOUR SCRIPT NAME>

You can now run your script like this:

./patch-all

to create the output font files in your specified output location

@griimick
Copy link

griimick commented Sep 4, 2023

Thanks 🙏

@RandomMonkey99
Copy link

I am on Windows
Can you help me ?

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