I want to apply Open Sans font in my Ionic Project. I have use this code inside my SCSS folder where my custom scss file (settings.sccs and other scss files) are located (demoProject\scss_setting.scss)
@font-face {
font-family: 'Open Sans';
src: url('../www/fonts/opensans-regular-webfont.eot');
src: url('../www/fonts/opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../www/fonts/opensans-regular-webfont.woff') format('woff'),
url('../www/fonts/opensans-regular-webfont.ttf') format('truetype'),
url('../www/fonts/opensans-regular-webfont.svg') format('svg');
font-weight: 200;
}
body{
font-family: 'Open Sans';
}
fonts are located here(demoProject\www\fonts)
and try to apply on whole body but console of the browser is showing
GET http://localhost:8100/www/fonts/opensans-regular-webfont.woff
:8100/www/fonts/opensans-regular-webfont.ttf:1
GET http://localhost:8100/www/fonts/opensans-regular-webfont.ttf
I believe you're going too far back in the directory chain.
I think you want something more like this:
@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('../fonts/opensans-regular-webfont.woff') format('woff'),
url('../fonts/opensans-regular-webfont.ttf') format('truetype'),
url('../fonts/opensans-regular-webfont.svg') format('svg');
font-weight: 200;
}
body{
font-family: 'Open Sans';
}
Here is a tutorial for adding Font Awesome into your project, which is a custom font:
https://www.thepolyglotdeveloper.com/2014/10/use-font-awesome-glyph-icons-ionicframework/
Let me know if that helps you.
Regards,
Your fonts should be located in demoproject/www/lib/ionic/fonts
and then referred to from the css (in it's default location www/css/stylesheet.css like so:
@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;
}
body{
font-family: 'Open Sans';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With