Well, you're right that it works for the usual fonts. I hadn't noticed that because my interest in having such a test derives from the desire to detect if users have the necessary fonts installed to display MathML in documents served as
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"> So I'm testing for the presence of the Mathematica 4.1 fonts (Math1, Math2, etc) and the CM fonts (cmsy10, cmr10, etc). The span-width test works fine on Internet Explorer 6 and 7, but not on Firefox. In fact, on Firefox 2.0.0.7 (with its built-in MathML capability), those fonts appear to have been hijacked out of the public realm. I can't assign any of them via CSS and have things display as expected on Firefox. For example, <p>Beginning <span style="font-family:Math1;">middle</span> end</p> displays on Firefox using the default paragraph font. I'd never noticed that before. So I guess this is out of the jQuery domain now. I'll have to investigate what's going on with Firefox and the MathML fonts. Thanks for your assistance, though. Ed Martin On Oct 6, 11:21 pm, "Joel Birch" <[EMAIL PROTECTED]> wrote: > I set up a test and added some debugging code and it works for me. > Here is the relevant stuff so you can see how it differs. > > HTML: > <div id="tester"> > <span id="test">Some well-chosen sample text</span> > <span id="ctrl">Some well-chosen sample text</span> > </div> > > JS: > function IsItThere( fontname ){ > $("#test").css("font-family", fontname + ", monospace" ); > var testWidth = $("#test").width(); > var ctrlWidth = $("#ctrl").width(); > console.log('testWidth: '+testWidth); > console.log('testWidth: '+ctrlWidth); > return ( testWidth != ctrlWidth );} > > $(function(){ > $(document).click(function() { > IsItThere('Arial'); > }); > > }); > > I made is so you click the page anywhere and the width values are > displayed in the Firebug console. > > Joel Birch.