On the fontspring bulletproof #font-face syntax... what goes after the #? - syntax

I've seen several examples of the bulletproof syntax. I took this from the original article at fontspring:
#font-face {
font-family: 'MyFontFamily';
src: url('myfont-webfont.eot?#iefix') format('embedded-opentype'),
url('myfont-webfont.woff') format('woff'),
url('myfont-webfont.ttf') format('truetype'),
url('myfont-webfont.svg#svgFontName') format('svg');
}
What exactly is supposed to go after the svg# ?
"svg font name" is about the filename? the font-family declaration? what if my font family has spaces?

The #svgFontName is referencing the Font ID embedded inside the svg font file. So, for example, you may have something like this in your svg document:
<font id="example-font-name" horiz-adv-x="512">
Where "example-font-name" should be referenced inside your CSS #font-face like this:
url('myfont-webfont.svg#example-font-name') format('svg');
The SVG font adds support for Legacy iOS, so it's not extremely important. Take a look inside your SVG font file by opening it up in any text editor and look for a Font ID towards the top of your document. Let me know if you have any questions!

Related

Windows Chrome font-face rendering issue

I have a font face on my site and the text comes out very rough on window chrome only.
I have done the following tweaks:
- made SVG first, tried adding a text shadow, tried antialiased font smoothing.
#font-face {
font-family:'grl';
src: url('../fonts/gotham-rounded-light_21020.eot');
src: url('../fonts/gotham-rounded-light_21020.eot?iefix') format('eot'), url('../fonts/gotham-rounded-light_21020.svg#webfontZam02nTh') format('svg'), url('../fonts/gotham-rounded-light_21020.woff') format('woff'), url('../fonts/gotham-rounded-light_21020.ttf') format('truetype');
font-weight: normal;
font-style: normal;
-webkit-font-smoothing: antialiased;
font-smooth: always;
}
here's the url
http://thunder.beresponsive.net/meet-the-kids.html
There is no way currently to fix this.
In some cases, adding CSS text-shadow helps. If it doesn't help, then you quite simply need to use a different font.
Google is aware of this issue, but they don't really care.
I think that you need to specify the font-weight in a number value, i.e. font-weight:200 rather than just "normal".

Poor font rendering in Firefox vs other browsers

I'm struggling to see why a nice clean / simple font like Open Sans Light doesn't look right in Firefox, but looks fine in Chrome and Safari. I guess even Chrome and Safari have some slight differences, but for the most part they look the same in those browsers.
http://503rephotography.com/_font/testfont.html - try and look at it in Firefox and then Chrome or Safari, and you will see what I mean...not sure what it looks like in IE and don't really care all that much to be honest... :) but the font in Firefox is kinda heavy and not quite the right shape, where it should be lighter and better looking. And it's not just this font, it's pretty much every font other than the basics like Arial or Verdana.
CSS
h1 {
font-size:2em;
font-family:OpenSansLight;
color:#000;
}
#font-face {
font-family: 'OpenSansLight';
src: url('fonts/OpenSans-Light-webfont.eot');
src: url('fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/OpenSans-Light-webfont.woff') format('woff'),
url('fonts/OpenSans-Light-webfont.ttf') format('truetype'),
url('fonts/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
font-weight: normal;
font-style: normal;
}
HTML
<h1 align="center">Test... Open Sans Light</h1>
I looked around for an answer and most of the issues were just with a specific font, but I don't think that's the case here, as it applies to all of the ones I've tried, and I know they can look good in Firefox from viewing other sites.
Lots of sites use these fonts and look identical across browsers, are they using something like Adobe typekit in order to do this..? For a lot of these I've got the web font kit off fontsquirrel.com and it seems to work fine other than the inconsistencies. Any input is much appreciated...thanks!
All you need to do is to reset the h1 default weight, or include a bold version of the font.
h1 { font-weight: normal; }
The problem here is that h1 and other headline tags have font-weight: bold set as default. And since you've set the fonts font-weight propery to normal and there is no available bold font the browser, the browser will attempt to create a faux-bold version of your font. Which pretty much always ends up looking horrible.
Firefox seems to mess up fonts the most - on the other hand the text looks bold. Chrome and Safari doesn't alter fonts nearly as much, making them look sharper but not really bold at all. Just look at your sample - it's not very obvious that the text is bold.
A good article on the issue here: http://alistapart.com/article/say-no-to-faux-bold

CSS3 #font-face not selectable on Mac OS X Firefox

