In my ASP.NET application I use Calibri as my font in stylesheets. But Calibri is come with Office 2007 so my stylesheet doesn't work with those client machines that have not installed the particular font. So How can i check if the font is there in the client machine and if not Can i install it to the machine on the web page opening?
Not the perfect solution but you can enter an alternative font. Such as:
SomeClass
{
font-family:'Calibri,Arial';
}
Just find something that is "good enough" if not Calibri.
If you need a specific font, see http://msdn.microsoft.com/en-us/library/ms533034%28VS.85%29.aspx - you can embed fonts in HTML without requiring the font to be installed on the end users computer.
The best solution (that will work across all browsers, unlike sascha's answer) is to use javascript to dynamically detect whether the user has Calibri installed or not.
I actually recently wrote a blog entry explaining how to do this, but, in short, get jquery font and use this:
Javascript code
font.setup();
if (font.isInstalled("Calibri"))
ImportCss("calibri.css");
function ImportCss(name) {
if (document.createStyleSheet) {
document.createStyleSheet('/static/' + name);
}
else {
var styles = '/static/' + name;
var newSS = document.createElement('link');
newSS.rel = 'stylesheet';
newSS.type = 'text/css';
newSS.href = styles;
document.getElementsByTagName("head")[0].appendChild(newSS);
}
}
calibri.css
body, input /* Input necessary for Google Chrome since it uses another * font for inputs otherwise */ { font-family: Calibri !important; font-size: 16px !important; }
Note
The reason why you can't just do font-family: Calibri, Arial, ...
is that Arial looks terrible at 16px, and Calibri looks terrible at 13px.