Use Any Font on a Website

Discussion in 'Programming' started by Ascendancy, Mar 27, 2008.

  1. #1
    I have been thinking about this idea for a while now, and I don't know how to implement it. When defining text for your website using CSS you can list any type of font you want, but if the user doesn't have the font installed then you cannot display that font on the webpage. Is there a way that you could potentially create a "fonts" directory, then put fonts in there and use some backend programming to create the text from those fonts? I know this can be done to create images, like CAPTCHA images, but what about using the fonts as actual text?
     
    Ascendancy, Mar 27, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Try this:

    
    @font-face { 
     font-family: cmsy10; 
     src: url(http://www.domain.com/font/fontname.ttf); 
    } 
    
    p {
    font-family: fontname, "Times New Roman", Times, serif;
    } 
    
    Code (markup):
    Peace,
     
    Barti1987, Mar 28, 2008 IP
  3. Ascendancy

    Ascendancy Active Member

    Messages:
    1,721
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    90
    #3
    I just tried that and it didn't work. Maybe I'm doing it wrong?

    When you are in the @font-face declaration, for font-family do you just put the name of the font, or is cmsy10 a special character set that needs to be used? I'm not familiar with a font named cmsy10, so I'm just wondering if maybe that's where I went wrong. Thanks for the help though, I'm gonna see if I can get it to work.
     
    Ascendancy, Mar 28, 2008 IP