6


I'm trying to use custom font in phone gap using-

@font-face {
font-family: "customfont";
src: url("./fonts/CFBacktoSchool-Regular.ttf") format("truetype");   
}
body {
    font-family: "customfont";
}

but it does not work for me.
What is the problem? Help me please!

Andy
  • 643
  • 5
  • 17
  • possible duplicate of [Custom Fonts in Android PhoneGap](http://stackoverflow.com/questions/12454681/custom-fonts-in-android-phonegap) – Sebastian Mach Oct 24 '14 at 09:25

2 Answers2

2

finally I overcome this issue on Persian And Arabic custom fonts,

Keep all the codes with @fontface as same as it is, Download this package http://averta.net/labs/fa/?p=10

From extracted archive, add bifon-1.1b.js to your html and use this script

function onDeviceReady() {

    $('#txt1').text(FarsiStyle.convert('سلام عليكم').split('').reverse().join('').split(' ').reverse().join(' '));

} 

which txt1 is a div or span.

Reza
  • 18,865
  • 13
  • 88
  • 163
0

The possible issues lies in default index.css in cordova. Check if the body element has style defined for "text-transform:uppercase".

Atleast that was the issue for me, after removing this from body element in default index.css if you are using in your application, may help you as well.

For me I was using gurmukhi/punjabi fonts, and after the above line removal from index.css it just worked like charm with below css definiitions only

Example :

.demo {
   font-family: anmol
}
@font-face {
   font-family: anmol;
   src: url(../fonts/anmol.ttf);
}
Ajeet Singh
  • 417
  • 7
  • 23