The github does not support custom fonts in README.md. Thus to use custom fonts, we need to use other methods.
The Github README files are essentially markdown files thus it supports embedding SVG images. One of the SVG pros is that you can make updates to the SVG images and they will be rendered in the README.md files.
So let us talk about how to embed SVG. From the docs we know that github usually strips out any external resources when rendering the README.md files, which accounts for the reason why the @import
does not work.
Thus we need to embedding font data using Base64 encoding. So we need to convert the TTF file to Base64 encoding. You can try this website
Then it will generate the SVG code in the css and html, you can merge them into the SVG file. Take my project as an example. And introduce the SVG file into the README.md file. You can change the SVG path to follow the system.