获取 Firefox 扩展中的字体列表
)问题在于以下行:
var fontList = Components.classes["@mozilla.org/gfx/fontlist;1"].
createInstance(Components.interfaces.nsIFontList);
某个地方损坏了,并且(部分
Error: Components.classes['@mozilla.org/gfx/fontlist;1'] is undefined
在我的 Firefox 扩展中,首选项窗口显然在 Firefox 2.0 之后的 href="https://bugzilla.mozilla.org/show_bug.cgi?id=397813" rel="nofollow noreferrer">https://bugzilla.mozilla.org/show_bug.cgi?id=397813),但我找不到有关如何使用 nsIFontEnumerator 的任何信息。
Stackoverflow 本身只有一个与该主题相关的问题,但尚未得到解答:如何发现字体输入?
In a Firefox extension of mine, the preferences window apparently broke somewhere after Firefox 2.0, and (a part of) the problem lies in the following line:
var fontList = Components.classes["@mozilla.org/gfx/fontlist;1"].
createInstance(Components.interfaces.nsIFontList);
which errors with a
Error: Components.classes['@mozilla.org/gfx/fontlist;1'] is undefined
Some digging suggests that fontlist is in fact a wrapper around nsIFontEnumerator (https://bugzilla.mozilla.org/show_bug.cgi?id=397813) but I can't find anything on how to use nsIFontEnumerator.
Stackoverflow itself only has one question which sort of touches on the topic, which is unanswered: How to discover Font Type?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当前的 Firefox 版本中不再存在您所引用的界面。然而存在的是 nsIFontEnumerator :
MDC 上似乎没有记录它,因此 http://www.oxymoronical.com/experiments/apidocs/interface/nsIFontEnumerator 是您可以获得的最佳参考。
The interface you refer to no longer exists in current Firefox versions. What exists however is
nsIFontEnumerator
:It doesn't seem to be documented on MDC so http://www.oxymoronical.com/experiments/apidocs/interface/nsIFontEnumerator is the best reference you can get.