I'm developping a website and I just realised there is a problem with my font rendering only on Safari and I don't find a solution.
Basically I used two custom fonts on my website.
One has a letter spacing of 0.05em to respect my psd file.
My font renders well on Chrome, Firefox, Internet explorer.. But for Safari, strangely, It does not work, the letter spacing does not render.
I read somewhere that it could be a problem with webkit, but if it"s the case why would it be working on chrome ?
It's really making the website horrible on safari and I need to find a fix.
I cannot believe that there is no possible fix for this.
If you have any idea it would be with pleasure.
Below are my code.
Css declaring the font:
#font-face {
font-family: 'univers_lt_std_59_ultracnRg';
src: url('fonts/univers-lt-std-59-ultra-condensed-webfont.eot');
src: url('fonts/univers-lt-std-59-ultra-condensed-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/univers-lt-std-59-ultra-condensed-webfont.woff') format('woff'),
url('fonts/univers-lt-std-59-ultra-condensed-webfont.ttf') format('truetype'),
url('fonts/univers-lt-std-59-ultra-condensed-webfont.svg#univers_lt_std_59_ultracnRg') format('svg');
}
Css of my paragraph:
color: #57585a;
font-family: 'univers_lt_std_59_ultracnRg';
letter-spacing: 0.05em;
font-size: 19.58px;
text-transform: uppercase;
-webkit-font-kerning: initial;
line-height: 26.47px;
Rendering on Chrome Firefox, and Internet Explorer
Rendering on Safari
Clearly the letter spacing does not work..
If you have any idea thanks again.
Try using pixels instead of relative values for letter spacing. Also, use round numbers for font-size and line-height. Safari has been known to round differently.
Related
My font-face is working properly on:
Desktop Chrome
Desktop Firefox
The same font-face call is NOT working on:
Desktop Safari
iOS Chrome
iOS Firefox
iOS Safari
You can see the landing page with the font-family call for the site/company name here: Derek Erb Solutions
The font-family declaration:
#font-face {
font-family: 'Dce_handwriting';
src: url('/fonts/DceHandwritingRegular.woff') format('woff'),
url('/fonts/DceHandwritingRegular.ttf') format('truetype'),
url('/fonts/DceHandwritingRegular.otf') format('opentype'),
font-weight: normal;
font-style: normal;
font-display: fallback;
}
The font-family call:
#sitename {
font-family: Dce_handwriting, sans-serif;
font-size: 6em;
margin: 0 auto;
}
Looking around at similar problems here I made sure to remove the dashes and underscores from the file name and include the "src:" in the font-family declaration.
I have probably been looking too long at my own code to see the problem any more... but it is particularly frustrating.
As always the biggest part of the problem was a stupid semi-colon!
That last line should read:
url('/fonts/DceHandwritingRegular.otf') format('opentype');
With the all important semi-colon at the end of the line instead of the comma.
This fixed the problem on just about all of the browsers...
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 have some problem with #fontface in Google Chrome. The font is rendered too high.
When I change the font to Arial, the button is allright in all browsers. When I change it to the #fontface font the text jumps up.
Below are 2 images that show the difference between Firefox and Chrome.
What can I do?
I've tried:
-webkit-font-smoothing: antialiased;
Also I added the following for all the fonts right after the font declaration:
#media screen and (-webkit-min-device-pixel-ratio:0) {
#font-face {
font-family: 'Museo-Sans-Rounded-100-Regular';
src: url('../fonts/Museo-Sans-Rounded-100-Regular.svg') format('svg');
}
}
Both didn't help.
What can I do? All the help is very welcome!
Thanks to Vira for pointing to the right post. The solution can be found here:
#font-face svg not working properly in Chrome?
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.