我想爲我的圖表指定一個自定義的CSS字體,它是通過Google Visualization API生成的。我已經盡我的CSS樣式表內speccing字體都,以及使用谷歌的fonts.googleapis.com如何在Google Visualization API中指定自定義CSS字體/字體系列?
我的谷歌可視化API chartOptions內:
var options = {
fontName : 'FranchiseRegular',
tooltip: { textStyle: { fontName: 'Verdana', fontSize: 12 } }
};
我的style.css內
:
@font-face {
font-family: 'FranchiseRegular';
src: url('/_fonts/franchise-bold-webfont.eot');
src: url('/_fonts/franchise-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('/_fonts/franchise-bold-webfont.woff') format('woff'),
url('/_fonts/franchise-bold-webfont.ttf') format('truetype'),
url('/_fonts/franchise-bold-webfont.svg#FranchiseRegular') format('svg');
font-weight: normal;
font-style: normal;
}
我的頭標籤內
:
<link href='http://fonts.googleapis.com/css?family=Magra:400,700'
rel='stylesheet' type='text/css'>
因此,宋體調用工作格雷亞t,所有工具提示都正確顯示爲Verdana。 但是,標題,軸標籤和圖表標籤都踢出TimesNewRoman。 我希望它們顯示爲CSS中指定的FranchiseRegular或者HEAD標籤中指定的Magra 。
我已經徹底的探索這裏的選項: https://developers.google.com/chart/interactive/docs/gallery/bubblechart
而問題的心臟是,究竟是什麼
fontName: <global-font-name>
正確的語法,如果您能提供給我的fontName正確的語法在圖表選項中完成其中任何一項,我將不勝感激。提前致謝! :)
至於style.css的例子,EOT是嚴格的Internet Explorer派對。 http://reisio.com/examples/webfonts/ – reisio
通常包含字體(通過'@ font-face')在字體名稱周圍使用引號,以便您可以嘗試類似'fontName:'\'FranchiseRegular \'' – MikeM
@reisio - 你是對的,我爲了簡潔而編輯過......我其實包括外部字體文件引用。我已經編輯了這個問題,並添加了一些清晰的內容 – AcroYogi