I Have Three Font Type -Gotham-Bold, Gotham-Medium, Gotham-Thin, So Do I Need to Use Three Times @Font-Face

Adding fallback fonts to the @font-face definition

No, you cannot specify any fallback fonts inside a @font-face rule, because such a rule defines a font face and assigns a name to it. Inside the rule, the font-family part can contain only one name, the name you choose to assign. It would be pointless list several names there, since only the first one can possibly matter (and, besides, in this context no name has any predefined meaning, e.g. Arial would not mean the Arial font but be just an arbitrary assigned name).

Fallback fonts can be specified only in normal font-family rules.

Consider organizing your style sheet so that the relevant font-family list appears only once, using a suitable list of selectors, like

p, blockquote, .foobar, .something {
font-family: MyWebFont, Arial, Helvetica, sans-serif;
}

Matplotlib cannot find basic fonts

To get it to work, I had to combine the two current top answers. Here's what worked for me:

$ sudo apt install msttcorefonts -qq
$ rm ~/.cache/matplotlib -rf

Bold Fonts in Google Chrome are Blurry (@Font-Face)

In the examples, you have declared only normal (regular) typefaces for Gotham and Sansation in @font-face rules, yet try to use bold face. This makes browsers apply algorithmic (synthetic) bolding, with varying results.

The solution is to get bold typefaces and declare them, in @font-face rules that have font-weight: bold.

How to use custom font in a project written in Android Studio

Update 2021:

Create a folder named font inside the res folder and copy your font

Sample Image

All font names must be only: lowercase a-z, 0-9, or underscore.

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/abc_font" />

For programmatic use:

textView.setTypeface(ResourcesCompat.getFont(context, R.font.abc_font))

For Android Studio 4.2+ there's even now a menu option:

Sample Image

List available font families in `tkinter`

from tkinter import Tk, font
root = Tk()
font.families()

How to import a new font into a project - Angular 5

You need to put the font files in assets folder (may be a fonts sub-folder within assets) and refer to it in the styles:

@font-face {
font-family: lato;
src: url(assets/font/Lato.otf) format("opentype");
}

Once done, you can apply this font any where like:

* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'lato', 'arial', sans-serif;
}

You can put the @font-face definition in your global styles.css or styles.scss and you would be able to refer to the font anywhere - even in your component specific CSS/SCSS. styles.css or styles.scss is already defined in angular-cli.json. Or, if you want you can create a separate CSS/SCSS file and declare it in angular-cli.json along with the styles.css or styles.scss like:

"styles": [
"styles.css",
"fonts.css"
],


Related Topics



Leave a reply



Submit