including font face for bold not working - html

I've added the 'circular' font family to my site shown in the first code snippet below, but it doesn't add any bold, so I tried to include the bold .ttf and .woff for the bold 'circular' font but neither of my two approaches worked, the first approach made all the text bold and the second approach didn't do anything at all!
Here is how I added 'circular' to my asp.net mvc site's site.css file and it makes all the text circular, but not the bold
#font-face {
font-family: 'Circular';
src: url('../fonts/circular-book.ttf') format('truetype');
src: url('../fonts/circular-book.woff') format('woff');
}
body {
font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px !important;
-webkit-font-smoothing: antialiased !important;
color: #484848 !important;
}
Here I tried adding the bold but it makes everything bold
#font-face {
font-family: 'Circular';
src: url('../fonts/circular-book.ttf') format('truetype');
src: url('../fonts/circular-book.woff') format('woff');
src: url('../fonts/circular-bold.ttf') format('truetype');
src: url('../fonts/circular-bold.woff') format('woff');
}
body {
font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px !important;
-webkit-font-smoothing: antialiased !important;
color: #484848 !important;
}
The last thing I tried was adding a new 'font-face' and including it in the body like this but it doesn't change any of my 'font-weight: bold' css to bold
#font-face {
font-family: 'Circular';
src: url('../fonts/circular-book.ttf') format('truetype');
src: url('../fonts/circular-book.woff') format('woff');
}
#font-face {
font-family: 'Circular-bold';
src: url('../fonts/circular-bold.ttf') format('truetype');
src: url('../fonts/circular-bold.woff') format('woff');
}
body {
font-family: Circular, Circular-bold,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px !important;
-webkit-font-smoothing: antialiased !important;
color: #484848 !important;
}

#font-face {
font-family: 'Circular';
src: url('../fonts/circular-book.ttf') format('truetype');
src: url('../fonts/circular-book.woff') format('woff');
}
#font-face {
font-family: 'Circular'; /*same name, yes*/
font-weight: bold; /*config its weight*/
src: url('../fonts/circular-bold.ttf') format('truetype');
src: url('../fonts/circular-bold.woff') format('woff');
}
body {
font-family: Circular; /*select font family normally*/
font-weight: bold; /*select family's bold font face*/
}
Or ask engine to generate (ugly) bold font face for us by font-synthesis:weight.
Here is an example showing how googlefonts configs font face.
#font-face {
font-family: 'Spectral SC';
font-style: normal;
font-weight: 400;
src: local('Spectral SC Regular'), local('SpectralSC-Regular'), url(https://fonts.gstatic.com/s/spectralsc/v2/yJ95fCBFs0v33GTJdYTk_zUj_cnvWIuuBMVgbX098Mw.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
#font-face {
font-family: 'Spectral SC';
font-style: normal;
font-weight: 700;
src: local('Spectral SC Bold'), local('SpectralSC-Bold'), url(https://fonts.gstatic.com/s/spectralsc/v2/J7mO0YbtyrIkp56FY15FDS_vZmeiCMnoWNN9rHBYaTc.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

below code'll work
#font-face {
font-family: 'Circular';
src: url('../fonts/circular-bold.ttf') format('truetype');
src: url('../fonts/circular-bold.woff') format('woff');
}
body {
font-family: Circular;
font-weight: bold;
}

Related

Why are my custom fonts not working on mobile devices?

Why won't my custom font work for mobile but it works fine on desktop?
This is the code I put at the top of my css file:
#font-face {
font-family: 'NewYork';
src: url('fonts/NewYork.eot');
src: url('fonts/NewYork.eot?#iefix') format('embedded-opentype'),
url('fonts/NewYork.woff2') format('woff2'),
url('fonts/NewYork.woff') format('woff'),
url('fonts/NewYork.ttf') format('truetype'),
url('fonts/NewYork.svg#NewYork') format('svg');
font-weight: normal;
font-style: normal;
font-display: swap;
}
#font-face {
font-family: 'Montserrat Alternates';
src: url('fonts/MontserratAlternates-Regular.eot');
src: url('fonts/MontserratAlternates-Regular.eot?#iefix') format('embedded-opentype'),
url('fonts/MontserratAlternates-Regular.woff2') format('woff2'),
url('fonts/MontserratAlternates-Regular.woff') format('woff'),
url('fonts/MontserratAlternates-Regular.ttf') format('truetype'),
url('fonts/MontserratAlternates-Regular.svg#MontserratAlternates-Regular') format('svg');
font-weight: normal;
font-style: normal;
font-display: swap;
}
#font-face {
font-family: 'Montserrat Alternates';
src: url('fonts/MontserratAlternates-Light.eot');
src: url('fonts/MontserratAlternates-Light.eot?#iefix') format('embedded-opentype'),
url('fonts/MontserratAlternates-Light.woff2') format('woff2'),
url('fonts/MontserratAlternates-Light.woff') format('woff'),
url('fonts/MontserratAlternates-Light.ttf') format('truetype'),
url('fonts/MontserratAlternates-Light.svg#MontserratAlternates-Light') format('svg');
font-weight: 300;
font-style: normal;
font-display: swap;
}
And this is how I style it:
*{
font-family: 'Montserrat Alternates', serif;
color: rgba(40, 40, 43, 1);
font-size: clamp(12px, 30vw, 18px);
font-weight: normal;
font-style: normal;
font-display: swap;
line-height: 1.7em;
padding: 0;
max-width: 100%;
margin: 0;
box-sizing: border-box;
}
h1 {
font-size: clamp(15px, 9vw, 170px);
color: rgba(0, 142, 83, 1);
font-family: 'NewYork', serif;
font-weight: normal;
font-style: normal;
font-display: swap;
letter-spacing: 0.04em;
line-height: 7rem;
text-align: center;
}
link to site and what it should look like: https://robynloudang.github.io/Portfolio/index.html
[screenshot of the font on mobile][1]
[1]: https://i.stack.imgur.com/dWxsj.jpgstrong text
Your fonts aren't loaded at all(also in desktop view), as the path to your font directory isn't correct.
https://robynloudang.github.io/Portfolio/fonts/MontserratAlternates-Regular.woff2
works!
https://robynloudang.github.io/Portfolio/styles/fonts/MontserratAlternates-Regular.woff2
nope!404
You will also see a debug message in dev tools.
Just move your "fonts" folder in your "styles" folder or edit your #font-face declaration:
#font-face {
font-family: 'Montserrat Alternates';
src: url('../fonts/MontserratAlternates-Regular.woff2') format('woff2'),
url('../fonts/MontserratAlternates-Regular.woff') format('woff'),
url('../fonts/MontserratAlternates-Regular.ttf') format('truetype'),
font-weight: normal;
font-style: normal;
font-display: swap;
}

