Forum Moderators: not2easy
span.curly { font-family: "cmsy10" ; src: url("http://www.domain.com/font/cmsy10") format("truetype", "type-1") }
I have tried various permutations of this (ie, with and without the "truetype") with Konqueror, Opera, Firefox, and Safari. The font only displays correctly in Konqueror, which already has this particular font locally, so it isn't getting it server-side either, most likely.
Any suggestions appreciated.
Brian
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US"><head>
<title>Title</title><style type="text/css">
<!--
@font-face /* curly font */
{
font-family: "cmsy10" ;
src: url( "http://www.domain.com/font/cmsy10" ) ;
format( "truetype", "type-1" ) ;
}
span.curly { font-family: "cmsy10" ; }
-->
</style>
</head><body>
<p>
<span class="curly">THESE-LETTERS-SHOULD-BE-ALL-CURLY</span>.
<br>
THESE LETTERS ARE NOT.
</p>
</body>
</html>
Brian
This should work in Firefox, Opera and IE.
Should, maybe - but in reality
@font-face lacks support in all major browsers except for limited support for .eot files in IE5.5+. Gecko (Firefox etc.) has no support, and the @font-face syntax has now been removed entirely in the proposed CSS 2.1 revision. There are several things which killed font-embedding, but the biggest reason is that the font foundries jealously guard their rights. Loading the .ttf onto your website and offering it for download will most often be a copyright infringement in itself.
The best solution for using alternative fonts for headings etc. is one of the various sIFR methods, which entails dynamically switching standard text with Flash containing the required characters.
Once you’ve added your Unicode font it’s just a case of finding out which characters are what and embedding them into your document. There’s a page on unicode.org [unicode.org] that should help you. Once you’ve found out your reference you can either embed it using a direct copy+paste of the character, work out some way of typing it directly (e.g. on my Mac I’ve got a Unicode hex input) or use an entity reference (e.g. α or α). Make sure you’re serving your page as UTF-8 (well, technically any of the UTF encodings) if you’re going to embed the character directly instead of using a reference.
[edited by: Robin_reala at 2:52 pm (utc) on Dec. 30, 2006]
As a further note, I'd regarding importing a font as a potential security risk, which is possibly one more reason why support is patchy and going away.
Yes, I think that using Unicode symbols and/or a bit of GIF output from TeX or similar is probably the way to go, though something vectorised rather that rasterised (eg SVG rather than GIF) might scale a bit better with the text around it.
Rgds
Damon
[edited by: DamonHD at 3:01 pm (utc) on Dec. 30, 2006]