0

I am using custom font files .ttf, .eot and .otf formats in my web application, the problem is when I am trying to login (Clicking on Login button) with newly register user .ttf file is downloading in to my local machine.

I tried in many cases to resolve the issue but able to do it. I am using below CSS for this

@font-face { font-family: 'Open Sans'; src: local(Open Sans),url('fonts/OpenSans-Regular.eot'); src: local(Open Sans),url('fonts/OpenSans-Regular.eot #iefix') format('embedded-opentype'), url('fonts/OpenSans/OpenSans-Regular.ttf') format('truetype'); }

Can anyone please help me.

Thank you!

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
  • Try using the one from http://fontsquirrel.com – Praveen Kumar Purushothaman Aug 26 '15 at 10:59
  • That's how font-face works, what's the issue? – klenium Aug 26 '15 at 11:03
  • please explain "downloading to my local machine", cause basically looking at a webpage is downloading each and every item needed to display it: images, fonts, CSS, ... – Laurent S. Aug 26 '15 at 11:39
  • thanks for the response, sorry I am new to CSS3 in my case ".ttf file (glyphicons-halflings-regular.ttf)" is downloading to my pc downloads (C:\Users\user\Downloads) folder. "C:\Users\user\Downloads\glyphicons-halflings-regular.ttf" this is the file path. I do want to avoid downloading it. Thanks – Srikanth Ama Aug 26 '15 at 13:47

2 Answers2

0

Don't know from your description which web server you're using (e.g. IIS, Apache, Tomcat etc.) but it sounds like you need to assign the correct MIME type for .ttf files if it's downloading the font file as if you'd requested a download from the page.

This thread should help (Proper MIME type for fonts)

Community
  • 1
  • 1
Chris Disley
  • 1,286
  • 17
  • 30
  • Thanks for the response @Chris, I am using Apache, sorry I am new to CSS Can you please give me some examples how to use mime type for fonts, a details example. and I am not writing any logic to download .ttf file from my page. what are the possibilities are there it to download .ttf file to my pc downloads folder (C:\Users\user\Downloads)? Thank you. – Srikanth Ama Aug 26 '15 at 13:51
  • I believe for Apache, you'll need to specify the MIME type mappings in a .htaccess file, but I'm afraid I'm primarily a Microsoft/IIS person so Apache isn't my strong point. I've found this article, but I can't vouch for it I'm afraid (http://www.hypercosm.com/support/howto6.html). – Chris Disley Aug 26 '15 at 14:10
0

I just had this issue with my Spring application. My issues was that the directory the fonts were in were not set for all access.

I can see here that you have your fonts in fonts/, but the .ttf font is in fonts/OpenSans. Check that this directory is also not protected by any security mechanism.

Jim Richards
  • 708
  • 1
  • 7
  • 19