Import custom fonts to Astro
17 Jan, 2025
To use custom font in Astro, you can follow their documentationto register the font as below:
@font-face {
font-family: 'DistantGalaxy';
src: url('/fonts/DistantGalaxy.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
If your font is a .ttf, and you change the code to format(‘ttf’) it will not work. Should be format(‘true type’)