2015-07-20 24 views
2

我花了5小時嘗試從所有其他線程的每個解決方案,但仍然沒有工作。自定義字體不能在Phonegap

Custom Fonts in Android PhoneGap

Phonegap : Custom font is not working

How to add custom font in PhoneGap

上述所有人員犯規幫助。自定義字體適用於我的筆記本電腦上的瀏覽器,但是當我將其打包到應用程序中時,它不起作用。 Phonegap 3.7,它不適用於任何設備,但只是筆記本瀏覽器。

@font-face { 
     font-family:'AppleMyungjo'; 
src: url("/font/AppleMyungjo.ttf"); 
     src:url("/font/AppleMyungjo.ttf") format("truetype"); 
     } 

#open{ 
    position:absolute; 
    margin-left:1%; 
color:white; 
    top:10%; 
     font-size: 150%; 

font-family: 'AppleMyungjo'; 
    font-weight: lighter; 
    text-shadow: none; 

} 

我查了日誌,我有一個錯誤file:///font/AppleMyungjo.ttf Failed to load resource: net::ERR_FILE_NOT_FOUND

,但我有一個調用它裏面的TTF字體文件夾。 ttf喜歡這個權利? enter image description here

我只是想引用所有這些仍無法正常工作

@font-face { 
     font-family:'AppleMyungjo'; 
src: url("/font/AppleMyungjo.ttf"); 
      src:url("/css/font/AppleMyungjo.ttf") format("opentype"); 
      src:url("/css/font/AppleMyungjo.ttf") format("truetype"); 
      src:url("../font/AppleMyungjo.ttf") format("opentype"); 
      src:url("../font/AppleMyungjo.ttf") format("truetype"); 

     src:url("../css/font/AppleMyungjo.ttf") format("opentype"); 
      src:url("../css/font/AppleMyungjo.ttf") format("truetype"); } 

無法解碼下載的字體: 我應該怎麼辦?

+0

http://stackoverflow.com/questions/23729035/how-to-embed-font-style-in-android-mobile/23730255#23730255 –

+0

現在我有錯誤無法解碼下載的字體: – John

+0

你在哪裏放置你的字體? – Eric

回答

2

嘗試此操作:問題出在通過外部css文件提供字體時所採用的路徑。爲了解決這個問題,聲明的字體嵌入URL index.html中

<div> 
     <style scoped> 
     @font-face { 
      font-family: Monotype Corsiva; 
      src: url('fonts/Monotype_Corsiva.ttf') format('truetype'); 
     } 
     </style> 
</div> 

的身體它以這種方式宣告字體URL之後的工作。