Why does generated bold fonts look bolder, thicker, on browsers? - css

I'm aware of browser differences here.
I'm aware of the "normal" font-weight attribute, even on bold fonts.
I'm aware there's different font generations around.
Regardless all this, each time we convert a bold font, it gets really thicker.
Has anyone experience this? What ways to you have to overcome this?
We normally end up relying on regular (pretending to be "bold") and light (if exists) to work as "regular", to "fix" the look and feel.
Note (update):
We are using fonts that do have a native bold. And that's the issue.
We are NOT adding any "extra bold".

It is called 'faux bold'. If text is styled as bold or italic and the typeface family does not include a bold or italic font, browsers will compensate by trying to create bold and italic styles themselves.
These computed shapes are ugly. With italic you get the slanted version of the roman type (while a true italic is a totally different shape concept) and the regular is 'upscaled' into bold. Almost if a border is applied. These computed shapes are a (type) designers nightmare.
More on faux bold: http://alistapart.com/article/say-no-to-faux-bold
You can avoid faux bold by supplying the appropriate fonts. Like this:
#font-face {
font-family: 'DroidSerif';
src: url('DroidSerif-Regular-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'DroidSerif';
src: url('DroidSerif-Italic-webfont.ttf') format('truetype');
font-weight: normal;
font-style: italic;
}
#font-face {
font-family: 'DroidSerif';
src: url('DroidSerif-Bold-webfont.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
#font-face {
font-family: 'DroidSerif';
src: url('DroidSerif-BoldItalic-webfont.ttf') format('truetype');
font-weight: bold;
font-style: italic;
}
body { font-family:"DroidSerif", Georgia, serif; }
h1 { font-weight:bold; }
em { font-style:italic; }
strong em {
font-weight:bold;
font-style:italic;
}
Read also the article (and how not to define style/weights):
http://www.456bereastreet.com/archive/201012/font-face_tip_define_font-weight_and_font-style_to_keep_your_css_simple/
UPDATE:
You might also experience font-smoothing issues. Which can be fixed with some css:
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

Related

I downloaded a webfont but it only works in brackets

So I downloaded a font (legally I bought it)
and the font looks really good. but it only displays in the brackets live preview.
when I open it in chrome, it just refuses to work. I followed all the instructions on the font when I bought it. Can anyone help me?
This is an image of the bracket font display which is what I want:
And this is the exact same code when I open the index.html file in Google Chrome.
This is the code I am using to get the font in CSS
#font-face{
font-family:"Ethnocentric W05 Italic";
src:url("/fonts/MTI-WebFonts-367222846/Fonts/5118942/e91f32ff-44ec-47c0-afd3-5cdeeb6c73c8.woff2")
format("woff2");
}
and this is what I used to put it in the header
font-family: "Ethnocentric W05 Italic";
If you declare a custom font using #font-face, the browser will try to fake the bold and italic styles if it can’t find them.
Instead of defining separate font-family values for each font, You can use same font-family name for each font, and define the matching styles, like so:
[css]#font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-R-webfont.eot');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-I-webfont.eot');
font-weight: normal;
font-style: italic;
}
#font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-B-webfont.eot');
font-weight: bold;
font-style: normal;
}
#font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-BI-webfont.eot');
font-weight: bold;
font-style: italic;
}
.test {
font-family: Ubuntu, arial, sans-serif;
}[/css]
Then all you need to do is apply that single font-family to your target, and any nested bold or italic styles will automatically use the correct font, and still apply bold and italic styles if your custom font fails to load.

Custom font different across browsers (Safari/Chrome/Firefox)

