preventing获取与htaccess的字体字体、preventing、htaccess

2023-09-02 00:44:39 作者:初愈.

我的客户问我用一个特殊的字体,@字体面在他的网站。但是,该字体是一种资产,以他的组织,他是怕有人会偷走它。那么,有没有什么办法能让这.TTF文件入店的浏览器,但prevent直接访问(现在,你可以阅读的.css文件中的网址,并下载使用任何浏览器的字体)。

My client ask me to use an especial font with @font-face on his website. But, that font is an asset to his organization, and he's afraid people would steal it. So, is there any way to make that .ttf file accesible by the browser, but prevent direct access (right now, you can read the url within the .css file, and download the font with any browser).

我知道有没有绝对的解决方案,并且字体仍然可用于有人用设置正确的技能。但我只是想使它更难偷换非专家。

I know there's no absolute solution, and the font would still be available for someone with the right skills set. But I just want to make it harder to steal for the non-experts.

任何建议将是极大的AP preciated!谢谢!

Any suggestions would be greatly appreciated! Thanks!

我该如何解决呢?

阅读这个。 Typekit的团队表现非常出色这一点。这真是不可能prevent的robery,但你可以把它硬。我做了两件事情:

Reading this. Typekit's team did a GREAT job on this one. It's really impossible to prevent the robery, but you can make it hard. I did two things:

通过FontSquirrel发电机,我 删除了所有桌面字形, 制造上的字体不可用 桌面。

With FontSquirrel Generator, I removed all the desktop glyphs, making the font unusable on a desktop.

恩code使用Base64我所有的直接TTF在我的CSS 文件。 (即SRC: URL(数据:字体; BASE64,jdslajdsaljdlsajdsa))

Encode with Base64 all my TTF directly on my CSS file. (ie. src: url(data:font;base64,jdslajdsaljdlsajdsa))

EOT字体,IE浏览器,不能 转换为Base64。但是,你可以 加载这些通过一个PHP脚本, 检查引荐,和prevent的 直接访问。

EOT fonts, for IE, can't be converted to Base64. But, you can load those vía a php script that checks the referer, and prevent the direct access.

您仍然可以重组具有Base64编码的字体,是的,你可以伪造引用站点并下载.EOT。但它会采取一个人拥有合适技能集。人们谁偷的字体是regulary设计师,谁不知道如何欺骗Apache的。

You still can reassemble the font having the base64, and yes, you can fake the referer and download the .EOT. But it would take someone with the right skills-set. People who steals fonts are regulary designer who doesn't know how to trick apache.

推荐答案

如果你让什么让浏览器那么它的公众。 AFAIK没有办法阻止你,让浏览器阅读的东西!

If you let something to get to the browser then its public. AFAIK there is no way to block the stuff that you let browser read it!

编辑该位code,你可以使文本字体的形象,你想要的(它需要GD库):

Edit this bit of code and you can make image of text with font you want (it need GD library):

<?php
$image = imagecreatetruecolor(145, 30);// Image size
$color = imagecolorallocate($image, 163, 197, 82);// color
$bg = imagecolorallocate($image, 255, 255, 255); // background color white
imagecolortransparent($image, $bg);// Makes Background transparent!
imagefilledrectangle($image,0,0,399,99,$bg);
imagettftext($image, 25, 0, 25, 25, $color, "add/to/font.ttf", "text you can get from post or somewhere");
header("Content-type: image/png");
imagepng($image);
?>