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
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:
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
Efficient and Inefficient CSS Selectors (According to Google, Pagespeed ...)
Multi Line Dotted or Dashed Text-Underline
Importing Style Sheets in Angular4
Definition List with Inline Pairs
Using CSS Approach How to Set an Image to Fill a Path in Svg
How to Evenly Space Navbar Elements in Bootstrap 4
What Do Push/Pull Classes Do in a Grid System
How to Add Space After a Colon in CSS with Sublime Text 2
How to Enhance by CSS an HTML <Select> and Its <Option> on Ie 6
Rotating a Svg with CSS (Animation)
CSS - Horizontal Navigation List Items to Fill All Available Space
How to Make an Element with Fixed Position Relative to Its Parent, Not The Whole Screen
Why Does Adding Float:Left to My CSS Make My Link Unclickable
Broke Page Styles of Vue.Js App (Webpack Template) When Live Changing It in Chrome Devtools
Targeting Specific Column in Table
Overflow: Hidden Behind Padding
Remove The Random String Appended to Sprite Filename with Compass/Sass