如何更改 ionic 应用程序中的字体?
How can I change the font in my ionic app?
我想更改字体,但无法在 Chrome 或三星 A50、Android XI 设备上进行。如果您能指导我,我将不胜感激,谢谢!
Ionic CLI: 6.19.0
Ionic Framework: @ionic/angular 6.0.4
Cordova CLI: 11.0.0
我复制了文件夹assets/fonts中的ttf,PermanentMarker-Regular.ttf
global.scss:
@font-face {
font-family: 'Permanent Marker', cursive;
src: url('/src/assets/fonts/PermanentMarker-Regular.ttf')
}
home.scss:
ion-content h3 {
--ion-font-family: 'Permanent Marker', cursive !important;
font-size: 24px;
}
home.html:
<ion-content class="ion-padding" [style.background-image]="'url(' + img_backg + ')'">
<ion-grid>
<ion-row class="ion-text-center">
<ion-col>
<h3>{{global.titulo_principal}}</h3>
………
假设home.html是正确的,将global.scss的路径改为:
src: url('../assets/fonts/PermanentMarker-Regular.ttf')
我想更改字体,但无法在 Chrome 或三星 A50、Android XI 设备上进行。如果您能指导我,我将不胜感激,谢谢!
Ionic CLI: 6.19.0
Ionic Framework: @ionic/angular 6.0.4
Cordova CLI: 11.0.0
我复制了文件夹assets/fonts中的ttf,PermanentMarker-Regular.ttf
global.scss:
@font-face {
font-family: 'Permanent Marker', cursive;
src: url('/src/assets/fonts/PermanentMarker-Regular.ttf')
}
home.scss:
ion-content h3 {
--ion-font-family: 'Permanent Marker', cursive !important;
font-size: 24px;
}
home.html:
<ion-content class="ion-padding" [style.background-image]="'url(' + img_backg + ')'">
<ion-grid>
<ion-row class="ion-text-center">
<ion-col>
<h3>{{global.titulo_principal}}</h3>
………
假设home.html是正确的,将global.scss的路径改为:
src: url('../assets/fonts/PermanentMarker-Regular.ttf')