The example from tvanfosson actually works. You'll need to use width instead of height though to compare the fonts. You'll also want to make the second font of the font list arial (or whatever fall back font you want to use). After that simply compare the widths, and if they are the same, you'll know that it's using arial in both cases:
<style type="text/css">
.segoeUI
{
font: 13px "Segoe UI" , "Arial", "sans-serif";
display: none;
}
.lucidaGrande
{
font: 13px "Lucida Grande" , "Arial", "sans-serif";
display: none;
}
.arial
{
font: 13px "Arial" , "sans-serif";
display: none;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
var sWidth = $('.segoeUI').width();
var aWidth = $('.arial').width();
var lWidth = $('.lucidaGrande').width();
alert('Segoe: ' + sWidth + ' Arial: ' + aWidth + ' Lucida: ' + lWidth);
});
</script>
I use this to optionally load a different style sheet that will use a different font size if segoe is not available. Reason being that segoe UI is too small at 11px and the other two fonts are too big at 12px. Since Segoe UI and Lucida Grande have better legibility, I try to use these first. By comparing them to arial, I know whether they are present on the system, thanks to tvanfosson.