让用户从自己计算机上可用的字体中选择一种字体

Mr *_*ter 5 html javascript user-interface fonts

有没有办法让用户用Javascript从自己的计算机上选择字体?

抱歉,如果这听起来有点基础,但我用谷歌搜索了它,我发现的只是数十万个关于如何使用style.fontFamily. 然而,这不是我的问题所在。我已经知道如何设置字体了。

我想允许用户将某段文本设置为他们可以自己选择的某种字体。就像这个小提琴一样。

<p>
   Type a font name: <input id="font" /> and click
   <button type="button" id="button">here</button>
</p>
<p id="example">
   And this is the text that will be displayed in the chosen font.
</p>
Run Code Online (Sandbox Code Playgroud)
document.getElementById('button').onclick = function() {
 document.getElementById('example').style.fontFamily =
  document.getElementById('font').value;
};
Run Code Online (Sandbox Code Playgroud)

除非我希望输入datalist包含用户计算机上的字体名称。或者它可以是一个select.

有些库乍一看很有前途,例如“JQuery Font Chooser”,但它也使用预设列表,而不是使用实际可用的字体。

到目前为止,似乎无法从客户端计算机获取字体名称......