[thelist] forcing a website font

pandy pandion at gmx.net
Mon Mar 15 11:06:16 CST 2004


Diane Soini wrote:
>I can't recall exactly how weft works, (because it turned out for our project PDF was a better solution so I've had no reason to look at weft again) but I do recall that there was some css you had to use. So, why not just use css to do what you are looking for. Set the alternate fonts first in your css, then use the weft css after. Browsers that do not understand the weft instructions will ignore them and default to the original css styles.
>
>If that's not gonna do it, just look for some javascript to do browser detection in general, then document.write() out the weft related html instructions. You should have no trouble finding general browser detection scripts out there.

There's no need for all that really. The mechanism used is part of CSS2, namely @font-face.
http://www.w3.org/TR/REC-CSS2/fonts.html#font-descriptions

That bit mainly tells the browser where the eot file can be found. Then you list your font among the other alternatives as usual.

@font-face  { font-family: 'Diane Fancy'; src: url(dianef.eot) }
.fancy            { font-family: 'Diane Fancy', Verdana, sans-serif }

Something like that. Since MSIE is the only browser that supports @font-face the other browsers just skip 'Diane Fancy' and go for the next choice. :-)

It's been a while since I played with this but IIRC WEFT is bulky and writes bulky code. What worked best for me was to feed WEFT a dummy file, let it do it's thing and then save the resulting eot file and trash the html  The font file is all that's needed from WEFT.

There's a requirement that's easy to overlook and without which the eot font won't work. One has to specify the domain(s) the font will be used from. This is embedded somehow in the font file itself and it won't allow itself to show up on not approved domains.


HTH
pandy




More information about the thelist mailing list