|
Posted by Chung Leong on 12/18/45 11:50
ctclibby wrote:
> How do I get whatever surfer to download the proper font file? Sure,
> it can be an option given to the surfer, but how can I find out what
> fonts are available, then show the surfer a message or something? Is
> this an automagic thing? Am I going about this all wrong?
As far as I know there is no direct way to check if a font is install
on a user's computer. What you can do is create an element that
specifies the use of the font, then check its width to see if it comes
out. Something like:
var width;
var el = document.createElement('SPAN');
el.style.fontFamily = 'Comic Sans MS; Sans serif';
el.style.fontSize = '100px';
el.style.visibility = 'hidden';
el.innerHTML = 'III';
document.body.appendChild(el);
width = el.offsetWidth;
document.body.removeChild(el);
Since the capital I in Comic San Serif has a top and bottom bar where
as it would not a regular sans serif font, if the width isn't above a
certain number then the font isn't there.
The lack of font embedding is a major bummer with Mozilla.
Navigation:
[Reply to this message]
|