How to obtain the CSS font-family of installed fonts? [duplicate]

Tags: php,html,css

Problem :

Possible Duplicate:
Detecting font in JavaScript
How to use our custom font on our website

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

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?

Solution :

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.

    CSS Howto..

    jQuery (1.8.1/1.8.2), Internet Explorer 8: How to remove css attribute transparent?

    CSS How to Transition from White to Background on Hover

    How to avoid form-control in all inputs with Twitter Bootstrap 3?

    I have a white icon - how to make it black without replacing it with CANVAS? It is a .png icon

    how to make sure that that grid layout row adjusts the height automatically as per content

    How to wrap text in table cell at hyphen?

    How to add a CSS style sheet reference to all Web forms in a Visual C# .NET Web project

    How can I get an element to stay within the browser's window width when its content is wider?

    How to hide and show a
    onclick when there's already an action for click?

    How do I get rid of an element's offset using CSS?

    How can I center Twitter-Bootstrap 3 navbar buttons?

    How to include stylesheet file only for one div?

    How do I edit the VIM Omni Completion so that all CSS properties do not end in a colon?

    How to set border around Twitter Bootstrap Icon?

    How do I make the mobile view of my website not show certain elements?

    CSS: How to vertically align elements inside div with display: table-cell

    How to use these ruby based CSS stylsheet frameworks languages?

    HTML5 vs HTML4 - h1 tag rendered with extra space - how to remove?

    How do you design your CSS?

    How do I make this sticky footer stick to the bottom of the layout when the sidebar exceeds screenheight?

    How to dynamically pass variables from HTML to CSS [closed]

    How to use CSS function instead of LESS function?

    How to set css to a specific selector using jQuery

    How to show list items in menu when hover on the parent's it via CSS? [closed]

    css divs display:none reseting and showing divs when function is called

    How to prevent “jerking” of page in browser

    How to get this hover effect with just CSS

    How to link to a CSS if a certain condition happens?

    How do I add the date a blog post was created in place of a bullet point under list-style-type?

    How to Customise the angular material date-picker?