使用 @font-face 安全加载字体

发布于 2024-12-28 07:10:08 字数 889 浏览 5 评论 0原文

我想在网站上使用自定义字体并希望保护它。我知道有像 Cufon 等,但我想用 @font-face 来实现,因为 Cufon 更改文本,而 @font-face 仅将字体应用于文本。所以我找到了 fontdeck.com,他们使用 @font-face 进行安全字体加载。

我必须包含一个包含以下代码的 CSS 文件:

@font-face { 字体系列:'Proxima Nova Thin'; src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot'); src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot?') 格式('嵌入-opentype'), url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.woff') 格式('woff'), url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.ttf') 格式('opentype'); 字体粗细:100; 字体样式:正常; 但是,

如果我使用浏览器访问 EOT、WOFF 和 TTF 文件的 URL,我将看到“禁止”。

有人可以解释一下这是如何工作的吗?

I want to use a custom font on a website and want to secure it. I know there is like Cufon etc, but I want to do it with @font-face, because Cufon changes the text with and @font-face only apply the font to the text. So I found fontdeck.com and they use @font-face with secure font loading.

I have to include a CSS file with the following code:

@font-face {
font-family: 'Proxima Nova Thin';
src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot');
src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot?') format('embedded-opentype'),
url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.woff') format('woff'),
url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.ttf') format('opentype');
font-weight: 100;
font-style: normal;
}

But if I go to with the browser to the URL's for EOT, WOFF and TTF files, I will see "Forbidden".

Can somebody explain me how this works?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我入戏太深 2025-01-04 07:10:09

您无法使用@font-face 保护字体。为了将字体应用于客户端上的文本,必须将其发送到客户端。

许多字体都有特定的许可限制,明确说明是否可以使用@font-face。最好与您的法律部门检查您的许可证。

You cannot secure a font using @font-face. For the font to be applied to the text on the client it has to be sent to the client.

Many fonts have specific license restrictions that spell out whether or not it is ok to use @font-face. It is best to check your licenses with your legal department.

枫林﹌晚霞¤ 2025-01-04 07:10:08

您似乎正在寻找防止热链接的措施:http://en.wikipedia.org/wiki/Direct_linking #预防

某些服务器被编程为使用 HTTP 引荐来源网址来检测热链接并返回谴责性消息(通常采用相同的格式)来代替预期的图像或媒体剪辑。大多数服务器都可以配置为部分保护托管媒体免受内联链接的影响,通常是通过不提供媒体或提供不同的文件。

热链接可能会产生道德和法律影响。
我强烈建议你阅读一下。

You seem to be finding measures to prevent hotlinking: http://en.wikipedia.org/wiki/Direct_linking#Prevention

Some servers are programmed to use the HTTP referrer to detect hot-linking and return a condemnatory message, commonly in the same format, in place of the expected image or media clip. Most servers can be configured to partially protect hosted media from inline linking, usually by not serving the media or by serving a different file.

There can be both ethical and legal implications to hotlinking.
I strongly suggest you read about it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文