Fonts not getting applied on android device in ionic 3 app

試著忘記壹切 提交于 2019-12-22 10:58:23

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/45810684/fonts-not-getting-applied-on-android-device-in-ionic-3-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!