My custom font (Gilroy, purchased on myfonts) is having issues across browsers. The font is thicker and bigger in Chrome than on other browsers.
The font size is the same, but your letters in Chrome are bolder than in Firefox. That's because you are importing your fonts wrong.
Currently you are using:
#font-face {
font-family: "Cobury Regular";
src: url(https://cobury.com/wp-content/uploads/2020/03/3B2CCC_0_0.woff) format("woff");
font-weight: 400;
font-style: normal;
}
#font-face {
font-family: "Cobury Bold";
src: url(https://cobury.com/wp-content/uploads/2020/03/3B2CD0_0_0.woff) format("woff");
font-weight: 400;
font-style: normal;
}
... {
font-family: "Cobury Regular";
}
... {
font-family: "Cobury Bold";
}
But the correct way would be:
#font-face {
font-family: "Cobury";
src: url(https://cobury.com/wp-content/uploads/2020/03/3B2CCC_0_0.woff) format("woff");
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: "Cobury";
src: url(https://cobury.com/wp-content/uploads/2020/03/3B2CD0_0_0.woff) format("woff");
font-weight: bold;
font-style: normal;
}
... {
font-family: "Cobury";
font-weight: normal;
}
... {
font-family: "Cobury";
font-weight: bold;
}
Always use font with their actual font-weight. Don't treat the same font with different weight and style like different fonts.
Your .woff font files have implemented meta tags inside, which telling the browser what thickness the letters have. If the provided font-weight in the import statement #font-face doesn't match with that, browsers will treat that differently, because there is no standard for that. (Chrome tries to handle the situation by adding a additional thickness to the already bold font, for whatever reason.)
Edit:
I'm seeing that you use h1, .text-logo #logo { font-weight: 900; ... in your CSS but you have never defined the font with the weight number 900. Please use only the weights you have provided via #font-face. (With my suggestion it would be normal and bold)

Font family and font weight - very thick bold

I have a collection of fonts. Let's say font-a-normal, font-a-italic, font-a-bold and so on with b, c...
If in some css file I have:
font-family: 'font-a-bold';
In another file, I could have
font-weight: bold;
The result actually is double bold font, that is two times thicker than what I need on some html pages. Because project specifications changed a lot over time and because I have a big number of static pages that I would have to change manually if I would want only to remove font-weight I'm searching for another solution.
Is there a rule or some way to specify that 'font-a-bold' shouldn't become thicker. And if I have
font-family: 'font-a-normal';
font-weight: bold
it should actually become:
font-family:'font-a-bold'
Is there a pure css solution?
Update
Or a fast and possibly clean way of removing double bold.
If you are pulling in all the fonts with #font-face declarations, you probably could do something like this:
#font-face {
font-family: 'MyFont-Bold';
font-weight: normal;
font-style: normal;
src: ...
}
#font-face {
font-family: 'MyFont-Bold';
font-weight: bold;
font-style: normal;
src: ... // same as above: always the same bold
}
#font-face {
font-family: 'MyFont';
font-weight: normal;
font-style: normal;
src: ... // regular weight new style
}
#font-face {
font-family: 'MyFont';
font-weight: normal;
font-style: normal;
src: ... // boldweight new style
}
I would think the browser doesn't care if what you tell it is a bold weight is not actually any bolder than the regular.
Fiddle
You can't tell CSS to not apply a certain style if another style is being applied, So...
I would simply do this by using the 'lots of classes' approach to CSS.
Make classes:
.bold {
font-family: 'font-a-bold';
}
.italic {
font-family: 'font-a-italic';
}
and so on. Then just apply these classes to the text you want to have said font-family. Just don't apply a <strong> tag to a piece of text that is already using the .bold class for example.

Internet Explorer 8 ignores font-weight in CSS

So I'm having problems understand why IE is ignoring my CSS here. I have this code:
<h2>Har du stadsnät eller kan du få det?</h2>
I.e. nothing weird or anything.
And here is the resulting rendering:
But here is the CSS code for this HTML:
.rubrik, h2 {
font-family: Lato;
font-size: 32px;
font-weight: normal;
line-height: 38px;
font-variant: normal;
font-style: normal;
color: #969696;
}
Which clearly states that the H2 should have "normal" as font weight, yet the rendered text is clearly bold, here is a correct rendering (from Safari)
So, using the included developer tools of Internet Explorer 8, I inspect the CSS interpretation, and that looks like this:
As I understand it, what I am looking at here is IE8's interpretation of my CSS, and suspiciously missing is the "normal" attribute. IE has converted the CSS to the one-line version of "font" but didn't include the "normal" part. Now, the font "Lato" is a font-face font, and the font-face CSS is here:
#font-face {
font-family: Lato;
src: url('/media/fonts/Lato.eot');
src: local('nofont'), url('/media/fonts/Lato.ttf') format('truetype');
}
#font-face {
font-family: Lato;
src: url('/media/fonts/Lato-Bold.eot');
src: local('nofont'), url('/media/fonts/Lato-Bold.ttf') format('truetype');
font-weight: bold;
}
#font-face {
font-family: Lato;
src: url('/media/fonts/Lato-Bold-Italic.eot');
src: local('nofont'), url('/media/fonts/Lato-Bold-Italic.ttf') format('truetype');
font-weight: bold;
font-style: italic;
}
#font-face {
font-family: Lato;
src: url('/media/fonts/Lato-Italic.eot');
src: local('nofont'), url('/media/fonts/Lato-Italic.ttf') format('truetype');
font-style: italic;
}
Even when specifying "normal" in the font-face declaration for font-weight, it doesn't work. So I'm stuck here, trying to figure out what I am doing wrong not to have IE include "font-weight: normal" in the declaration for H2... Any guesses? Thanks in advance...
I think you need to change the name of the font-family: Lato; on each fontface property, as IE is possibly getting confused. Instead try putting font-family: Lato-bold;, font-family: Lato-italic etc. Also, if the font has a bold face (like Lato does and you have referenced in the fontface properties) then you do not need to add font-weight: bold; for a fontface property, as the font is already bold and adding the font-weight will just add faux-bold and make it look bad.
This means that for your h2, you only need to put font-family: Lato; if you want it to be the normal, non-bold version.
This may be an inheritance issue. Have you tried putting the !important keyword.
font-weight: normal !important;

Force the browser to use Faux italic (oblique) and not the real italic

