Home > Back-end >  How can I change the font in my ionic app?
How can I change the font in my ionic app?

Time:05-17

I want to change the font, but I can't do it on Chrome or Samsung A50, Android XI device. I will appreciate any help you can guide me, thanks!

Ionic CLI: 6.19.0
Ionic Framework: @ionic/angular 6.0.4
Cordova CLI: 11.0.0

I copied the ttf in the folder assets/fonts, 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  [style.background-image]="'url('   img_backg   ')'">
  <ion-grid>
    <ion-row >
      <ion-col>
        <h3>{{global.titulo_principal}}</h3>
………

CodePudding user response:

Assuming that home.html is correct, change the path of global.scss to the following:

src: url('../assets/fonts/PermanentMarker-Regular.ttf')
  • Related