0

I am trying to use a font that is in a node_module.

My CSS file looks something like this:

  @font-face {
    font-family: 'OwnLight';
    src: url("require('font-database/fonts/Own-Light-Regulat.tff')");
  }

I also tried doing these:

  @font-face {
    font-family: 'OwnLight';
    src: url("~font-database/fonts/Own-Light-Regulat.tff");
  }
  @font-face {
    font-family: 'OwnLight';
    src: "~font-database/fonts/Own-Light-Regulat.tff";
  }
  @font-face {
    font-family: 'OwnLight';
    src: require('font-database/fonts/Own-Light-Regulat.tff');
  }

But nothing works.

Also tried appending format("truetype") on the src - also to no avail.

Any way I can do this? Thanks!

kzaiwo
  • 1,558
  • 1
  • 16
  • 45
  • First, your file extension should probably be `.ttf` instead of `.tff`. Check also if the font's name is really Own-Light-**Regulat** or is it maybe Own-Light-**Regular**? Maybe another typo? Finally, try using `src: url('font-database/fonts/Own-Light-Regulat.ttf');` – Ferris May 17 '23 at 10:02
  • Does this answer your question? [To use local font in HTML using font face](https://stackoverflow.com/questions/38086083/to-use-local-font-in-html-using-font-face) – Madan Bhandari May 17 '23 at 10:49

0 Answers0