I have read about a lot of people having problems with the browser not loading the real italic font-style, I on the other want to force the browser to use a Faux Italic.
This is my css code:
h2 {
font-family:"Bell MT", Georgia, serif;
font-size:31px;
font-style:oblique;
font-weight:normal;
color:#e19614;
}
When I set font-weight to bold or greater the resulting effect is the desired an oblique font but whenever I set the weight to normal (which is the desired setting) it goes back to the real italic font which in this case (Bell MT) is very different..
Any suggestions?
Ugly hack using css transforms:
http://jsfiddle.net/DQnVS/1/
span {
display: inline-block;
-webkit-transform: skewX(-30deg);
-moz-transform: skewX(-30deg);
-ms-transform: skewX(-30deg);
-o-transform: skewX(-30deg);
transform: skewX(-30deg);
​}
​
To force a browser to use faux italic, use font settings that request for italic or oblique when the font family specified does not contain an italic or oblique typeface, given the parameters of the situation.
You are doing this if you request for bold italic Bell MT. The Bell MT font family has normal, bold, and italic typeface, but no bold italic. So the browser has to refuse to do what you request for or fake it by algorithmically slanting bold typeface or by algorithmically bolding italic typeface.
As biziclop’s answer demonstrates, you can do your own fake (faux) italic, or rather fake oblique, using CSS transforms. But there’s no way to force a browser use its own faking mechanism in a situation where the requested italic or oblique is available to the browser.
Update: #JonHanna’s answer shows that browsers can be tricked into to using fake italic by specifying a font in a #font-face rule without specifying an italic typeface. So “is available to the browser” is relative.
P.S. Fake italic/oblique is not the same as oblique. A typographer can design an oblique typeface, as something that is not simply a normal font slanted but neither classic italic style. Whether a typeface is classified as italic or oblique is largely a matter of taste and naming. For most practical purposes, the CSS keywords italic and oblique are synonymous, as browsers use italic when oblique has been requested for but does not exist, and vice versa. They would be really different only when the font has both an italic typeface and an oblique typeface, which is rare.
You can do it by aliasing a font. This will only work if the font isn't substituted beyond those you suggest (the catch-all-of-type keywords like serif can't be used here), but you can guarantee that by using a web-font. The web-font may be used as a backup, so you don't need to always download it.
Let's try without a backup first:
#font-face {
font-family: 'Fake Oblique Font';
font-style: normal;
font-weight: 400;
src: local('Bell MT'), local('Georgia');
}
#font-face {
font-family: 'Fake Oblique Font';
font-style: normal;
font-weight: 700;
src: local('Bell MT Bold'), local('Georgia Bold');
}
*
{
font-family: 'Bell MT Bold', Georgia, serif;
}
.oblique
{
font-style: oblique;
font-family: 'Fake Oblique Font';
}
In working out how the "Fake Oblique Font" works, the browser only has the forms mentioned in these declarations available. I don't have Bell MT available on my machine, but this does successfully use Georgia and Georgia Bold with a forced oblique style here: http://jsfiddle.net/k1w1zt0g/ In particular, the x is most appreciably different between the italic and the fake oblique.
Where this wouldn't work, is if none of the fonts mentioned are available, because local() declarations can't use the generic labels like serif. One can either decide to live with that (if you're falling back to serif then you're falling back from anyway, so you're already a bit off the design you were aiming at), or use a webfont guarantee. MS do license Bell MT for web use, but I'm not going to license it just to write a proof of this, so I'll use Noto Serif from Google Fonts instead:
Noto Serif is a handy choice her, as it provides a full set of normal, bold, italic and bold italic. This allows me to demonstrate a fuller range of changes. Delete the bold-italic font the code below uses and see the browser do more faking to fake that too, by faux-bolding the italic when it's used:
#font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
/* There are lots of pros and cons about just how you allow or disallow local fonts
to be used. I'll go with allowing it here, to show it works throughout, but by
all means change this to local('☺') to block local use, or so on. */
src: local('Noto Serif'), local('NotoSerif'), url(http://fonts.gstatic.com/s/notoserif/v4/Lpe_acwQmwESv6cuCHE3rfesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
#font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 700;
src: local('Noto Serif Bold'), local('NotoSerif-Bold'), url(http://fonts.gstatic.com/s/notoserif/v4/lJAvZoKA5NttpPc9yc6lPYSoAJ3FdnHwSRdilZRLja4.woff) format('woff');
}
#font-face {
font-family: 'Noto Serif';
font-style: italic;
font-weight: 400;
src: local('Noto Serif Italic'), local('NotoSerif-Italic'), url(http://fonts.gstatic.com/s/notoserif/v4/HQXBIwLHsOJCNEQeX9kNzxsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
#font-face {
font-family: 'Noto Serif Fake Oblique';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(http://fonts.gstatic.com/s/notoserif/v4/Lpe_acwQmwESv6cuCHE3rfesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
#font-face {
font-family: 'Noto Serif Fake Oblique';
font-style: normal;
font-weight: 700;
src: local('Noto Serif Bold'), local('NotoSerif-Bold'), url(http://fonts.gstatic.com/s/notoserif/v4/lJAvZoKA5NttpPc9yc6lPYSoAJ3FdnHwSRdilZRLja4.woff) format('woff');
}
*
{
font-family: 'Noto Serif';
}
.oblique
{
font-family: 'Noto Serif Fake Oblique'; /* Force faking, by only providing non-italic, non-oblique forms. */
font-style: oblique;
}
http://jsfiddle.net/k1w1zt0g/1/
I actually liked Biziclop's Answer the best, so I started messing around with this jsfiddle they provided. Here's what I came up with.
HTML
<p>Hello <span class="superitalic">SUPERITALIC!</span> World!</p>
CSS
p {
font-size: 100%;
}
p span {
display: inline-block;
-ms-transform: skewX(-10deg) translateY(-1px);
-o-transform: skewX(-10deg) translateY(-1px);
transform: skewX(-10deg) translateY(-1px);
font-size: 90%;
opacity: 0.65;
padding-top: 0.25px;
-ms-text-shadow: 1px 1px 0.1px rgba(0,0,0,0.004);
-o-text-shadow: 1px 1px 0.1px rgba(0,0,0,0.004);
text-shadow: 1px 1px 0.1px rgba(0,0,0,0.004);
}
Resulting JSFiddle - http://jsfiddle.net/ttxhtks0/
I ripped the text-shadow resolution workaround from this post. Let me know if it holds up.

Resources