2016-12-27 73 views
1

我嘗試使用谷歌的字體在離子2.谷歌字體2

研究#1 &離子論壇後,我已導入字體&列入variables.scss基本如下

@import url('https://fonts.googleapis.com/css?family=Lato'); 
$font-family-base: "Lato"; 
$font-family-md-base: "Lato"; 
$font-family-ios-base: "Lato"; 
$font-family-wp-base: "Lato"; 

顯然,這不是渲染字體。我做錯了什麼或者還有什麼需要做的?

回答

0

如果這對任何人都有幫助,我需要在我的Ionic 2應用程序中顯示Google字體。這是我如何實現:

轉到https://fonts.googleapis.com/css?family=Rajdhani

獲取woff文件

到這個網址的網址並下載woff文件。把它放到你的資產/ fonts /目錄中

編輯app/app.scss並添加

@font-face { 
    font-family: 'Rajdhani'; 
    src: url('../assets/fonts/Rajdhani.woff') format('woff'); 
    font-weight: normal; 
    font-style: normal; 
} 

* { 
    font-family: 'Rajdhani'; 
}