自定义字体未在ionic中加载
Custom font not loading in ionic
我就是无法获得自定义字体来处理我的Ion项目。
控制台:
downloadable font: download failed (font-family: "Open Sans" style:normal weight:200 stretch:normal src index:1): status=2147500037 source: file:///Users/MehdiNathani/Desktop/Fitness/Fitness/www/lib/ionic/fonts/opensans-regular-webfont.woff style.css:408:12
------------------------------------------------------------------------
downloadable font: download failed (font-family: "Open Sans" style:normal weight:200 stretch:normal src index:2): status=2147500037 source: file:///Users/MehdiNathani/Desktop/Fitness/Fitness/www/lib/ionic/fonts/opensans-regular-webfont.ttf style.css:408:12
------------------------------------------------------------------------
CSS文件:
@font-face {
font-family: 'Open Sans';
src: url('../lib/ionic/fonts/opensans-regular-webfont.eot');
src: url('../lib/ionic/fonts/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../lib/ionic/fonts/opensans-regular-webfont.woff') format('woff'),
url('../lib/ionic/fonts/opensans-regular-webfont.ttf') format('truetype'),
url('../lib/ionic/fonts/opensans-regular-webfont.svg') format('svg');
font-weight: 200;
}
我做错了什么?
确保字体文件夹的路径正确。
我在www文件夹中有我的字体文件夹,这是我的代码。
styles.css
@font-face {
font-family: 'Indie Flower';
src: url('../fonts/IndieFlower.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
display.html
<h3 style="font-family: 'Indie Flower'">This is Indie Flower</h3>
当我在安卓设备上构建它时,它运行得非常好。
我不确定lib文件夹的编译方式是否与其他文件相同。我添加了自己的自定义字体,并将其保留在css文件夹中。您可以尝试在文件夹css
中创建文件夹fonts
。这种方式你可以使用:
@font-face {
font-family: 'Open Sans';
src: url('fonts/opensans-regular-webfont.eot');
src: url('fonts/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-regular-webfont.woff') format('woff'),
url('opensans-regular-webfont.ttf') format('truetype'),
url('opensans-regular-webfont.svg') format('svg');
font-weight: 200;
}
这是我在应用程序中使用的自己的代码(正在运行):
@font-face {
font-family: Rochoes;
src: url('Rochoes.ttf');
}
@font-face {
font-family: Vollkorn-Bold;
src: url('Vollkorn-Bold.ttf');
}
@font-face {
font-family: Vollkorn-Regular;
src: url('Vollkorn-Regular.ttf');
}
相关文章:
- 未在angularJS和Ionic中加载模板
- 在Ionic应用程序上使用$.getScript加载谷歌地图Api
- Cordova AngularJS Ionic标签的内容在第一次加载时重叠
- 获取 window.location.reload 以在 Ionic 中仅加载一次
- ionic框架,在模板渲染后加载javaScript
- 在加载数据之前显示Ionic加载
- FileReader未在Ionic 2中加载端启动
- 自定义字体未在ionic中加载
- XMLHttpRequest 无法在 Ionic 登录到 odoo 服务器时加载 http://localhost:80
- 除非刷新,否则Firebase数据不会加载到列表中(AngularJS,Firebase和ionic)
- Jquery没有在ionic的
模板中加载 - 在ionic中重新加载控制器
- 加载的图像是'在ios Ionic Framework中不可见
- Ionic Angular JS$routeProvider加载离子列表获胜't滚动
- 如何等待所有js脚本都加载到IONIC(AngularJS)中
- Ionic框架未加载ng模型变量
- Ionic地图控制器没有被加载
- Ionic:更新$scope变量后重新加载视图
- Ionic无限滚动显示更多的项目已经加载(不是通过httprequest)
- 我如何修复XMLHttpRequest不能加载在Ionic上的面条支付