add custom font to a cordova project -


i have custom fonts use in app.

the font name myfont , files extension (myfont.eot,.myfont.svg,myfont.ttf,myfont.woff,myfont.woff2) , copied ios , android asset folder when cordova build. however, when open app on device don't see new font display.

i see new fond display when run app safari browser on mac.

here snippet css file

html, body {     overflow-x: hidden;     -webkit-tap-highlight-color: rgba(0,0,0,0);     font-family: 'myfont';     font-size: 16px; } 

is there else need in order see new font on android , ios device

thanks

use @font-face in css.

@font-face {   font-family: "my-font";   src: url("../assets/myfonts.ttf");  // give relative path css file. } 

add code css file @ top. , can use font-family my-font need it.

example:

css

.class-myfont {      font-family: my-font; } 

html

<span class="class-myfont">hello there</span> 

Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -