I'm embedding two weights of Raleway in an HTML email and want to self host.
I converted the Regular and Extra Bold weights using Font Squirrel, but only the regular weight is working. Not sure if there could be some sort of conflict because it's really one font being embedded as two separate ones?
The font files themselves look correct on the desktop. In the browser locally both fonts work.
Wondering if there is an alternative approach to converting the fonts that would sidestep the issue?
Embed code:
#font-face {
font-family: 'ralewayregular';
src: url('raleway-regular-webfont.eot');
src: url('raleway-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('raleway-regular-webfont.woff') format('woff'),
url('raleway-regular-webfont.ttf') format('truetype'),
url('raleway-regular-webfont.svg#ralewayregular') format('svg');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'ralewayextrabold';
src: url('raleway-extrabold-webfont.eot');
src: url('raleway-extrabold-webfont.eot?#iefix') format('embedded-opentype'),
url('raleway-extrabold-webfont.woff') format('woff'),
url('raleway-extrabold-webfont.ttf') format('truetype'),
url('raleway-extrabold-webfont.svg#ralewayextrabold') format('svg');
font-weight: normal;
font-style: normal;
}
Font Stack Samples:
font-family: 'ralewayregular',Futura,'Gill Sans','Gill Sans MT', Calibri, sans-serif;
font-family: 'ralewayextrabold',Futura,'Gill Sans','Gill Sans MT', Calibri, sans-serif;
EDIT:
I tried a revised font stack earlier treating Raleway as one font with two weights. It looks like the extra bold weight now is working in some clients, but not on email clients that usually have no trouble displaying webfonts such as Apple Mail on the iPad.
#font-face {
font-family: 'raleway';
src: url('raleway-regular-webfont.eot');
src: url('raleway-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('raleway-regular-webfont.woff') format('woff'),
url('raleway-regular-webfont.ttf') format('truetype'),
url('raleway-regular-webfont.svg#ralewayregular') format('svg');
font-weight: 400;
font-style: normal;
}
#font-face {
font-family: 'raleway';
src: url('raleway-extrabold-webfont.eot');
src: url('raleway-extrabold-webfont.eot?#iefix') format('embedded-opentype'),
url('raleway-extrabold-webfont.woff') format('woff'),
url('raleway-extrabold-webfont.ttf') format('truetype'),
url('raleway-extrabold-webfont.svg#ralewayextrabold') format('svg');
font-weight: 800;
font-style: normal;
}
Revised Font Stack:
<h1 style="font-size : 16px; line-height : 24px; letter-spacing : 2.72px; color: #ffffff; font-family: 'Raleway',Futura,'Gill Sans','Gill Sans MT', Calibri, sans-serif; font-weight: 800;">TEXT</h1>
Firstly, you don't need those quotes being you're making the font-family one word. Secondly, you really don't need to have two different font names, you can keep the same font name by keeping the same font-family name but making your font-weight:bold in the bold section of your #font-face. specify font-weight either in your inline css or by <b> or <strong> tags and it should work fine. Faux bolding isn't an issue unless your #font-face isn't loaded at all and you have the font in your OS's stack.
You should also try disabling raleway from your computer's font stack before testing. I also have my font files' url on an absolute path.
Hope one of those helps.
Related
I'm using a font called "Lato", which was downloaded from the author site and converted to the proper formats using fontsquirrel.
After including the below CSS, Chrome developer tools crashes when I try to inspect text elements..
Here the font face code I'm using:
#font-face {
font-family: 'Lato';
src: url('../fonts/custom/lato-reg-webfont.eot');
src: url('../fonts/custom/lato-reg-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/custom/lato-reg-webfont.svg#latoregular') format('svg'),
url('../fonts/custom/lato-reg-webfont.woff') format('woff'),
url('../fonts/custom/lato-reg-webfont.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
#font-face {
font-family: 'Lato';
src: url('../fonts/custom/lato-bol-webfont.eot');
src: url('../fonts/custom/lato-bol-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/custom/lato-bol-webfont.svg#latobold') format('svg'),
url('../fonts/custom/lato-bol-webfont.woff') format('woff'),
url('../fonts/custom/lato-bol-webfont.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
This happens even If I just use one of these font-face declarations.
Any suggestions ?
This font appears to be on Google Fonts - assuming it is the same one? Give this a try instead of the Font Squirrel conversion: http://www.google.com/fonts#UsePlace:use/Collection:Lato
I am using RobotoCondensed downloaded from google Web Fonts. I am using the font from my server. I have created the css like below.
#font-face {
font-family: 'Roboto Condensed';
src: url('../fonts/RobotoCondensed-Light.eot');
src: url('../fonts/RobotoCondensed-Light.eot?#iefix') format('embedded-opentype'),
url('../fonts/RobotoCondensed-Light.woff') format('woff'),
url('../fonts/RobotoCondensed-Light.ttf') format('truetype'),
url('../fonts/RobotoCondensed-Light.svg#svgFontName') format('svg');
}
All the font types specified are present in the folder that I have specified in the url.
I am using the font family like this
font-family: 'Roboto Condensed', sans-serif;
The things are going smooth with respect to IE9 and Chrome. But when it comes to Mozilla Firefox it is not so.
Is there any solution for this?
I'm using the one off the Google Fonts Api and it works in Firefox:
#font-face {
font-family: 'Roboto Condensed';
font-style: normal;
font-weight: 400;
src: local('Roboto Condensed Regular'), local('RobotoCondensed-Regular'), url(http://themes.googleusercontent.com/static/fonts/robotocondensed/v7/Zd2E9abXLFGSr9G3YK2MsNxB8OB85xaNTJvVSB9YUjQ.woff) format('woff');
}
Maybe try specifying style and weight.
just remove : font-weight: 300; from woff
Let's say that I'm using a non-system font (ex., PT Sans) for a CMS website. So what I do is, I'll include the font family of different styles (say, Regular, Italic and Bold) using #font-face. Then I would define the font-family of body as PT Sans Regular. All is well till now.
Then, my client for example, edits some text content in the website. He gives different font-styles to the text - like he boldens an important message and italicizes the name of locations. So altogether, he stylizes the content the way he likes. No problem with that too.
But, what the real question is, how will the website know that if there's a italicized text, it should use PT Sans Italic instead of the regular version of the font, even if the body's font is PT Sans Regular?
I've been thinking about this for a while, but I can't find a solution for it.
Is there a possible solution for situations like this?
This is absolutely possible. Here's how you do it:
#font-face {
font-family: 'PTSans';
src: url('pts55f-webfont.eot');
src: url('pts55f-webfont.eot?#iefix') format('embedded-opentype'),
url('pts55f-webfont.woff') format('woff'),
url('pts55f-webfont.ttf') format('truetype'),
url('pts55f-webfont.svg#PTSansRegular') format('svg');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'PTSans';
src: url('pts56f-webfont.eot');
src: url('pts56f-webfont.eot?#iefix') format('embedded-opentype'),
url('pts56f-webfont.woff') format('woff'),
url('pts56f-webfont.ttf') format('truetype'),
url('pts56f-webfont.svg#PTSansItalic') format('svg');
font-weight: normal;
font-style: italic;
}
#font-face {
font-family: 'PTSans';
src: url('pts75f-webfont.eot');
src: url('pts75f-webfont.eot?#iefix') format('embedded-opentype'),
url('pts75f-webfont.woff') format('woff'),
url('pts75f-webfont.ttf') format('truetype'),
url('pts75f-webfont.svg#PTSansBold') format('svg');
font-weight: bold;
font-style: normal;
}
#font-face {
font-family: 'PTSans';
src: url('pts76f-webfont.eot');
src: url('pts76f-webfont.eot?#iefix') format('embedded-opentype'),
url('pts76f-webfont.woff') format('woff'),
url('pts76f-webfont.ttf') format('truetype'),
url('pts76f-webfont.svg#PTSansBoldItalic') format('svg');
font-weight: bold;
font-style: italic;
}
When you define the #font-face fonts, make sure that all your font-family names are the same. Then set the font-weight and font-style correctly for each font. So if a font is bold, set font-weight: bold. etc.
Then in your CSS you can do:
body {
font-family: 'PTSans';
}
And the various tags <strong> <em> etc will pick the correct font that matches.
I'm using this service to create #font-face rules in my CSS. What I've done is created two rules, one for the normal weight font and another for the bold weight version. Like so:
#font-face
{
font-family: 'CenturyGothicRegular';
src: url('/static/fonts/gothic_2-webfont.eot');
src: url('/static/fonts/gothic_2-webfont.eot?#iefix') format('embedded-opentype'),
url('/static/fonts/gothic_2-webfont.woff') format('woff'),
url('/static/fonts/gothic_2-webfont.ttf') format('truetype'),
url('/static/fonts/gothic_2-webfont.svg#CenturyGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
... and another for 'CenturyGothicBold'
I've then made the overall font for my site default back to Verdana like so:
body
{
font-family: "CenturyGothicRegular", Verdana;
font-size: 14px;
}
And made a little rule for <strong> so that rather than making the normal weight version bold (which just seems to stretch it), the bold weight version will be used:
strong
{
font-weight: normal;
font-family: 'CenturyGothicBold';
}
An issue I can foresee here is that if the font has defaulted to Verdana, bold won't be present.
Is there a way that I can specify a new set of rules for <strong> that only apply if the font has defaulted to Verdana?
There is no need to find a trigger to see if a fall back font has been used.
What you need to do is set the the font-weight in the #font-face rule, using the same family name. So you would now call it CenturyGothic:
#font-face {
font-family: 'CenturyGothic'; /* this used to be CenturyGothicRegular */
src: url('/static/fonts/gothic_2-webfont.eot');
src: url('/static/fonts/gothic_2-webfont.eot?#iefix') format('embedded-opentype'),
url('/static/fonts/gothic_2-webfont.woff') format('woff'),
url('/static/fonts/gothic_2-webfont.ttf') format('truetype'),
url('/static/fonts/gothic_2-webfont.svg#CenturyGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'CenturyGothic'; /* this used to be CenturyGothicBold but the urls still need to point to the files they were pointing at */
src: url('/static/fonts/gothic_2-webfont.eot');
src: url('/static/fonts/gothic_2-webfont.eot?#iefix') format('embedded-opentype'),
url('/static/fonts/gothic_2-webfont.woff') format('woff'),
url('/static/fonts/gothic_2-webfont.ttf') format('truetype'),
url('/static/fonts/gothic_2-webfont.svg#CenturyGothicRegular') format('svg');
font-weight: bold;
}
body{
font-family: "CenturyGothic", Verdana;
font-size: 14px;
}
strong{
font-weight: bold;
}
This will combine the two fonts into one font-family allowing it to act like any other font-family i.e. when you make it bold it will display the bold version of the font etc.
Using font-weight only with the same font-family will not work when you have several weight, like Light, ultralight, condensed bold, demi bold etc.
Some time ago I asked this question and none of the answers solved my problem. My clients are complaining so I'm gonna try once again:
I published a new release of my webapp using #font-face with a limited version of "Droid Sans" (no Latin characters). The font files are hosted on my server. A week later I changed the font with a full version because most of my customers use Spanish language. The new customers get the new full font with no problem, but the customers who accessed first time with the limited font published don't get the special characters any more.
I guess the old font is cached somewhere in the browser, but I haven't been able to remove it.
I've tried to change the font name and the css definition for the browser to download again... nothing is working. Anyone knows how to fix this?
This is my css definition:
#font-face {
font-family: 'Droid';
src: url(/files/DroidSans.eot);
src: url(/files/DroidSans.eot?iefix) format('eot'),
url(/files/DroidSans.woff) format('woff'),
url(/files/DroidSans.ttf) format('truetype'),
url(/files/DroidSans.svg#webfontw7zqO19G) format('svg');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: 'DroidBold';
src: url(/files/DroidSansBold.eot);
src: url(/files/DroidSansBold.eot?iefix) format('eot'),
url(/files/DroidSansBold.woff) format('woff'),
url(/files/DroidSansBold.ttf) format('truetype'),
url(/files/DroidSansBold.svg#webfontSOhoM6aS) format('svg');
font-weight: normal;
font-style: normal;
}
body, a, p, div, span, li, td, th, caption {
font-family: Droid, Optima, Calibri, Helvetica, sans-serif;
font-size: 10pt;
line-height: 14pt;
}
You said that you "tried to change the font name and the css definition". I would also try to change the font name AND resave the font file names, so
#font-face {
font-family: 'DroidBoldNEW';
src: url(/files/DroidSansBoldNEW.eot);
src: url(/files/DroidSansBoldNEW.eot?iefix) format('eot'),
url(/files/DroidSansBoldNEW.woff) format('woff'),
url(/files/DroidSansBoldNEW.ttf) format('truetype'),
url(/files/DroidSansBoldNEW.svg#webfontSOhoM6aS) format('svg');
font-weight: normal;
font-style: normal;
}
See if that works.