Angular 爱奥尼亚的自定义字体问题
要求:我需要应用自定义字体 简要说明:在Angular 爱奥尼亚的自定义字体问题,angular,ionic-framework,sass,ionic2,ionic3,Angular,Ionic Framework,Sass,Ionic2,Ionic3,要求:我需要应用自定义字体 简要说明:在app.scss中,我们调用以下字体: @font-face { font-family: 'Roboto'; src: url('../assets/fonts/Roboto/Roboto-Light.ttf') format('ttf'); font-weight: normal; font-style: normal; } * { font-family: 'Roboto'; } // @font-face { //
app.scss
中,我们调用以下字体:
@font-face {
font-family: 'Roboto';
src: url('../assets/fonts/Roboto/Roboto-Light.ttf') format('ttf');
font-weight: normal;
font-style: normal;
}
* {
font-family: 'Roboto';
}
// @font-face {
// font-family: 'Humanst';
// src: url('../assets/fonts/humanst-webfont.woff2') format('woff2'), url('../assets/fonts/humanst-webfont.woff') format('woff');
// font-weight: normal;
// font-style: normal;
// }
// * {
// font-family: 'Humanst' !important;
// }
当我们使用ionic-service
时,此字体不适用,如果我们注释Roboto字体代码并取消注释Humanst,菜单图标、后退图标和所有其他图标也会消失[见左上角和右上角],如下图所示
为什么会这样
转到
变量.scss
&在文件末尾添加以下代码:
@font-face {
font-family: 'Humanst';
src: url('../assets/fonts/humanst-webfont.woff2') format('woff2'), url('../assets/fonts/humanst-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
$font-family-base: 'Humanst';
$font-family-ios-base: 'Humanst';
$font-family-md-base: 'Humanst';
$font-family-wp-base: 'Humanst';
!重要信息
只能作为最后手段使用,否则将覆盖所有内容 您可以执行与使用字体awsome相同的过程