是否可以将字体动态加载到用户计算机中

发布于 2024-07-27 02:23:41 字数 75 浏览 3 评论 0原文

我记得在某处读过,您可以将字体动态加载到用户的计算机中,以便您可以在网站中包含您想要的任何字体。 这有可能吗——是我的记忆在欺骗我吗?

I remember reading somewhere that you can dynamically load a font into a user's computer so that you can include any font you want in a website. Is this possible - is my memory playing tricks on me?

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

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

发布评论

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

评论(6

假装不在乎 2024-08-03 02:23:41

有些浏览器支持下载字体。 请参阅 Webfonts.infoFontEmbedding.com 了解您可能想了解的有关该主题的所有信息,包括技术和法律问题,以及哪些浏览器支持哪些机制

W3C 规范 包含一些示例,如下所示,但是并非所有人都支持他们:

@font-face {
  font-family: OCRB;
  src: local(OCRB), url(http://site.com/fonts/ocrb.ttf);
}
p { font-family: OCRB, monospace; }

Some browsers support downloading of fonts. See Webfonts.info and FontEmbedding.com for everything you could want to know about the subject, including technical and legal issues, and which browsers support which mechanisms.

The specification at the W3C includes some examples, like this, but not everyone supports them:

@font-face {
  font-family: OCRB;
  src: local(OCRB), url(http://site.com/fonts/ocrb.ttf);
}
p { font-family: OCRB, monospace; }
岁月流歌 2024-08-03 02:23:41

也许这就是您正在寻找的:

http://www.netmechanic.com/新闻/vol3/css_no15.htm

Perhaps this is what you're looking for:

http://www.netmechanic.com/news/vol3/css_no15.htm

枉心 2024-08-03 02:23:41

W3C 多年前为此定义了一个标准。 与许多此类“标准”一样,网络浏览器不需要支持它们,因此您不能依赖它。

请参阅此处查看可用的浏览器列表

The W3C defined a standard for this many years ago. As with many such "standards", web browsers need not support them so you can't rely on this.

See here for a list of browsers that work.

满地尘埃落定 2024-08-03 02:23:41

Cufon 提供基于 javascript 的文本替换 - 它工作得很好,但如果过度使用它,可能会减慢某些字体的计算机速度。

sIFR 做了类似的事情,但使用 Flash - 但我一直遇到问题,所以我不建议它。

font-face css 选择器还提供内联字体嵌入,但不幸的是,由于大多数浏览器不使用它,因此它可能不值得使用 - 至少暂时不值得使用。

Cufon provides javascript based text replacement - it works quite well but can slow down the computer on some fonts if you overuse it though.

sIFR does something similar but uses Flash - but I have always had problems with it so I wouldn't advise it.

The font-face css selector also provides inline font embedding, but unfortunatley since the majority of browsers do not use it it may not be worth using - at least for a while yet.

笛声青案梦长安 2024-08-03 02:23:41

CSS3 提供了 @font-face 指令允许您在网页上使用任意字体。 但我怀疑它是否被广泛采用,即使是最新的浏览器。

更多信息:

应与以下浏览器兼容(对于 TrueType/OpenType 字体):

  • Webkit/Safari:>= 3.1
  • Opera :>= 10(最有可能)
  • Internet Explorer:不支持(仅支持嵌入式 OpenType 字体)
  • Mozilla/Firefox:>= 3.5
  • Google Chrome:>= 2.0
  • Netscape:不支持

CSS3 provides a @font-face directive that allows you to use arbitrary fonts on your webpages. But I doubt that it's widely adopted even with most recent browsers.

Further information:

The compatibility (for TrueType/OpenType fonts) should be given with the following browsers:

  • Webkit/Safari: >= 3.1
  • Opera: >= 10 (most likely)
  • Internet Explorer: not supported (supports only Embedded OpenType fonts)
  • Mozilla/Firefox: >= 3.5
  • Google Chrome: >= 2.0
  • Netscape: not supported
ゞ花落谁相伴 2024-08-03 02:23:41

编辑(删除了我原来的回答,说它无法完成)。

大多数系统中可用的字体选择并不会让设计师感到兴奋,所以我知道为什么想要在您的网站中嵌入自定义字体很有吸引力。

似乎有几种方法可以满足您的需求,但尚未得到广泛支持。 因为在不同的浏览器和操作系统之间保持一致并不是一件容易的事。

我投票支持您坚持用户系统上可用的内容,无论使用什么浏览器或操作系统,都保持一致的风格。

您还需要查看要嵌入的字体的许可证详细信息,以了解它对您有何影响。

EDIT (Removed my orignaly answer saying it can't be done).

The choice of fonts that is available across most systems is not something that thrills designers, so I know why its appealing to want to embed custom fonts your site.

It appears there are a few methods out there to do what your looking for, but nothing is yet widely supported. There for its not going to be an easy task to keep consistent across the different browsers and operating systems.

I vote you stick to what's available on the users systems, keep it a consistent style no-matter what browser or OS is used.

You will also need to look at the license details for the font your looking to embed to see how it effects you.

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