2013-02-05 50 views
0

我有一個網站,以一種奇怪的方式使用cufon字體(至少我以前沒有見過)。我試圖改變這些字體,因爲它們很奇怪。寫入只是顯示一個簡單的「庫存產品」的代碼是:無法更改Cufon字體

<h2><cufon class="cufon cufon-canvas" alt="Stock " style="width: 68px; height: 26px; "><canvas width="93" height="29" style="width: 93px; height: 29px; top: -3px; left: -3px; "></canvas><cufontext>Stock </cufontext></cufon><cufon class="cufon cufon-canvas" alt="Products" style="width: 96px; height: 26px; "><canvas width="116" height="29" style="width: 116px; height: 29px; top: -3px; left: -3px; "></canvas><cufontext>Products</cufontext></cufon></h2> 

他們只包括在頭一個cufon.js文件。

我試圖替換的字體是這樣的:

<script src="scripts/cufon-yui.js" type="text/javascript"></script>--> 
<script src="scripts/Adobe_Fan_Heiti_Standard_OpenType_600.font.js" type="text/javascript"></script> 
<script type="text/javascript"> 
     Cufon.replace('h2','h1','h3','h4'); 
    </script> 

這甚至沒有工作。代碼太長,文件太多,無法在任何地方手動編輯代碼。請提出一些解決方案。

感謝提前!

回答

1

您的cufon語法似乎不正確。在開始的時候,而不是

Cufon.replace('h2','h1','h3','h4'); 

嘗試

Cufon.replace('h2'); 

根據的CufónAPI,實現你的代碼將表明,你必須使用:

Cufon.replace('h1')('h2')('h3')('h4'); 

另外,如果您在您的網站上使用jQuery或類似的JS框架,它可能是:

Cufon.replace('h1, h2, h3, h4'); 

欲瞭解更多信息,請參閱:https://github.com/sorccu/cufon/wiki/API