Phonegap : Custom font is not working

2019-06-17 06:14发布

问题:

I am doing an application in PhoneGap using custom font style. The font style is taking in browser , but not taking in Android phone.

<style>    
 @font-face {
        font-family: 'CooperStd';
        src: url('fonts/cooperblackstd.eot');
        src: url('fonts/cooperblackstd.eot?#iefix') format('embedded-opentype'),
            url('fonts/cooperblackstd.woff') format('woff'),
            url('fonts/cooperblackstd.ttf')  format('truetype'),
            url('fonts/cooperblackstd.svg#CooperBlackStd') format('svg');
        font-weight: 900;
        font-style: normal;
    }


body{font-family:'CooperStd' , arial ;   }

</style>

I checked the font path , it is correct also check console in browser. There is no error that I found.

Thanks in advance

回答1:

Can you try relative path from root folder, i.e instead of:

src: url('fonts/cooperblackstd.eot');

try

src: url('/fonts/cooperblackstd.eot');

presuming fonts is a folder at the same level as your .html file under the www folder.

Regards,