Ben Clarke
Ben Clarke

Reputation: 256

Adding custom font to asp.net application

I have never used a custom font before and have been trying to add it into my application. I have downloaded this font onto my computer and have made a separate file called 'Font' and in that i have put the font file.

I went into my CSS and have wrote this code:

@font-face {
font-family:'Open Sans';
src: url('../Font/OpenSans-Light.ttf');
}

The font isn't working at all and I'm wondering why it is not working?

Any ideas?

I am applying it to different sections, I should of said:

.title {
font-family: 'Open Sans';
font-size: 25px;
margin: 0 auto;
color: #52a3cc;
text-align: center;
}

I get this error message in IE Developer Tools:

"@font-face failed OpenType embedding permission check. Permission must be Installable."

Upvotes: 0

Views: 6137

Answers (2)

Win
Win

Reputation: 62301

You code should work if you can download http://www.yoursite.com/CorrectPath/OpenSans-Light.ttf in a browser.

If you cannot download it, you need to add at MIME types like SethG suggested.

Other thought

Open Sans is available via Google Fonts, so you do not have to host it by yourself.

enter image description here

enter image description here

enter image description here

Upvotes: 1

SethGunnells
SethGunnells

Reputation: 1269

I've had issues with this in the past. If you're using IIS Express to test this, you might have issues. For some reason, when IIS doesn't have a MIME type with which to serve content, it won't serve it. Make sure that whatever version of IIS you're using, be it IIS Express or IIS, has a MIME type for .ttf files.

Upvotes: 0

Related Questions