When I apply a font-weight:bold style, the look of the font is too bold in Safari when compared to other browsers. I tried below css as suggested in some site but its still the same.
text-shadow: #000000 0 0 0px;
Screenshots of text rendering:
Chrome
Safari
Here's my css declaration:
p {
margin: 8px 5px 0 15px;
color:#D8D2CE;
font-size:11pt;
letter-spacing:-1px;
font-weight: bold;
font-family: LektonRegular;
}
#font-face {
font-family: 'LektonRegular';
src: url('myfonts/lekton-regular-webfont.eot');
src: url('myfonts/lekton-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('myfonts/lekton-regular-webfont.woff') format('woff'),
url(myfonts/lekton-regular-webfont.ttf) format('truetype'),
url('myfonts/lekton-regular-webfont.svg#LektonRegular') format('svg');
font-weight: normal;
font-style: normal;
}
How can this be fixed?
Use -webkit-font-smoothing: antialiased;
The text-shadow trick doesn't work anymore.
For rendering bold text consistently across browsers, your font should explicitly contain bold characters. Otherwise, browsers probably try to make bold variants of characters based on their normal variants, and results are inconsistent across browsers since they likely have different algorithms for such conversion.
Also note that text rendering may be different on different platforms on system level (e.g. Windows, Mac OS). Such differences are OK and do not typically need to be fixed.
See also topic about -webkit-font-smoothing property.
The -webkit solutions won't work for the strong issue for many google fonts, custom fonts and fonts that don't have preset values.
The problem is that you need to specify the value of bold in the strong tags.
This can be done by two ways:
You can either include from Google Fonts or wherever your font is from in your header; it needs both the regular font and the bold font each should have a different font-weight number like 400 regular and 600 bold for example:
<link href="https://fonts.xxx.com/css?family=XXX:400,600" rel="stylesheet">
Or use the aboves source code and paste into your own css like below:
#font-face {
font-family: 'XXX';
font-style: normal;
font-weight: 600;
src: local('XXX SemiBold'), local('XXX-SemiBold'),
url...
}
Use whatever your font is instead of XXX.
Then also in strong {font-weight:600;}
None of the answers here worked for me. Possibly because I am using the windows version of Safari for testing. I had to include the bold font in my CSS to fix the problem. In the case of the original question he would need to add the following (notice it uses the same font-family name)
#font-face {
font-family: 'LektonRegular';
src: url('myfonts/lekton-bold-webfont.eot');
src: url('myfonts/lekton-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('myfonts/lekton-bold-webfont.woff') format('woff'),
url(myfonts/lekton-bold-webfont.ttf) format('truetype'),
url('myfonts/lekton-bold-webfont.svg#LektonRegular') format('svg');
font-weight: bold;
font-style: normal;
}
This worked in all browsers for me.
I found a solution for this particular issue. Actually any of above solutions dint work for me. So started checking the default webkit styles added by safari and found that -webkit-text-stroke-width was applied to body having value 0.5px. I set it to 0!important and solved the issue for me.
Related
I'm hosting my own fonts, but I've also created a fiddle linking to Google fonts and the problem remains.
All browsers change the weight of the font in the H tags.
I find this a bit disconcerting particularly when in my case I'm specifying the font file that should be used.
If for example I set, both <h3> and <p>, with font-family: 'robotoregular'; and use the same exact font-size in both cases, I would expect the same exact result in both of them. Instead, what the browsers produce is a bold version of the font in the <h3>, and the only way to set it right is to specify the font-weight, which shouldn't be necessary if I'm already indicating a specific font file.
Is this behavior to be expected, and why does this happen?
Here's a Fiddle
#font-face {
font-family: 'robotoregular';
src: local('robotoregular'), url('../fonts/roboto-regular-webfont.woff2') format('woff2'),
local('robotoregular'), url('../fonts/roboto-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
p {
font-family: 'robotoregular';
font-size: 27px;
}
h3 {
font-family: 'robotoregular';
font-size: 27px;
font-weight: normal; /*IF NOT INCLUDED, THE BROWSER WILL MAKE IT BOLD*/
}
Browsers apply a wide variety of defaults. Headers get font-weight: bold, among other things (like margins).
If you want complete, total control, consider a reset stylesheet.
I have an issue with trying to maintain a constant font style across all browsers. As seen below, safari's font rendering system makes the font weight smaller than the font weight of chrome's.
Safari:
Chrome:
I've tried using the solutions found on other questions though they have not solved this issue. How can I maintain a constant font style across all the major browsers? That is Chrome, Safari, Opera, Firefox and Internet Explorer.
Here is what I have tried.
-webkit-font-smoothing: antialiased;
font-weight: 800;
text-rendering: optimizeLegibility;
Browsers, by and large, have different font rendering engines/methods. For more details, I recommend reading this, this, and/or this.
Honestly, to the average user, the difference will not be all that noticeable and for the most part, pixel-perfect cross-browser display of anything has been long abandoned as a print-world aftereffect.
If, for some masochistic reason, pixel perfection is more important than sanity and maintainable code, you can try the old standy-bys (text-in-images, image/text replacment) or turning off subpixel rendering via CSS (although not all browser support it, and the text will be less readable).
Hope that helps.
A lot of the differences are more to do with the fact browsers add or omit different default weights / styles to fonts. To stop this happening make sure in your CSS you have font-weight: normal and font-style: normal in your #fontface code block.
You then need to apply the necessary styles to the HTML elements.
So if I have a font called geo-light I would do:
#font-face {font-family: 'geo-light';
src: url('fonts/geo-extralight.woff2') format('woff2'), url('fonts/geo-extralight.woff') format('woff');
font-weight: normal;
font-style: normal;
}
And then add the specific styles for each element that uses that font.
/*SET STYLES ON ELEMENTS*/
h1, h2, h3, h3 > a, p, li {
font-family: 'geo-light', sans-serif;
font-weight: normal;
font-style: normal;
text-decoration: none;
}
I hardly ever see this done on sites, and the pre-cursor to this is what is happening in your image. Those differences are not being caused by an anti-aliasing issue.
This 1st and 3rd articles in the original answer are regarding a completely different problem and the middle article that is being linked to would mean the reverse effect happening in your image examples.
The previous comment helped me a lot, thank you. I managed this way in wordpress and it works. Put this code with your font "YOUR-FONT" in to your CSS.
#font-face {
font-family: 'Conthrax';
src: url('/wp-content/uploads/fonts/conthrax-sb.eot');
src: url('/wp-content/uploads/fonts/conthrax-sb.eot') format('embedded-opentype'),
url('/wp-content/uploads/fonts/conthrax-sb-webfont.wofff') format('woff'),
url('/wp-content/uploads/fonts/conthrax-sb.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Using a combination of the following styles should result in an almost consistent rendering of a font across all browsers.
{
-webkit-font-smoothing: antialiased;
font-synthesis: none;
text-rendering: optimizeLegibility;
}
I seem to have a problem the other way round some people have here.
Here is the deal. http://www.mb-events.de/wordpress/ renders wonderfully on IE, Chrome and Firefox. However on Safari information like price and testimonials are displayed differently and I just can't find out why. The Google Webfont I use for that is 'Cabin'. I would post a side-by-side comparision, but can't due to being new.
I tried setting different fallback fonts and searched wether Safari does not like Google Webfonts in general.
My CSS is
.entry, .entry p {
font: 300 15px/1.5em 'Cabin', arial, sans-serif;
}
Did you try moving the stacking order of the web font your calling. I've always found that adding the svg type to the top of the stack always helps maintain the readability.
As an example:
#font-face {
font-family: 'encode_widelight';
src: url('encode-sans/encodesanswide-300-light.eot');
src: url('encode-sans/encodesanswide-300-light.eot?#iefix') format('embedded-opentype'),
url('encode-sans/encodesanswide-300-light.svg#encode_sans_widelight') format('svg'), /* Place your svg font here */
url('encode-sans/encodesanswide-300-light.woff') format('woff'),
url('encode-sans/encodesanswide-300-light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
You could also try adding font smoothing to your css:
html {
-webkit-font-smoothing: antialiased;
}
I'm using #font-face to load the web fonts which is loading correctly:
#font-face {
font-family: 'HelveticaNeueLight';
src: url('fonts/HelveticaNeueLight/helveticaneuelight.eot');
src: url('fonts/HelveticaNeueLight/helveticaneuelight.eot') format('embedded-opentype'),
url('fonts/HelveticaNeueLight/helveticaneuelight.woff') format('woff'),
url('fonts/HelveticaNeueLight/helveticaneuelight.ttf') format('truetype'),
url('fonts/HelveticaNeueLight/helveticaneuelight.svg#HelveticaNeueLight') format('svg');
font-weight: normal;
font-style: normal;
font-variant:normal;
}
I also have another class to style and bold the text:
.BusinessLeftHeader{
font-family: HelveticaNeueLight;
font-size: 32px;
padding: 30px 0 5px;
text-align: center;
line-height: 1;
font-variant: normal;
}
Now, the problem is that font is not looking bold on iPad 2. It looks like text is showing with blurry effect or something like this.
I also have use this code to fix this problem.
-moz-font-smoothing: none;
font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
But again, still getting same problem. Text is not looking good on iPad 2. When I zoom in, it looks fine.
There are a few considerations here, firstly you have conflicting style settings:
-moz-font-smoothing: none;
font-smoothing: antialiased;
-webkit-font-smoothing: antialiased;
They should all be set to either antialiased or none.
You also state you wish to have a bold font, however you have not set the font-weight style and are using a font called HelveticaNeueLight which I imagine by its very name, is not bold nor include a bold version. At the least you will need to set:
font-weight:bold
Additionally, the issue is likely that the custom font you are using is not packaged with a bold version. In such instances a browser will typically 'interpret' how it should render a bold version using the available typeface, producing unexpected results. You may want to either include a bold version of the font or reference a specific weight if one is included.
I got the Homestead font from the Lost Type Co-op, which has font-face support. Using Font Squirrel, I got an #font-face package. I included everything and wanted to use the Inline variant as demonstrated here. This is my CSS:
#font-face {
font-family: 'HomesteadInline';
src: url('homestead/homestead-inline-webfont.eot');
src: url('homestead/homestead-inline-webfont.eot?#iefix') format('embedded-opentype'),
url('homestead/homestead-inline-webfont.ttf') format('truetype'),
url('homestead/homestead-inline-webfont.svg#HomesteadInline') format('svg');
font-weight: normal;
font-style: normal;
}
h1 { font-family: 'HomesteadInline'; font-size: 10em}
The font works, but renders horribly in Chrome and Firefox, the only browser that I tested that does it right is IE9.
Below is a comparison screenshot:
Is there any way of fixing this?
I've had issues with the font-weight of homestead across different browsers.
Try adding font-weight:200; when you use homestead