How to use a font family other than the one in the system?

Discussion in 'CSS' started by deva.vvel, Jul 6, 2007.

  1. #1
    Hi i used the following CSS code to use a font family other than the one in the control panel of the system, but in vain. Can any one help me whats wrong with the following.

    <head>
    <style>
    @font-face {font-family:myfont; src:url('./fonts/myfont.ttf');}
    </style>
    </head>
    <body>
    <P style="font-family:myfont;font-size:18pt"></P>
    </body>

    thanks in advance,
    deva
     
    deva.vvel, Jul 6, 2007 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    What's wrong? @font-face is MSIE only, and only works with .eot format fonts, not .ttf

    You can theoretically convert a .ttf to .eot using microsoft's WEFT (Web Embedded Font Tool)

    In general you should not be attempting to use fonts that aren't on the clients system as it bloats out the page, only works in IE if it works at all,

    You also should never just list one font in your font-family declaration - ALWAYS include a fallback default font-family should your font not be present - sans-serif, serif, monospace being the best supported.

    With browser compatability being a total joke, font embedding is a /fail/ not worth wasting the time and effort on.
     
    deathshadow, Jul 7, 2007 IP
  3. deva.vvel

    deva.vvel Guest

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks much deathshadow.. your instruction was very useful to me..
     
    deva.vvel, Jul 11, 2007 IP
  4. qube99

    qube99 Peon

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    @font-face
    Code (markup):
    is actually a CSS 3 selector, not MSIE only.

    The W3C specifications would allow for embedded TTF and other font formats if they were implemented in the browsers. The specs have been around for 5 years now.

    www.w3.org/TR/css3-webfonts/#q23

    It doesn't look to me like much is being done in this area by the browser folks but I don't really know. IE has a torqued version using the proprietary font format WEFT (Firefox's Triton engine might handle it in Quirks mode). I do know that it doesn't work in any of my browsers using normal or open source formats in a Strict doctype.

    I've seen a Rube Goldberg javascript workaround but you're still stuck using a proprietary format that none of the professional font converters can handle.
     
    qube99, Sep 10, 2007 IP