Is there a way to let the user choose a font from their own computer with Javascript?
Sorry if this sounds a bit basic, but I googled for it and all I found was hundreds of thousands of tutorials on how to use style.fontFamily
. That, however, is not what my problem is. I already know how to set a font.
I want to allow the user to set a certain piece of text to a certain font they can choose themselves. Like in this fiddle.
<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>
document.getElementById('button').onclick = function() {
document.getElementById('example').style.fontFamily =
document.getElementById('font').value;
};
Except I want the input to have a datalist
that contains the font names on the user's computer. Or it can be a select
.
Some libraries look promising at first sight, such as "JQuery Font Chooser", but that too uses a preset list instead of using the actually available fonts.
By now it almost looks as if fetching font names from the client computer is not possible...