如何使用javascript迭代安装的字体? [英] How to iterate the installed fonts using javascript?

查看:97
本文介绍了如何使用javascript迭代安装的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用javascript迭代已安装的字体?

How to iterate the installed fonts using javascript?

推荐答案

首先,您可能想要检查安装了哪些字体在客户端上。阅读 http://www.lalit.org/lab/javascript-css -font-detect

To start off, you might want to check what fonts are installed on the client. Read up on http://www.lalit.org/lab/javascript-css-font-detect

您需要拥有自己的字体列表进行检查,然后通过检查每个列表来安装一系列已安装的字体查看安装了哪一个。

You need to have your own list of fonts to check, then you have an array of installed fonts by checking each of the list to see which one is installed.

宽度的差异将告诉您客户端计算机上安装的字体的可用性,因为浏览器将回退到其默认字体。因此,您可能需要对文本宽度进行一些不可见的测试,以确定是否安装了字体。

The difference in widths will tell you the availability of the fonts installed on the client's computers because the browser will fall back to its default font. So you probably need to do some invisible testing for text widths to determine if a font is installed.

这篇关于如何使用javascript迭代安装的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