Hi,
How to detect whether or not a particular font is installed using javascript only. (Disregard to whether it is enabled or not).
Thanks
Hi,
How to detect whether or not a particular font is installed using javascript only. (Disregard to whether it is enabled or not).
Thanks
How about you just do what the rest of the world does: specify the font with CSS, and offer fallbacks? No app should ever need to know what fonts are available, nor is there a reliable way of doing so. (You would probably have to print hidden div with the font and measure it to see if the dimensions are what you expected, but that would be extremely brittle.)
Just go for:
body { font-family: MyFont, Helvetica, Arial, sans-serif }
If you want to be doing anything with the font other than display things in it if possible, consider an alternative solution.
@Matchu suggested you rightly but here is what you are looking for:
http://remysharp.com/2008/07/08/how-to-detect-if-a-font-is-installed-only-using-javascript/
Font family declarations should suffice to provide a fallback in case the font you want to use is not present.
But if you really need to use a special font in your site, although this uses JavaScript, I'd recommend Cufon since it's the most cross-browser solution out there - there is a CSS3 fix (font-face declarations), but it doesn't work in all browsers yet.
If you absolutely need a specific font, all your visitors must have current browsers. Then you can use webfonts.
If that's not an option, you must render the font on your server and serve an image.