CSS Font issue on iOS Phone

There is a problem with fonts on iOS devices, these are the differences:
ANDROID/WEB IMAGE (correct)
IOS IMAGE (wrong)
The text appears to be in italics but I have never set it.
This is my font-face:
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 200;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 400;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 600;
font-display: swap;
}
#font-face {
font-family: "Acumin Variable Concept";
src: url("font/Acumin/Acumin-Variable-Concept.ttf") format("truetype");
font-style: normal;
font-weight: 900;
font-display: swap;
}
/* Typography */
p{
font-family:'Acumin Variable Concept';
font-size: 1.5rem;
text-align: justify;
line-height: 2rem;
font-weight: 400;
-webkit-font-smoothing: antialiased;
margin-bottom: 2rem;
}
b{
font-weight: 600;
color: var(--brand);
}
What could it be?
Thanks in advance,
Simone
you can try to set behind your font an "!important" like
font-family: "Acumin Variable Concept" !important;
regards
Jonas

Imported font doesn't work

I've been trying for hours to use the Titillium Web custom font but haven't succeeded. Here's what I tried:
Adding the following line in the head part of the overall template
`<link href="https://fonts.googleapis.com/css?family=Titillium+Web:300,400,400i,600,600i,700" rel="stylesheet">`
Adding the following in CSS
#font-face {
font-family: 'Titillium Web Bold';
src: url('data/fonts/TWeb/titilliumweb-bold-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-bold-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-bold-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-bold-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
#font-face {
font-family: 'Titillium Web BoldItalic';
src: url('data/fonts/TWeb/titilliumweb-bolditalic-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-bolditalic-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-bolditalic-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-bolditalic-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
#font-face {
font-family: 'Titillium Web Italic';
src: url('data/fonts/TWeb/titilliumweb-italic-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-italic-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-italic-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-italic-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
#font-face {
font-family: 'Titillium Web Light';
src: url('data/fonts/TWeb/titilliumweb-light-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-light-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-light-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-light-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
#font-face {
font-family: 'Titillium Web';
src: url('data/fonts/TWeb/titilliumweb-regular-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-regular-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-regular-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-regular-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
#font-face {
font-family: 'Titillium Web Semibold';
src: url('data/fonts/TWeb/titilliumweb-semibold-webfont.woff2') format('woff2'),
url('data/fonts/TWeb/titilliumweb-semibold-webfont.woff') format('woff');
url("data/fonts/TWeb/titilliumweb-semibold-webfont.ttf") format("truetype"),
url("data/fonts/TWeb/titilliumweb-semibold-webfont.svg") format("svg");
font-weight: normal;
font-style: normal; }
Using the font on an html element
a.random {font-family: 'Titillium Web';} or a.random {font-family: 'Titillium Web', sans-serif;}
None worked.
Any idea ?
Thanks
#import url('https://fonts.googleapis.com/css family=Titillium+Web:300,400,400i,600,600i,700');
#f{
font-family: 'Titillium Web', sans-serif;
}
#s{
font-family: 'Titillium Web', sans-serif;
font-weight: 700;
}
#t{
font-family: 'Titillium Web', sans-serif;
font-style:italic;
font-weight: 700;
}
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p id="f">Sample</p>
<p id="s">Another Sample</p>
<p id="t">Last Sample</p>
</body>
</html>

Font Face Issues - Text compacting

I'm having a few problems with font-face that seems to occur every time I use it to include fonts. The only way to fix it is (I'm using Chrome btw) to go to the page in IE and let it redownload the font locally. The domain is: http://chahlesmc.us/
The first image shows the content how it should be, the other images show my issue with the bug. Thanks in advance!
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 100;
src: url('./fonts/sourcesanspro-extralight-webfont.eot');
src: url('./fonts/sourcesanspro-extralight-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-extralight-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-extralight-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-extralight-webfont.ttf') format('truetype');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 200;
src: url('./fonts/sourcesanspro-light-webfont.eot');
src: url('./fonts/sourcesanspro-light-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-light-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-light-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-light-webfont.ttf') format('truetype');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 300;
src: url('./fonts/sourcesanspro-regular-webfont.eot');
src: url('./fonts/sourcesanspro-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-regular-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-regular-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-regular-webfont.ttf') format('truetype');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: url('./fonts/sourcesanspro-semibold-webfont.eot');
src: url('./fonts/sourcesanspro-semibold-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-semibold-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-semibold-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-semibold-webfont.ttf') format('truetype');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 500;
src: url('./fonts/sourcesanspro-bold-webfont.eot');
src: url('./fonts/sourcesanspro-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-bold-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-bold-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-bold-webfont.ttf') format('truetype');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 600;
src: url('./fonts/sourcesanspro-black-webfont.eot');
src: url('./fonts/sourcesanspro-black-webfont.eot?#iefix') format('embedded-opentype'),
url('./fonts/sourcesanspro-black-webfont.svg') format('svg'),
url('./fonts/sourcesanspro-black-webfont.woff') format('woff'),
url('./fonts/sourcesanspro-black-webfont.ttf') format('truetype');
}

