在客户端机器上安装字体

发布于 2024-09-18 13:39:32 字数 297 浏览 8 评论 0原文

我正在建立一个带有中文字体的网站(PHP)。问题是大多数浏览器默认没有安装中文字体。我希望客户端机器安装此字体来查看网页。

我该怎么做?

编辑:

我已经部分解决了此网站的问题:http://www.font2web .com/

它适用于 IE 和 FF,但不适用于 webkit 浏览器。 我需要为 webkit 浏览器做一些 css hack 吗?

I'm building a website(PHP) with chinese fonts. The problem is most browsers doesn't have chinese fonts installed by default. I want the client machine to have this font installed to view the webpage.

How can I do this?

Edit:

I've partially solved the problem with this website : http://www.font2web.com/

it works in IE and FF but not in webkit browsers.
Do i need to do some css hack for webkit browsers?

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

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

发布评论

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

评论(6

晨敛清荷 2024-09-25 13:39:32

如今大多数计算机都安装了 unicode 字体,因此只要您的 HTML 是针对您的目标语言进行编码的,就应该没问题。

Most computers today have unicode fonts installed, so as long as you're HTML is encoded for your target language, you should be OK.

王权女流氓 2024-09-25 13:39:32

你说大多数浏览器没有安装中文字体。我不敢苟同——我一般不浏览中文网站,但当我浏览中文网站时(或者当英文论坛中有中文评论时),我总是看到汉字。其他文字(例如俄语)也是如此。

也许事情远不止这些,但这就是我自 Windows XP 以来的经历,包括 Windows 7 和各种 Linux 桌面。

无论如何,我想说,任何能阅读中文的人都更有可能安装合适的字体。任何看不懂中文的人可能都不会因为没有正确渲染它们而受到影响。

You say most browsers don't have Chinese fonts installed. I beg to differ -- I don't generally browse chinese sites, but when I have done (or when there have been Chinese comments in an English forum), I've always seen the Chinese characters. Same goes for other scripts such as Russian.

Maybe there's more to it than that, but that has been my experience ever since Windows XP, including Windows 7 and also various Linux desktops.

In any case, I would say it's even more likely that anyone who can read Chinese would have the appropriate fonts installed. And anyone who can't read chinese probably won't affected by not having them render properly.

一口甜 2024-09-25 13:39:32

这可能会解决您的问题 http://www.css3 .info/preview/web-fonts-with-font-face/ ,css3中允许使用font-face,您不需要在客户端计算机上安装字体

This might solve your problem http://www.css3.info/preview/web-fonts-with-font-face/ , font-face is allowed in css3, you don't need to install fonts on clients machine

紫竹語嫣☆ 2024-09-25 13:39:32

http://alexandermp. com/post/2010/07/10/Your-favorite-custom-fonts-in-your-webpage.aspx

此页面介绍了如何使字体在客户端浏览器上显示的所有已知方法。

http://alexandermp.com/post/2010/07/10/Your-favorite-custom-fonts-in-your-webpage.aspx

This page explains all known methods how to make fonts show on a client browser.

软甜啾 2024-09-25 13:39:32

好吧,我将 chrome 更新到了最新版本,这段代码:

@font-face {
    font-family: 'bloodrev';
    src: url('fonts/bloodrev.eot');
    src: local('?'), url('fonts/bloodrev.woff') format('woff'), url('fonts/bloodrev.ttf') format('truetype'), url('fonts/bloodrev.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

就是在 IE、FF 和 chrome 中显示我的自定义字体所需的全部内容。我还没有在 Safari 中测试过。

感谢您的回复和建议。

well, i updated my chrome to the latest version and this code:

@font-face {
    font-family: 'bloodrev';
    src: url('fonts/bloodrev.eot');
    src: local('?'), url('fonts/bloodrev.woff') format('woff'), url('fonts/bloodrev.ttf') format('truetype'), url('fonts/bloodrev.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

is all it takes to display my custom font in IE, FF and chrome. I've not tested in Safari yet.

Thanks for your replies and suggestions.

韵柒 2024-09-25 13:39:32

如果您查看此链接,您将获得有关您可以使用的每个字符集的详细说明。此外,像cn.china.cn这样的网站使用以下内容类型:

<meta http-equiv="Content-Type" content="text/html; charset=gbk" />

只要使用这个,你就会有这个渲染没有问题;)

希望有帮助,

If you look in this link you will have a huge description of every charset you can use. Besides, sites like cn.china.cn use the following content type:

<meta http-equiv="Content-Type" content="text/html; charset=gbk" />

Just use this and you will have this rendered with no problem ;)

Hope that helps,

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