Angularjs Ionic3中的自定义字体
我正在使用Ionic3:Angularjs Ionic3中的自定义字体,angularjs,angular,ionic2,ionic3,Angularjs,Angular,Ionic2,Ionic3,我正在使用Ionic3: Your system information: Cordova CLI: 6.4.0 Ionic Framework Version: 3.0.1 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 1.3.0 ios-deploy version: Not installed ios-sim version: Not installed OS: mac
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.3.1 Build version 8E1000a
我有以下字体:Ormont\u Light.ttf
如上所示,我尝试在app.scss
文件中应用此新字体。然而,我似乎无法使它生效
如您所见,它仍然使用离子默认值:
font-family: "Roboto", "Helvetica Neue", sans-serif;
问题
请告诉我如何使用爱奥尼亚3中的ttf
文件实现新字体
更新
我补充如下:
@font-face {
font-family: Ormont_Light;
src: url(../assets/fonts/Ormont_Light.ttf) format("ttf");
font-weight: normal;
font-style: normal;
}
body {
font-family: Ormont_Light !important;
}
现在,我在源代码中显示字体:
body {
font-family: Ormont_Light !important;
}
但它并没有像预期的那样在全球范围内应用于该应用程序
更新
变量。scss
$font-family-base: "Ormont_Light";
$font-family-ios-base: $font-family-base;
$font-family-md-base: $font-family-base;
$font-family-wp-base: $font-family-base;
谢谢,这样行得通。它现在也在运用我所有的风格,这很好。i、 e.dom
现在有:
body {
font-family: Ormont_Light !important;
}
但是显示的字体使用的是Times New Roman
字体,我猜这是浏览器在找不到引用的字体时的默认字体。所以我想我的.ttf
文件路径不正确
您将.ttf
文件保存在哪里?您需要覆盖该文件。
您需要在src/theme/variables.scss
中添加此字体
@font-face {
font-family: 'Ormont_Light';
src:url('../assets/fonts/Ormont_Light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
$font-family-base: "Ormont_Light";
$font-family-ios-base: $font-family-base;
$font-family-md-base: $font-family-base;
$font-family-wp-base: $font-family-base;
谢谢你的更新。它帮了我很大的忙,就像一个符咒!