How do I get a bold version of a custom font?

I have used the CSS command
#font-face { font-family: myFont; src: url('MyFont.otf'); }
to install my own font on a HTML site.
Now, when I use the <strong> tag, I don't see a bold version of it. How do I do to make this work?
thanks.
You must create link on MyFontBold.otf . Italic, bold, medium, semibold, thin it's different files of font. Example
#font-face {
font-family: 'PT Sans';
font-style: normal;
font-weight: 400;
src: local('PT Sans'), local('PTSans-Regular'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v5/LKf8nhXsWg5ybwEGXk8UBQ.woff) format('woff');
}
#font-face {
font-family: 'PT Sans';
font-style: normal;
font-weight: 700;
src: local('PT Sans Bold'), local('PTSans-Bold'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v5/0XxGQsSc1g4rdRdjJKZrNBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
#font-face {
font-family: 'PT Sans';
font-style: italic;
font-weight: 400;
src: local('PT Sans Italic'), local('PTSans-Italic'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v5/PIPMHY90P7jtyjpXuZ2cLD8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
#font-face {
font-family: 'PT Sans';
font-style: italic;
font-weight: 700;
src: local('PT Sans Bold Italic'), local('PTSans-BoldItalic'), url(http://themes.googleusercontent.com/static/fonts/ptsans/v5/lILlYDvubYemzYzN7GbLkHhCUOGz7vYGh680lGh-uXM.woff) format('woff');
}
After this code you can use bold, italic and outher property of font
you can use font-weight..
#font-face {
font-family: "xyz";
src: url("xyz.ttf");
font-weight: bold;
font-style: italic, oblique;
}
use <b> bold </b> tag