Off the back of this post (CSS3 #font-face not displaying on Mac OS X Safari 5.x OR Chrome) I have come across a new stumbling block. It all seemed to be fixed at first but then I encountered a new problem that I couldn't select any text.
On Firefox in Mac OS X, I cannot highlight any text or even click on any hyperlinks that is using the font-face font.
It is selectable on all other operating systems (including Windows, iOS etc.) and other Mac OS X browsers (like Chrome and Safari).
Try it out on http://gradtouch.com/test
Here's the current CSS code.
#font-face {
font-family: 'Avenir LT 55 Roman';
src: url('fonts/avenir-55.eot?#iefix') format('embedded-opentype'),
url('fonts/avenir-55.woff') format('woff'),
url('fonts/avenir-55.ttf') format('truetype'),
url('fonts/avenir-55.svg#AvenirLT-Roman') format('svg');
font-weight: normal;
font-style: normal;
}
Any ideas or solutions?
Thanks in advance.
At first glance, I would guess something is wrong with the metrics in that font. If I create a <span> containing some of your text and give it a border to see how tall it is, that <span> ends up 0px tall.
Once that happens, selection will be invisible, since it's drawn to the height of the text...

#fontface FireFox(10) is rendering text very bold

I have implemented a font in css with #font-face, and its looking way fatter when loaded in Safari. Does anybody know what can cause this?
#font-face {
font-family: 'SerifaBold';
src: url('/css/serifbol-webfont.eot');
src: url('/css/serifbol-webfont.eot?#iefix') format('embedded-opentype'),
url('/css/serifbol-webfont.woff') format('woff'),
url('/css/serifbol-webfont.ttf') format('truetype'),
url('/css/serifbol-webfont.svg#SerifaBold') format('svg');
font-weight: 100;
font-style: normal;
}
Your font-face rule is telling the browser that this is an ultralight font (the font-weight: 100 part). Then you're presumably asking the browser to use this font for text that has normal weight (font-weight: 400) or is bold (font-weight: 700). The browser sees that it's got an ultralight font (because you told it so) and needs a normal font, and it does what's called "synthetic bolding": artificially making the letters bolder by drawing them several times with a slight offset.
There is no standard for synthetic bold, and the default behaviors of browsers differ.
If you're trying to use this font for bold text, and it's already a bold face, you should say so in your font-face rule, using the font-weight descriptor.
When using web typefaces with "font variations" including different weights and/or italics included in the font family, always apply "font-style: normal" & font-weight: 400; (or font-weight:normal) to each style declaration. Make sure to explicitly declare each font-family differently for each variation:
EG: I'm using Helvatica Neue from fonts.com
strong, b {
font-family:'HelveticaNeueW01-75Bold', 'Arial Black', Arial, sans-serif;
font-weight: 400;
}
em, i {
font-family: 'HelveticaNeueW01-56It', Arial, sans-serif;
font-style: normal;
}
Firefox will "help out" your fonts by faux-bolding & faux-italicizing your nice #font-face type making them really ugly and ruining all the hard work the designer did in creating the fonts.
This applies to all sources of fonts including typekit, google, fonts.com and locally hosted fonts.
I've found the same thing happens. Its almost as if its an entire weight above what it should be. Maybe try with the non-bold version of the font as a starting point?
The same problem on my client's website had driven me crazy, but I finally found the problem. When you call 'SerifaBold' in any of your CSS class, make sure that you also put font-weight: normal;
That finally solved the problem for me.

Firefox font-weight versus font-family property; how to avoid double-bolding

If given the following code from the CSS:
font-family:SpecialBold;
font-weight:bold;
Firefox double bolds (it bolds already bold type). This does not seem to be an issue in Safari, Opera or Chrome. I can't just remove font-weight:bold; because if something happens to the hosted typeface, the default typefaces won't bold.
The issue I'm facing is trying to use at #font-face with non- web-safe typography. The typeface I'm using has a specific bold font. In Chrome etc., the following won't work:
font-family:Special;
font-weight:bold;
beceause the Special typeface can only be bold if the SpecialBold typeace is being used.
How do I make it so that Firefox doesn't double-bold already bold fonts? Or, vice-versa, can I make it so that Chrome etc. uses a bold typeface when font-weight:bold is used?
You can use this rule to tell the browser that SpecialBold is already bold so that synthetic bolding does not need to be applied:
#font-face {
font-family: SpecialBold;
font-weight: bold;
src: local(SpecialBold);
}
Might need to be modified depending on exactly what your font faces are called, of course.
#font-face {
font-family: Special;
font-style:normal;
font-weight: normal;
src: local(Special);
}
#font-face {
font-family: Special;
font-weight: bold;
font-style:normal;
src: local(SpecialBold);
}
So you can use the same font-family name and change the weight with font-weight instead of using two different font names. Be sure to add the URL of the font on your site in case your users don't have it!

Resources