1

I need to display all the fonts available in user's machine in browser. Is this possible using javascript or jquery or any other way around to get list font?

For example on my website user should able to see all the fonts available in his/her machine in a combobox and s/he can apply on any text in same page.

Kundan Atre
  • 3,853
  • 5
  • 26
  • 39
  • you will need flash to do that... – AMember Dec 26 '12 at 09:05
  • 1
    have a look here http://hasseg.org/blog/post/526/getting-a-list-of-installed-fonts-with-flash-and-javascript/ – AMember Dec 26 '12 at 09:07
  • I need to do on html based application, i can't go for flash. – Kundan Atre Dec 26 '12 at 09:07
  • Might be useful for you :- http://stackoverflow.com/questions/3597682/how-to-iterate-the-installed-fonts-using-javascript – Pranav Dec 26 '12 at 09:09
  • The browser will not allow you to read the fonts from the client file system. there are workaround that are not 100% good look here http://remysharp.com/downloads/font.js – AMember Dec 26 '12 at 09:09
  • that one is from here http://remysharp.com/2008/07/08/how-to-detect-if-a-font-is-installed-only-using-javascript/ – AMember Dec 26 '12 at 09:10

1 Answers1

0

There's no way to access the local font list from the browser as that would be a serious security breach. It will also threat privacy.

You need to use some kind of browser extension like: ActiveX, Firefox/Chrome/Webkit plugin, Flash, etc.

It can also be a little "dangerous" to use local fonts to format text if it will be read in other machines, as it is possible that other users don't have the fonts.

Have a look also at Google Fonts API, this makes lots of fonts available to any browser. I suppose it can be queried, and it is also web-safe.

xxxxxxxxx
  • 999
  • 5
  • 11
  • Hi Izaera Using ActiveX i was able to get system fonts , but can you please tell me about how can i do same in other browsers like Chrome, FireFox. I mean what code i can use for chrome or other browser. – Kundan Atre Dec 26 '12 at 09:12
  • Unfortunately for you, every browser has its own extension mechanism which, of course, is not standard. The development of this plugins is usually done using shared libraries and/or some javascript, but varies a lot from browser to browser. Some examples: http://blog.mozilla.org/addons/2009/01/28/how-to-develop-a-firefox-extension/, http://developer.chrome.com/extensions/getstarted.html – xxxxxxxxx Dec 26 '12 at 09:17
  • I would definitely consider using Google Web Fonts, which is here: http://www.google.com/webfonts. Another good workaround, as Pranav suggests, is to have your own "guess fonts list" and try to load them. But that won't of course give you the full list of fonts installed in the system. – xxxxxxxxx Dec 26 '12 at 09:19
  • Here you have Google Webfonts API: https://developers.google.com/webfonts/docs/webfont_loader?hl=es . Hope it helps. – xxxxxxxxx Dec 26 '12 at 09:22