I’m trying to design a font selection tool where a user can select one of the fonts shown.
I’m using this code:
<label style="font-family: TimesRoman;">
<input type="radio" name="font" value="TimesRoman"/> sample 1
</label>
which displays “sample 1” in “Times Roman” fontface, and this can be selected using radio buttons.
I have installed many external fonts just like “TimesRoman” and I want to use their names in the style atribute so that “sample 1” will be displayed in their format, but I don’t know the font family of external fonts. How do I obtain the font-family of installed fonts?
You cant use all types of fonts. User need to have font in his machine or you have to use thirdparty font library like Google web fonts.
For the available fonts, your started scripting is fine.
You can also obtain the list of fonts a user has installed on her machine by using javascript/CSS. You could compare that with your list and only show elements of the fonts actually installed.