Adding a new font

Hi all,

I’m trying to add a custom font by follwing this tutorial (and other posts in this forum):

https://invoice-ninja.readthedocs.io/en/latest/configure.html#custom-fonts

I made it until the creation of public/js/vfs_fonts/AntiqueOliveStd.js.

However, I just can’t find how to move on. Where and how can I add the font to database/seeds/FontsSeeder.php, run php artisan db:seed --class=FontsSeeder and clear the cache by adding ?clear_cache=true to the end of the URL.

Sorry for the stupid questions, but I’m a newbie in this field.

Thank you for your help!

Hi,

Those are the v4 docs but it looks like you’re using v5.

Yes, that’s right. So it no longer works?

In v5 you can change this line in the includes tab of a custom design.

@import url($font_url);

1 Like

Thank you very much. Is there any documentation on what exactly I can import? Can I just import an otf from any server that is publicly accessible?

There isn’t documentation for this.

I believe it should work.

Many thanks. I will try and let you know.

I found something way easier. Go to https://www.base64encode.org/ and upload your font.

After that you can just use the font like this:
@font-face {
font-family: ‘YOUR_FONT’;
src: url(data:font/opentype;charset=utf-8;base64,YOUR_BASE64_STRING_HERE);
font-weight: normal;
}

You can use that as in any CSS instance.

1 Like

That Base64 encoding trick is such a lifesaver! I spent way too much time fighting with the grunt dump_dir command and file permissions before finding that. It’s so much cleaner to just embed the font directly into the CSS editor.