Custom font

Note: These docs were adopted from the original Motion Canvas docs

Loading fonts from the web​

To use a font from hosters like Google Fonts. First make a css file under src

root
└─src
  ├─scenes/
  ├─revideo.d.ts
  ├─project.meta
  ├─project.ts
+ └─global.css

Inside global.css, import the font using @import url(your link).

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');

Then, in project.ts, import the css file.

import {makeProject} from '@revideo/core';

import example from './scenes/example?scene';

import './global.css'; // <- import the css

export default makeProject({
  scenes: [example],
});

Now you can reference the fonts in the fontFamily property in this project.

Loading fonts from local​

For local fonts, make a directory fonts and put your font inside it.

Inside global.css, import the font using @font-face.

Notice the name of the font will match the string in @font-face/font-family from the css.

Last updated