I am facing an issue with custom fonts. I have created an app using create-react-app and provided the custom font files (.ttf) in public folder so that while building the app, all assests are part of the build. I am able to see the font on my local but not on nginx server. Nginx server has the .ttf support since another application is working fine. What should be the miss? I am not able to find it. Also, firefox is not able to load the same custom font. Here is my stylesheet -
@font-face {
font-family: 'Simplied';
src: url('/fonts/simplied-Light.ttf') format('truetype');
}
which i import in another css file using @import 'stylesheet.css'.
P.S Thanks for the comment. I made the change like this -
// ./index.css
@font-face {
font-family: 'Simplified_Lt';
font-display: block;
src: local('Simplified_Lt') url(./fonts/Simplified_Lt.ttf) format('truetype');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body {
margin: 0;
font-family:'Simplified_Lt';
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
and my fonts folder is under src/fonts/. But i am still not able to use the font.Can you please point out to me what could have been missed or if project structure is correct? I am using create-react-app.