1

Is there any way to not allow user to download font?

Usually if you want to download font, can find and open style file in HTML code and get source of font and enter in browser and can download it.

Any way exist to do not allow user which Could not do this? and font be safe in server?

halfer
  • 19,824
  • 17
  • 99
  • 186
AliReza Gh
  • 62
  • 8
  • 3
    if you don't want something to be downloaded, then don't put it somewhere where it CAN be downloaded. That's all there is to it. it is impossible to differentiate between an http requset for "get this font so I can use it to properly display your html pages" and "get this font so I can steal it and use it elsewhere". They're both identical. – Marc B Mar 12 '14 at 18:45
  • Why you are using fonts which you don't want to be used? – Lkopo Mar 12 '14 at 18:48
  • @Mr.Smith i want to use font in my page , but i dont want to user can download it , font create by we and under our license – AliReza Gh Mar 12 '14 at 18:58
  • Then it is impossible. Browsers automatically downloads new fonts, so this font is already downloaded. – Lkopo Mar 12 '14 at 19:03
  • You could require a correct referrer string when serving the font. It'll only work if used on the correct site. This is only a low security measure, but will prevent casual download attempts. – halfer Mar 13 '14 at 00:23
  • @halfer can you more describe about this ? – AliReza Gh Mar 13 '14 at 12:15
  • You just need to serve your fonts via a PHP script, for which `readfile` can be used. See [these questions](http://stackoverflow.com/search?q=http_referer+php+download) on how to serve a binary file with PHP. Then, in your PHP, you can check that the referring page is correct, and serve a 404 if it is not. – halfer Mar 13 '14 at 14:18

2 Answers2

3

No, it is completely impossible. That is fundamentally not how the Internet works.

If a browser can read a file from your server, so can any other piece of software.

user229044
  • 232,980
  • 40
  • 330
  • 338
2

Actually if you curtailed the use of your custom font to only some headlines and not the entire body of the page, you could convert text to SVG. The tool I'd recommend is Inkscape. Although Inkscape is a GUI tool, it has a powerful CLI which can be called programmatically.

This stackoverflow question has a full breakdown of how to do this.

Community
  • 1
  • 1
Tony Cronin
  • 1,623
  • 1
  • 24
  • 30
  • please check this style http://lab.ritaco.net/webfonts/css/fonts.css , you cant download font , how work this ? – AliReza Gh Mar 13 '14 at 11:51
  • You can download them, see @meagers answer, if you can see the font on screen your they are on your local machine. I've managed to download them here. – Tony Cronin Mar 13 '14 at 19:00
  • can you give me font that link ? i test this http://lab.ritaco.net/webfonts/css/fonts/WebMitra.eot but load blank page , this is unusual for me . i have this font and just want use this way for my web page . – AliReza Gh Mar 13 '14 at 21:21
  • @AliRezaGh can you pm on twitter: cronindesigns, or email me at my email address listed on my profile. I would like to verify you own the font. – Tony Cronin Mar 13 '14 at 22:18