I'm using Font Squirrel to convert my fonts into useable web versions. I'd like to not have to convert each weight separately and include them in my css (would add alot of bloat with all those calls).
Is there a way to package multiple weights into one font and use the font-weight property to properly call the correct characters?
Trying to avoid the faux-bold and faux-italics here.
Here's to back up Ennui's answer:
There's really no way around the creation of separate fonts, but using the
font-weight
andfont-style
attributes, you will reduce the call. You just declarefont-family
once.Set the
font-weight
andfont-style
properties accordingly in your@font-face
calls (instead of FontSquirrel's default output where all of them are set tonormal
and they have separate names for each weight/style instead), and name them all the same font.Here's an example from a site I built last year:
Note that FontSquirrel doesn't automatically generate code this way for a reason - which is that some older browsers / user agents do not support
font-weight
andfont-style
properties inside of@font-face
declarations, so it's more backwards compatible to use the method where you name the fonts differently for each weight and style (CartoGothicRegular, CartoGothicBold, CartoGothicItalic, CartoGothicBoldItalic and so forth).Also, FontSquirrel actually can do this for you - if you click Expert settings in the Webfont Generator, there is an option under "CSS" called Style Link which will output them in this format.