available fonts ?

M

Mel

is it possible to get a list of available fonts from client machine running
a browser ?
 
J

Joakim Braun

Mel said:
is it possible to get a list of available fonts from client machine running
a browser ?

Not with standard Ecmascript. Why would you want to? Anyway, fonts come in
many variants and versions, not all of which can be distinguished by name.
Something called "Times" on one computer wouldn't necessarily look the same
on another. Then there might be issues like is it a
bitmap/truetype/postscript/open type font, what is the glyph set, kerning
tables and so on.

If you want to, say, make headlines in a special font you can use PHP to
render images using fonts installed on the server. The Onion seems to do
that. (www.onion.com)

Joakim Braun
 
I

Ivo

"Mel" skrev

Not with standard Ecmascript.

But fortunately there is a way using a dialog helper object in IE6. See the
documentation at (mind the wrap)
< http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/
fonts.asp >
or an interactive example at
Why would you want to?

Well, to optimize the chances of things looking the intended way of course.
That is a very natural and healthy desire, it would be rather strange if
(web) designers didn't care about something so fundamental as fonts, not to
say criminal. It really is a shame that this has been standardized long ago.
On top of that, why not?

hth
 
G

Grant Wagner

Ivo said:
Well, to optimize the chances of things looking the intended way of
course.

That is what CSS is for. Something like this:

body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
}

means that the user agent should attempt to use Verdana, then Geneva,
then Arial, then Helvetica, then if none of those can be found on the
target platform, use any sans-serif font the platform can provide.
Failing that, the user agent will display your content in whatever
default font it chooses (it may do that anyway, more on that below).
That is a very natural and healthy desire, it would be rather strange
if
(web) designers didn't care about something so fundamental as fonts,
not to
say criminal. It really is a shame that this has been standardized
long ago.

How do you standardize the way fonts will appear using a mechanism that
can be viewed on multiple operating systems on multiple devices? There
is simply no way to guarantee a platform is going to have your choice of
fonts (or any font aside from some uncontrollable default for that
matter).

Not only that, but the end-user is always 100% in control of their
_user_ agent (Web browser). I can override _any_ choice you make about
which font to use. I can override _any_ choice you make about what color
the font is, I can override _any_ choice you make about how big the font
should be.
On top of that, why not?

As explained, because it's impossible from both a technical (you can't
use ECMAScript running in the user agent on the client to determine what
fonts are available) and a practical (even if you could determine what
fonts are installed, you have no guarantee you can actually _use_ those
fonts) perspective.

The Web is not desktop publishing. HTML/CSS are nothing more than
_suggestions_ to user agents about how to layout and display content.
User agents are completely free to ignore any and all choices you as a
Web site designer make about how the site should appear.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top