Font-family not working properly on live server - css

I am using font-family "angelina". Its working properly on local server. But its not working on live server. It also working on live server just only on my computer. But its not working on any other computers.
I check it in all browsers on other computers but its not working.
I am using CSS code like this
#font-face {
font-family: MyCustomFont;
src: url("ANGELINA.eot") /* EOT file for IE */
}
#font-face {
font-family: MyCustomFont;
src: url("ANGELINA.TTF") /* TTF file for CSS3 browsers */
}
.test_font{
font-family: angelina;
font-size: 36px;
font-weight: bold;
}

You need to have all kinds of font extensions on server to support all browsers.
#font-face {
font-family: MyCustomFont;
src: url('ANGELINA.eot');
src: url('ANGELINA.eot?') format('☺'),
url('ANGELINA.woff') format('woff'),
url('ANGELINA.ttf') format('truetype'),
url('ANGELINA.svg#webfontssbCkuz5') format('svg');
}
You can find all font extensions on this site http://www.google.com/webfonts

It supposed to be:
#font-face {
font-family: angelina;
src: url("ANGELINA.eot") /* EOT file for IE */
}
#font-face {
font-family: angelina;
src: url("ANGELINA.TTF") /* TTF file for CSS3 browsers */
}
if you want to call font-family: angelina;

Related

Load font locally via CSS

I have a small static website and I need to move it on an USB to make it possible to open it via this USB.
Via CSS I defined those rules for the fonts (Is a custom font):
#font-face {
font-family: 'MyFont_SerifReg';
src: url('/assets/fonts/MyFontSerifReg.ttf') format('truetype');
src: url('/assets/fonts/MyFontSerifReg.eot'); /* IE9 Compat Modes */
src: url('/assets/fonts/MyFontSerifReg.eot?#iefix') format('embedded-opentype'); /* IE6-IE8 */
src: url('/assets/fonts/MyFontSerifReg.woff') format('woff'); /* Pretty Modern Browsers */
}
#font-face {
font-family: 'MyFont_SansBol';
src: url('/assets/fonts/MyFontSansBol.ttf') format('truetype');
src: url('/assets/fonts/MyFontSansBol.eot'); /* IE9 Compat Modes */
src: url('/assets/fonts/MyFontSansBol.eot?#iefix') format('embedded-opentype'); /* IE6-IE8 */
src: url('/assets/fonts/MyFontSansBol.woff') format('woff'); /* Pretty Modern Browsers */
}
#font-face {
font-family: 'MyFont_SansLig';
src: url('/assets/fonts/MyFontSansLig.ttf') format('truetype');
src: url('/assets/fonts/MyFontSansLig.eot'); /* IE9 Compat Modes */
src: url('/assets/fonts/MyFontSansLig.eot?#iefix') format('embedded-opentype'); /* IE6-IE8 */
src: url('/assets/fonts/MyFontSansLig.woff') format('woff'); /* Pretty Modern Browsers */
}
#font-face {
font-family: 'MyFont_SansDem';
src: url('/assets/fonts/MyFontSansDem.ttf') format('truetype');
src: url('/assets/fonts/MyFontSansDem.eot'); /* IE9 Compat Modes */
src: url('/assets/fonts/MyFontSansDem.eot?#iefix') format('embedded-opentype'); /* IE6-IE8 */
src: url('/assets/fonts/MyFontSansDem.woff') format('woff'); /* Pretty Modern Browsers */
}
body {
font-family: 'MyFont_SansLig';
}
h2 {
font-family: 'MyFont_SerifReg';
font-size: 40px !important;
}
h4 {
font-family: 'MyFont_SansBol';
line-height:1.5em;
}
p {
font-family: 'MyFont_SansLig';
font-size:16px;
}
b {
font-family: 'MyFont_SerifReg';
font-size:18px;
}
And I have no problem to load the fonts while visiting the website via We
EDIT:
A screen from the Console, Looks like the "fonts" folder is not loaded in "Sources"
Console
The problem appears only when I try to load the website in Local: the font's are not loaded.
What am I writing wrong?
It might be because the path problem.
Try to use relative path (assume the assets folder is at the same place as the html): ../assets/fonts/MyFontSerifReg.ttf
#font-face {
font-family: 'MyFont_SerifReg';
src: url('/assets/fonts/MyFontSerifReg.ttf') format('truetype'),
url('/assets/fonts/MyFontSerifReg.woff') format('woff');
}
Please make sure to cross-check below trouble shooting guide:
path provided in url()
Apply Style as below for example:
body{
font-family: 'MyFont_SerifReg'; // Same name defined in rule
}
Add reference of your CSS file where rules are defined in HTML.

embedding font in visual studio 2015

I have a custom font .ttf and and .otf file that I have added to my font folder in my mvc project. How do I call these from CSS? Seen some articles talk about opening font managers or html designer but I can't see anything to embed these so they work on all browsers?
Thanks
You have already added your custom font to the fonts folder in Visual Studio.
Now all you have to do is point to your font in the #font-face rule:
#font-face {
font-family: "MyCustomFont.ttf";
font-style: normal;
src: url(../fonts/MyCustomFont.ttf); /*if IE */
src: local("MyCustomFont"), url("../fonts/MyCustomFont.ttf") format("truetype"); /* non-IE */
}
If you need another font, just add another #font-face rule
#font-face {
font-family: "MyCustomFont2.otf";
font-style: normal;
src: url(../fonts/MyCustomFont2.otf); /*if IE */
src: local("MyCustomFont2"), url("../fonts/MyCustomFont2.otf") format("truetype"); /* non-IE */
}
This approach should work for all browsers.
Source:
https://forums.asp.net/t/1589195.aspx?Adding+a+font+to+use+in+visual+studio

