【发布时间】:2018-09-08 05:45:26
【问题描述】:
我无法在 ubuntu 中将波斯字体添加到我的 Next.js 中,我的字体 url 是 :static/Fonts/IRANSansWeb.eot 。我使用了 dangerouslySetInnerHTML 但仍然无法在 ubuntu 中工作。我不明白为什么在 mac os 中工作
font URL - 我在我的代码中试过这个:
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>
);
【问题讨论】:
-
我试过@font-face 并在mac os 中工作,但在ubuntu 中仍然无法工作。
-
您好,请问您可以编辑您的问题以显示您尝试过的内容吗?
-
@Clément Prévost 当然是的。
-
你把这段代码放在哪里了? html 中呈现了什么?
-
另外,您的
Fonts文件夹在哪里?
标签: ubuntu fonts persian next.js