离子3应用程序中的Android设备上没有应用字体 [英] Fonts not getting applied on android device in ionic 3 app
本文介绍了离子3应用程序中的Android设备上没有应用字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为android应用程序应用我的自定义字体。所以我修改了src / theme / variables.scss并添加了以下几行:
@ font-face {
font-family:AppFont;
src:url(../ assets / fonts / RobotoCondensed-Regular.ttf);
body,span,button,h1,h2,h3,h4,h5,h6,p,ion-item,ion-title {
font-family:' AppFont'!重要;
}
$ font-family-base:'AppFont';
$ font-family-ios-base:'AppFont';
$ font-family-md-base:'AppFont';
$ font-family-wp-base:'AppFont';
当我运行 ng serve
时,字体正在得到正确应用,但是当我部署到设备字体已经消失。这怎么解决。
解决方案
问题在于离开资产/字体的字体没有采用ionic-cli-3.9.2,所以我移动字体到/资产。然后开始工作很烦人。
I'm trying to apply my custom font for android application. So I have modified the src/theme/variables.scss and added the following lines:
@font-face {
font-family: AppFont;
src: url("../assets/fonts/RobotoCondensed-Regular.ttf");
}
body, span, button, h1, h2, h3, h4, h5, h6, p, ion-item, ion-title {
font-family: 'AppFont' !important;
}
$font-family-base: 'AppFont';
$font-family-ios-base: 'AppFont';
$font-family-md-base: 'AppFont';
$font-family-wp-base: 'AppFont';
and when I run ng serve
the fonts are getting applied correctly but when I deploy it to device fonts are gone. How can this be resolved.
解决方案
Problem was with ionic-cli-3.9.2 which is not picking the fonts from assets/fonts so i moved the fonts to /assets. Then it started working very annoying.
这篇关于离子3应用程序中的Android设备上没有应用字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文