#font-face fonts not working

I'm trying to get a font working from local storage.
#font-face {
font-family: const;
src: url(const.ttf);
}
.fp_title1 {
font-family: 'const', trebuchet ms;
font-size: 350%;
font-weight: 100;
-webkit-text-stroke: 1px;
}
This won't work. I've tried renaming the file, using the 'font-family' with and without quotes...
I've also tried to link the font with HTML
<link href='CSS/const.ttf' rel='stylesheet' type='text/css'>
It's in the same folder, the name is right. I don't get it.
EDIT: My CSS file is already linked, the font is .ttf
You might have 2 mistakes in code: path and extention. And use the following formats as well as ttf:
#font-face {
font-family: 'const';
src: url('const.eot'); /* IE9 Compat Modes */
src: url('const.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('const.woff') format('woff'), /* Modern Browsers */
url('const.ttf') format('truetype'), /* Safari, Android, iOS */
url('const.svg#svgFontName') format('svg'); /* Legacy iOS */
}
urls that helps to create web fonts:
http://www.fontsquirrel.com/tools/webfont-generator
http://www.font-face-generator.com/
CSS has a .css filename extension, you gave it .ttf

How to use custom fonts in CakePHP?

I am trying to use a custom font in CakePHP but it doesn't seem to be working.
I am getting the font from http://www.dafont.com/ssf4-abuket.font (A Street Fighter font!!). And I store the ttf font file to webroot/css.
This is my CSS:
#font-face {
font-family: 'SF';
src: url('StreetFighter.ttf') format('truetype');
}
p {
height: 50%;
margin: 30px 0;
text-align: center;
font-size: 2.2rem;
font-family: 'SF';
color: #000;
}
However, when I use a different font such as the Arkitech from http://www.1001freefonts.com/ with the same code but different filename it works.
As you are only having a .ttf file for your font-face, not all browsers can use .ttf font files. You have to declare alternative font formats in the #font-face css.
You can generate these other font formats with an online converter. (for example: http://freedockstar.com/fontface/).
Then you need to have the following font-face declaration:
#font-face {
font-family: 'SF';
src: url('StreetFighter.eot'); /* IE9 Compat Modes */
src: url('StreetFighter.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('StreetFighter.woff') format('woff'), /* Modern Browsers */
url('StreetFighter.ttf') format('truetype'), /* Safari, Android, iOS */
url('StreetFighter.svg') format('svg'); /* Legacy iOS */
}
I've tried your font with this tool and it generates a working preview of your webfont.

#font-face fonts within bootstrap css not displaying in firefox

I am able to display fonts in chrome, but not in firefox. I'm wondering if this is an issue because I'm using the bootstrap framework. Here's my code:
#font-face
{
font-family:"bodyFont";
src: url("http://caseymmiller.com/galapagos/fonts/museosans_300.otf");
}
body
{
margin: 0;
font-family: "bodyFont";
font-size: 15px;
line-height: 20px;
color: #333333;
background-color: #ffffff;
}
Also, upon uploading it to my server, only one font is now appearing in chrome... and local sourcing wasn't working so I removed it. I am quite confused. http://caseymmiller.com/galapagos/bootstrapInvasive/Invasive.html
This is what I have in the css now. I tried what you listed before, but when sourcing both urls for each font, none of them would appear. That's why some are commented out right now. These are the sources that I want to use from now on.
#font-face
{
font-family:"headerFont";
src: url("http://livinggalapagos.org/static/Fonts/qhyts__.ttf");
/*src: url("http://livinggalapagos.org/static/Fonts/qhyts__.woff");*/
}
#font-face{
font-family:"subHeadFont";
src: url("http://livinggalapagos.org/static/Fonts/museosans_500.ttf");
src: url("http://livinggalapagos.org/static/Fonts/museosans_500.woff");
}
#font-face{
font-family:"bodyFont";
src: url("http://livinggalapagos.org/static/Fonts/museosans_300.ttf");
/*src: url("http://livinggalapagos.org/static/Fonts/museosans_300.woff");*/
}
#font-face is a complicated property. Here are some resources that might help you to code a "cross-browser" #font-face.
https://developer.mozilla.org/pt-BR/docs/CSS/#font-face
http://www.fontsquirrel.com/tools/webfont-generator
I'm wondering if you don't have a typo in 2 of your properties?
src: url('fonts/museosans_300-.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('fonts/museosans_300-.ttf') format('truetype'), /* Safari, Android, iOS */
Shouldn't these two be
src: url('fonts/museosans_300-webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('fonts/museosans_300-webfont.ttf') format('truetype'), /* Safari, Android, iOS */
Note the added webfont at the end of the file paths.
Be sure to clear your browser cache after making these changes as well.
Good luck!

Resources