PDA

View Full Version : Find fontName from list?


Quiet Storm
02-12-2003, 08:09 PM
http://www.gemal.dk/browserspy/fonts.html

The code lists the fonts in your folder (IE6+ only, I think).

I'm looking for a code that will look at that list and let me know if the Verdana font is installed. Something like:

if (font list) CONTAINS "Verdana" {do.nothing}
else {do.something}

Can someone help me with this, please?

Catman
02-12-2003, 08:38 PM
Maybe something like this:

fontList = fontNames.join();
if (fontList.search("Verdana") != -1) {do nothing}
else {do something}

Quiet Storm
02-12-2003, 09:04 PM
Error: 'fontNames' is undefined.

Looked like it would work! :)

http://www.angelfire.com/mo3/cbch21/TEST/Fonts.html

Catman
02-12-2003, 09:19 PM
Hmm. I wonder if it makes a difference whether you define the variable in the head section (that's what I've done when using string methods).

Quiet Storm
02-12-2003, 10:14 PM
I'm not quite sure what you mean (or how to do that).

Could you show an example?

Catman
02-12-2003, 10:49 PM
<html>
<head>
<title>My Cool Page</title>
<script type="text/javascript>
<!--
var fontNames = new Array;
-->
</script>
</head>
<body>
</body>
</html>

Quiet Storm
02-12-2003, 11:02 PM
Didn't like that trick either. :(

Tried putting the entire thing in the HEAD tag as well with no luck.

I did find a different script that may be more easily modifiable:

http://angelfire.com/mo3/cbch21/TEST/Fonts2.html

Quiet Storm
02-15-2003, 01:47 AM
No ideas?:(