Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly include custom fonts to ionic project?

In my project it is set scss->css compiling. And I can't pick up my custom fonts from the scss folder. Here's my folder structure for a better understanding.

| scss/
  |-- basics/
    |--_fonts.scss
  |-- fonts/
    |-- lineto-circular-book.woff
    |-- lineto-circular-medium.woff
| www
  |-- lib/
    |-- ionic/
      |-- css/         
      |-- fonts/

That's how the _fonts.scss looks like:

@charset "UTF-8";

@font-face {
  font-family: 'Circular-Medium';
  src: url('fonts/lineto-circular-medium.woff');
}

@font-face {
  font-family: 'Circular-Medium-Book';
  src: url('fonts/lineto-circular-book.woff');
}

enter image description here

I'm getting not found status. How can I solve this problem?

like image 375
Billy Logan Avatar asked Apr 07 '16 14:04

Billy Logan


People also ask

How do you embed custom fonts?

Open the file you want to embed fonts in. On the application (PowerPoint or Word) menu, select Preferences. In the dialog box, under Output and Sharing, select Save. Under Font Embedding, select Embed fonts in the file.

How do I use custom fonts in Salesforce?

In the Theme panel, select Fonts, select the Primary Font or Header Fonts dropdown list, and then click Use Custom Font. Add the font family name that you entered in the CSS editor—for example, myFirstFont —and save your changes.

Can I add custom fonts to ionic 3?

Ionic Angular Adding Custom Fonts like Open Sans and Font-Awesome. Download this project on Github Ionic 3 and Angular 4 Adding Custom Fonts like Open Sans and Font Awesome. If playback doesn't begin shortly, try restarting your device.

How to add Font-Awesome icons to your ionic project?

Today, you will learn how to add font-awesome icons to your ionic project. This entire thing is going to step by step, so just follow along. Step 1 : Create config folder in your project directory. Inside that folder create file copy.config.js Step 2 : Expand your node_modules folder as shown in the image and copy the content inside copy.config.js

Are the default ionic default icons up to current market standards?

Ionic default icons are not up to current market standards. This tutorial is all about how to add custom downloaded fonts like open sans and font awesome for icons into the Ionic application.

What makes ionic 3 and Angular 4 better for web development?

Ionic 3 and Angular 4: Adding Custom Fonts like Open Sans and Font Awesome. We all know that Ionic is the useful framework for building HTML 5 mobile applications. It is mainly designed for the front end. When it comes to look and feel of the Ionic website, you have to work more on your application branding standards.


2 Answers

First, move the fonts/ folder into the www/ folder, so it looks like this.

| scss/
  |-- basics/
    |--_fonts.scss
| www
  |-- fonts/
    |-- lineto-circular-book.woff
    |-- lineto-circular-medium.woff

Then, if you aren't minifying the resources, then the paths might be off by one level. This should fix the references.

@font-face {
    font-family: 'Circular-Medium';
    src: url('../fonts/lineto-circular-medium.woff');
}

@font-face {
    font-family: 'Circular-Medium-Book';
    src: url('../fonts/lineto-circular-book.woff');
}
like image 171
Brian Avatar answered Nov 05 '22 19:11

Brian


Add the format value, like this:

@font-face {
  font-family: 'Circular-Medium';
  src: url('fonts/lineto-circular-medium.woff') format('woff');
}

@font-face {
  font-family: 'Circular-Medium-Book';
  src: url('fonts/lineto-circular-book.woff') format('woff');
}
like image 34
JTrixx16 Avatar answered Nov 05 '22 18:11

JTrixx16