Font List

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
SBukoski
Forum Contributor
Posts: 128
Joined: Wed May 21, 2003 10:39 pm
Location: Worcester, MA

Font List

Post by SBukoski »

I have a question on fonts. Is it possible via Server Side scripts, or anything for that matter, to determine What fonts are installed on a users machine? The reason I ask is because I was throwing around the idea to be able to have the user more customize the appearance of the pages. To be fully customizable I wanted them to be able to select the FONT, but didn't want to create a blanket list. Especially since some fonts may not be on that users system.

Any ideas?

Thanks...
caboom
Forum Newbie
Posts: 5
Joined: Thu Aug 07, 2003 6:24 pm

I'm searching for the same answer

Post by caboom »

I am browsing the forum for this answer also. I am thinking maybe of reading the c:\WINDOWS\FONT directory of the local machine, and then looping the file names into a <option> of a html select tag.

what do you think is it possible?
caboom
Forum Newbie
Posts: 5
Joined: Thu Aug 07, 2003 6:24 pm

Something like this

Post by caboom »

Here is something like what i mean but I'm NOT getting the readout I want

<select name="font">
<?php
$current_dir="C:\\WINDOWS\\FONTS\\";
$dir=opendir($current_dir);
while ($file=readdir($dir)) {
echo "<option value=\"".$file."\">".$file."</option>\n";
}
closedir($dir);
?>
</select>
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

PHP is server-side. If you could read a client's hard drive, that would be pretty insecure. When you run opendir() on a directory, the server's hard drive is scanned for that directory.

I know you can dynamically and automatically load fonts onto a user's computer using CSS, so it may be possible to read their fonts too. If you can, it will be via browser transactions, not PHP. A CSS guru will be able to answer this question in a few seconds, so I'm not much use there.
caboom
Forum Newbie
Posts: 5
Joined: Thu Aug 07, 2003 6:24 pm

maybe javascript

Post by caboom »

yes your right qartis... I was having a dumb moment there. I'm making a php script that allows a client to change the content of a web page by simply filling out a text area form. I want them to be able to click and choose the font they desire from a option drop down box. If they choose a font that is not on the server, that is there problem I'm not worried about that. Javascript is client side, maybe Javascript can read a clients machine directory.

Yes ? NO?

Maybe it would be easier to just make a static list.... but I was curious to see if this can be done.
Post Reply