I can't add Persian Fonts to my Next.js in ubuntu and my fonts url is :static/Fonts/IRANSansWeb.eot . I used dangerouslySetInnerHTML but still not working in ubuntu.I dont understand why works in mac os
font URL -I tried this in my code:
return (
<html lang="en" dir="rtl">
<Head>
<title>فراخوان نقد</title>
<meta charSet="utf-8" />
{/* Use minimum-scale=1 to enable GPU rasterization */}
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>
{/* PWA primary color */}
<meta name="theme-color" content={pageContext.theme.palette.primary.main} />
{/* <link
rel="stylesheet"
href="https://fonts.googleapis.com/css?
family=Roboto:300,400,500"
/> */}
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-
alpha.6/css/bootstrap.min.css"
/>
<style dangerouslySetInnerHTML={{__html: `
@font-face {
font-family:
'IranSans,tahoma';
font-style:
normal;
font-weight:
400;
src:
url("../static/Fonts/IRANSansWeb.eot");
src:
url("../static/Fonts/IRANSansWeb.eot?#iefix")
format('embedded-opentype'),
url("../static/Fonts/IRANSansWeb.woff2")
format('woff2'),
url("../static/Fonts/IRANSansWeb.woff")
format('woff'),
url("../static/Fonts/IRANSansWeb.ttf")
format('truetype');
}
body{
font-family:
'IranSans, tahoma' !important
}
`}}/>
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
One solution requiring ontfaceobserver. change fonts according to your choice
Fonts.js
Then on my index.js