Install a font in to a Server

14,129

Solution 1

You can use CSS 3 to use your own fonts on a HTML/PHP page. To do this, you have to make something like this:

@font-face {
  font-family: WendyMedium;
  src: url(‘path/to/your/font/file.ttf’);
}

You can use this font then with the folowing line of code:

p { font-family: WendyMedium, Arial, sans-serif; }

Note that this is only supported by real webbrowsers (Chrome, Safari, Firefox, etc). You also need the have a license to use that font on your website.

Solution 2

Just in case there’s any confusion, to use a font for a web page that you’ve generated via PHP, the font needs to be installed on the end-user’s machine, not your web server.

As mentioned in other answers, CSS3 provides a way for you to host the font file on your server (just like any other file), and reference it in the CSS, allowing the user’s browser to download it and render text on the page in that font.

However, as mentioned in Yi Yang’s comment, this often isn’t allowed by the font’s license. You’ll want to check whether and how this is allowed for Wendy Medium — perhaps see here: http://www.ascenderfonts.com/font/wendy-lp-family-3-fonts.aspx

Solution 3

In addition to wgriffioen's answer: this website lets you generate a javascript that does something similar. It also works in IE7/8.

Solution 4

Here's my solution:

@font-face {  
    font-family: 'IlMioFont';  
    src: url('ballpark_weiner.eot'); /* IE6+ */  
    src: local('Ballpark'),  
         local('IlMioFont'),  
         url('ballpark_weiner.woff') format('woff'), /* FF3.6 */  
         url('ballpark_weiner.ttf') format('truetype') /* Saf3+,Chrome,Opera10+ */  
    ;  
}
Share:
14,129
Testadmin
Author by

Testadmin

Updated on June 05, 2022

Comments

  • Testadmin
    Testadmin almost 2 years

    I have developed a PHP project. In this I want to implement the font style in Wendy Medium. But I don’t know how I install this font in my server.

    Does any one know how to do this?

    Thanks in advance.

  • tomsseisums
    tomsseisums over 13 years
    Gotta love that "real webbrowsers" example. Leaving IE out of the box again! :D
  • Pekka
    Pekka over 13 years
    +1 for correct answer, but -1 for "real webbrowsers". Dissing IE (and not mentioning workarounds to make things work in it as best as possible) has become almost as tiresome as IE's shortcomings themselves. Here is a SO question on how to support IE as well
  • Andrew
    Andrew about 6 years
    @Pekka Or detect IE & auto forward user to chrome download page and never feel tired again.