[英]how can use custom font in ionic
嗨,我如何在我的 ionic 應用程序中使用一些自定義字體? 例如這個字體http://fontonline.ir/btitrbold.html
<link href='http://www.fontonline.ir/css/BTitrBold.css' rel='stylesheet' type='text/css'>
但如果我的應用程序離線 fonts 將無法加載我打開參考
@font-face {
font-family: 'BTitrBold';
src: url('http://fontonline.ir/fonts/BTitrBold.eot?#') format('eot'),
url('http://fontonline.ir/fonts/BTitrBold.ttf') format('truetype'),
url('http://fontonline.ir/fonts/BTitrBold.woff') format('woff');
}
我可以下載 fonts 並將其放入例如資產文件夾並更改樣式代碼以離線加載嗎?
下載您所需的字體並將其添加到您的assets/fonts
文件夾中。
Go 到你的主題文件夾打開variable.scss
文件
導入您的字體,例如:
@font-face {
font-family: 'YOUR_FONT_NAME';
src: url('../assets/fonts/YOUR_FONT_NAME.ttf');
font-weight: normal;
font-style: normal;
}
如果您想將其用於整個應用程序,請將其添加到您的global.scss
文件中
例如:
* {
font-family: 'YOUR_FONT_NAME'; // font-family name you declared above.
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.