Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将Google字体应用于Ionic2项目_Ionic2_Google Font Api - Fatal编程技术网

无法将Google字体应用于Ionic2项目

无法将Google字体应用于Ionic2项目,ionic2,google-font-api,Ionic2,Google Font Api,我无法将Google字体API应用于我的Ionic2项目。以下是我尝试过的: app.scss index.html 为什么不工作?app.scss 本地使用 资产/自定义字体/YanoneKaffeesatz-Regular.ttf 关于theme/variables.scss 使用Ionic2的更好方法是下载字体并将其存储在本地,以防将来需要脱机实现。谢谢,但它不起作用。我还尝试将@import添加到variables.scs,并下载该文件以供脱机使用,并将其存储在assets/fonts/

我无法将Google字体API应用于我的Ionic2项目。以下是我尝试过的:

app.scss

index.html

为什么不工作?

app.scss

本地使用

资产/自定义字体/YanoneKaffeesatz-Regular.ttf

关于theme/variables.scss


使用Ionic2的更好方法是下载字体并将其存储在本地,以防将来需要脱机实现。谢谢,但它不起作用。我还尝试将@import添加到variables.scs,并下载该文件以供脱机使用,并将其存储在assets/fonts/中,但都没有成功。在这种情况下,文件类型是.woff而不是.ttf。我知道这应该是可行的,但是有些东西阻止了这种字体的应用。Chrome开发者工具显示字体系列已经应用,但是我看不到字体的变化。它也不会应用任何其他字体,如Monotype Corsiva或Comic Sans。无论如何,非常感谢你抽出时间。
@font-face {
  font-family: 'Yanone Kaffeesatz', sans-serif !important;

}

html, body {
  font-family: 'Yanone Kaffeesatz', sans-serif !important;
}
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" rel="stylesheet">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);

// Font Variables
$yanone-kaffeesatz: 'Yanone Kaffeesatz', sans-serif !important;

// Styles
html, body {
  font-family: $yanone-kaffeesatz;
}
@font-face {
  font-family: 'yanone-kaffeesatz';
  src: url('../assets/custom-fonts/YanoneKaffeesatz-Regular.ttf') format('truetype');
}