2016-11-11 77 views

回答

3

角度材質是材質設計的實現,材質設計與Roboto字體緊密相關,正如您所提到的,文檔中沒有關於它的內容,所以我認爲通過框架無法做到這一點。

但是,您可以輕鬆更改CSS文件中的字體系列,這需要在角度材質依賴關係後包含在您的構建中。這裏有一個例子:

body { 
    font-family: "Comic Sans MS"; 
} 

input, 
button, 
select, 
textarea { 
font-family: inherit; 
font-size: inherit; 
line-height: inherit; 
} 

和演示:http://codepen.io/mattdanna/pen/pgwVzX

從這裏借:https://github.com/angular/material/issues/6561#issuecomment-170837189

+0

漫畫無敵......你的怪物! upvoted雖然;) – Keno

2

這是關於這個問題的正式文件,但它並沒有規定如何提供備份家庭類字體無法加載: https://material.angular.io/guide/typography

@import '[email protected]/material/theming'; 

// Define a custom typography config that overrides the font-family as well as the 
// `headlines` and `body-1` levels. 
$custom-typography: mat-typography-config(
     $font-family: monospace, 
     $headline: mat-typography-level(32px, 48px, 700), 
     $body-1: mat-typography-level(16px, 24px, 500) 
); 
// Override typography for all Angular Material, including mat-base-typography and all components. 
@include angular-material-typography($custom-typography); 

編輯;備份字體家族(注意引用):

$font-family: '"Sintony", Arial, sans-serif'