Forum Moderators: open

Message Too Old, No Replies

Using custom fonts beyon Arial, Times etc, how?

How to embed other fonts than normal ones

         

silverbytes

6:36 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to use other fonts than Arial, Times etc.
But still as html text (not flash).
I think today that's possible and safe at least for MS Internet Explorer user's.

Can someone tell me how to do that?
What is needed?
Is it really safe?

Thanks!

cmatcme

6:45 pm on Mar 27, 2005 (gmt 0)

10+ Year Member



Can someone tell me how to do that?

<font face="Other Font" size="3" color="red"> Text </font>

What is needed?

The user has to have the font on their computer. Using weird fonts which you may have downloaded off the internet or bought on a disk a user may not have which is why most people use fonts that everyone has ie Arial. If they don't have it I believe it will bring up the user's default font. If people usually want to use weird fonts they usually embed them in images

Is it really safe?

Yes. I've seen it done before but very rarely, probably because of the aforementioned reasons.

cmatcme

tedster

6:51 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This Windows font survey may be helpful in making decisions:

[codestyle.org...]

The best idea is to set font-family rather than font, and list several options so the browser that has no access to your most preferred font still has instructions for the next best choice.

Also note that the link I offered is the results of a survey - so it's only a rough idea and not a true market penetration report.

Wlauzon

7:12 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nearly all of those shown there in the top 85% or so also have a Mac equivalent, so you can usually use the old font = "screaming bananas", Verdana, Arial, sans-serif thing.

As long as you specify common alternatives usually no problem.

bedlam

7:36 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<font face="Other Font" size="3" color="red"> Text </font>

C'mon Cmatcme, there is really absolutely no reason to be doing it this way these days - especially for people starting out.

Silverbytes, a better way is to use css for defining your fonts. This also allows you to specify 'backup' fonts in case the 'first choice' font is not present on the visitor's system. For example, you could put the following code into the <head> section of an html document:

<style type="text/css">
body
{
font-family:arial,helvetica,tahoma,verdana,sans-serif;
font-size:11px;
line-height:14px;
}
</style>

This css will set all text in the body element to 'arial' (and everything that shows up on your page is in the body element). If arial is not present, it will go down the list, and if none of the named fonts is present at all, it will still default to whatever the user's system uses as the default sans-serif font.

For more information, check out the CSS Forum [webmasterworld.com] and the CSS Library [webmasterworld.com], or try a Google search for "CSS tutorial" [google.ca].

-B

tedster

7:47 pm on Mar 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, you may want to learn about Microsoft's WEFT - or Web Embedding Font Tool [microsoft.com].

However, it hasn't really caught on in a big way - probably for a combination of reasons, including the fact that it's Internet Explorer based, the extra time it takes for the visitor to download the font (even though it's automatic) and also questions from font creators about violations of their copyright.

cmatcme

12:23 pm on Mar 28, 2005 (gmt 0)

10+ Year Member



You can set default fonts with css? I've only just started learning css which was when I read its benefits in an article. I've got scrollbar colours and body, text, header, link and scrollbar colours in 2 css documents and thought I was doing well :(

cmatcme

webaster

12:30 pm on Mar 28, 2005 (gmt 0)

10+ Year Member



anyone considdered the extra bandwith involved

better solutions are text replacement with flash (swfs)
or php to include fonts

katana_one

1:51 pm on Mar 28, 2005 (gmt 0)

10+ Year Member



anyone considdered the extra bandwith involved
better solutions are text replacement with flash (swfs)
or php to include fonts


You're right! Flash text would involve extra bandwidth. <grin>
But seriously, a simple CSS style would not eat up much bandwidth at all. An external style sheet (properly coded) actually helps reduce bandwidth usage because the .css file gets cached on the first page load, and is then applied to all pages on the site that use that style.
With sites that I've done, I've noticed a 50% - 66% reduction in file size when I use CSS.

bedlam

6:08 pm on Mar 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can set default fonts with css? I've only just started learning css which was when I read its benefits in an article. I've got scrollbar colours and body, text, header, link and scrollbar colours in 2 css documents and thought I was doing well :(

Don't get me wrong, if you're doing that stuff, you are doing well - just think of the alternative... :-o

With sites that I've done, I've noticed a 50% - 66% reduction in file size when I use CSS.

This seems about right based on the nested-table based sites I've re-built. In some cases, I have reduced page weight by over 80% across entire sites. I've replaced code like this:

<center>
<table width="100%" bgcolor="red" cellspacing="3">
<tr>
<td align="center">
<table width="100%" bgcolor="green" cellpadding="3">
<tr>
<td>
<font size="+2" family="arial" color="#ff9900">Headline</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>

...with this:

<h2>headline</h2>

...and this:

h2
{
font-family:arial,helvetica,tahoma,sans-serif;
color:#f90;
text-align:center;
background:#f00;
border:3px solid #00f;
padding:3px 0;
}

...which, if you consider that the css file is typically loaded only once per visit to a site could be a huge reduction in bandwidth, as well as being almost incredibly easy to maintain by comparison...

-B

silverbytes

4:06 pm on Mar 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you all. I was pointing near tedster
comment. Yes, I know how to set alternative font but does not guarantee users to view it as you said. So my question was about how to embed fonts in html, instead define assuming risks.

Embedding fonts doesn't seems to be a safe or extended practice...

tedster

7:57 pm on Mar 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, embedding fonts has its problems - download time, limited to IE on Windows, etc.

There's no sure thing here - the web just isn't print. People can always install what they want, overrule your font AND size instructions with their own stylesheet, and so on. However, with a well considered choice of alternative fonts in the font-family, and a layout which is NOT required to pixel perfect, you can do extremely well.

For a serif font, I like to put Georgia early in the chain - it's one of the fonts that looks great on screen and it's common on both Windows and Macintosh. This list performs pretty well and gives a neat and different look than TNR:

font-family:Georgia,Book Antiqua,Palatino,serif;

jaybird

9:02 pm on Mar 30, 2005 (gmt 0)

10+ Year Member



well i could tell you about microsoft weft.

it provides you with .eot file.
+plus
+you can choose it to contain only those characters that are on your page thus it is not very heavy to download (in my cas it is 12,5kb)
+i've tested it only in opera 7 ie 6 and ff and it works in ff!
-minus
-you cannot (ok, that's me who cannot) use css font family declaration. you need to use <font>
-it is not displayed in opera
-the program interface is made awful
-the setup is 9mb
-you would definitely meet the font you like which is broked or for some other reasons could not be embedded

tedster

9:26 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the report, jaybird. I knew there must be some reason few people are using WEFT - and tghe WEFT pages at Micorsoft are two years out of date.

niels

12:14 pm on Apr 2, 2005 (gmt 0)

10+ Year Member



"A list Apart" has a nice article about Dynamic Text Replacement, might be just what your looking for.


Using JavaScript and PHP, we can generate accessible image-headings using any font we like. And we don’t have to change the structure of our HTML or CSS at all.

[#*$!.com ]

[edit]The url doesnt show, if im breaking a rule im very sorry, *reading rules now

silverbytes

8:01 pm on Apr 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks again... BTW las link didn't work.