How to add custom fonts manually

Hey there, As I understood due to busy schedule, adding native solution for custom fonts is getting delayed. But can you share any other way for now to do this manually, until the native feature comes?

1 Like

We can achieve this with use of github + jsdelivr cdn.

Here’s a video tutorial:

Here’s examples of what I’ve showed in video:

<style>
    @font-face {
        font-family: 'Helvetica';
        src: url('https://cdn.jsdelivr.net/gh/MrHimiko/fonts/Helvetica.ttf') format('truetype');
        font-weight: 400; 
    }

    @font-face {
        font-family: 'Helvetica';
        src: url('https://cdn.jsdelivr.net/gh/MrHimiko/fonts/Helvetica-Bold.ttf') format('truetype');
        font-weight: 700; 
    }
</style>

Your custom jsdelivr link should be:
https://cdn.jsdelivr.net/gh/<git_username>/<git_repository-name>/<file-name>


Font type formats:

  1. TrueType Font (TTF)
  • File extension: .ttf
  • Format string: truetype
  • Usage in CSS: url('font-file.ttf') format('truetype')
  1. OpenType Font (OTF)
  • File extension: .otf
  • Format string: opentype
  • Usage in CSS: url('font-file.otf') format('opentype')
  1. Web Open Font Format (WOFF)
  • File extension: .woff
  • Format string: woff
  • Usage in CSS: url('font-file.woff') format('woff')
  1. Web Open Font Format 2.0 (WOFF2)
  • File extension: .woff2
  • Format string: woff2
  • Usage in CSS: url('font-file.woff2') format('woff2')
2 Likes

Thank You so much for this quick resolution. This will work fine for now, until the native feature comes…
kudos :pray:

I managed to add the fonts I needed, but it doesn’t show the option on the font selector after added, it only works if edit each element CSS, changing the fort family name, is there a way to make it possible to select it from the font selector?

Yes, custom fonts added this way will not show in dropdown of fonts, you need to add it manually through CSS.

So what you can do is select global body, go to custom css and set:
font-family: 'FontName'

Here’s a quick tutorial, just instead writing ‘Inter’ which was in my case, you need to write name of your font. Adding font this way will apply this font to all of your tags on website.

1 Like