生成图像:用户代理 (OS) 的替代字体
我需要为文本的某些部分生成小图像。这些必须无缝地融入文本中。我知道我无法弥补每个可用的浏览器字体设置,但我如何根据用户代理检查 Linux、Mac 和 Windows 用户?我想为正确的用户代理操作系统使用正确的字体(三种“Verdana、Arial、Helvetiva”)。
那么:
- 如何检查操作系统?我必须在用户代理中比较什么?
- 另外两种字体在哪里可以找到呢? Windows 包含的 Verdana 看起来与 Linux 上使用的 Verdana 一样吗(或者,它是免费的吗?我对字体不太了解)?我在哪里可以获得 Helvetica?它有 Mac 操作系统许可吗?
任何代码示例都可以使用 C# 或 VB.NET。我都可以读。
先感谢您。
I need to generate small images for certain parts of text. Those will have to fit into the text seamlessly. I know I can not make up for every browser font settings available, but how do I have to check for Linux, Mac and Windows users depending on the user agent? I want to use the right font (of the three "Verdana, Arial, Helvetiva") for the right user agent OS.
So:
- How do I check for the OS? What do I have to compare to in the user agent?
- Where can I get the other two fonts. Does the Windows-included Verdana look the same as the one used on Linux (or, is it free anyway? I don't know much about fonts)? Where do I get Helvetica? Is it Mac OS licensed?
Any code examples can be in either c# or VB.NET. I can read both.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于客户端,请查看 http://www.w3schools.com/js/js_browser。 asp
对于服务器端,请查看
Request.Browser.Platform
。至于字体,我不能告诉你太多,除了确保你有一个与你想要定位的每个平台相匹配的(虚拟)机器。在我看来,这是真正确定你最终所做的一切确实有效的唯一方法。
For client side, have a look at http://www.w3schools.com/js/js_browser.asp
For server side, look at
Request.Browser.Platform
.As for the fonts, I can't tell you much, except to make sure that you have a (virtual) machine that matches each platform you want to target. In my opinion, it's the only way to be really sure that whatever you end up doing actually works.
如果您在 CSS 中使用
@font-face
并以像素为单位指定字体大小,您将在所有平台上以可预测的大小获得相同的字体。然后您可以为所有平台创建一组图像。If you use
@font-face
in your css and specify the font-size in pixels, you will get the same font on all platforms at a predictable size. Then you can create one set of images for all platforms.