2014-09-23 43 views
2

我試圖在手機中爲我的應用程序製作自定義字體。Android 4.1.2中的自定義波斯語和阿拉伯語字體Phonegap(科爾多瓦)不工作

@font-face { 
font-family: 'customfont'; 
src: url('fonts/BMitra.eot?#') format('eot'), 
url('fonts/BMitra.woff') format('woff'), 
url('fonts/BMitra.ttf') format('truetype'); 
font-style: normal; 
} 
    body { 
     font-family: "customfont"; 
     font-size:30px; 
    } 

....

<body> 
    <h>Custom Fonts</h> 
    <div style="font-family: 'customfont';" id='txt1'>This is for sample</div> 
</body> 

它工作正常,紋波(鉻模擬器),但它不會對設備的工作(三星:對於這一點,我在HTML文件中寫了這個代碼安卓4.1.2)

我有googledstack-overflowed找到解決辦法,我發現這個職位font-face on android 4.0.x doesn't work它說有text-rendreing:auto,但它沒有工作過。

任何幫助,將不勝感激。

回答

5

我終於克服了波斯語和阿拉伯語的自定義字體這個問題,

把所有的代碼與@fontface爲相同的,因爲它是 下載這個包http://averta.net/labs/fa/?p=10

從中提取存檔,添加bifon-1.1b.js到您的HTML並使用此腳本

function onDeviceReady() { 

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

} 

其中txt1是div或跨度。

p。感謝Morteza F. Shojaei先生

+0

Thanx,這是解決方案。但你的鏈接無效。 這是新的鏈接: http://averta.net/labs/fa/?p=10 – SalmanShariati 2014-11-19 20:15:50

+0

@Salman謝謝我已經取代了鏈接 – RezaRahmati 2014-11-20 07:57:12

相關問題