home *** CD-ROM | disk | FTP | other *** search
- FUNCTION getfont() - open a disk font for use.
-
- struct TextFont *getfont(name size)
- char *name;
- int size;
-
- Getfont() gives you easy access to the disk based fonts of the Amiga.
- All you have to do is pass the name (a character string) of the font and
- the size you would like. If opening the font succeeds, you will be able to
- immediately SetFont(rp, text_font) in your current window and use it from
- then on (with the Text() function). This function returns NULL if anything
- fails.
-
- The name you pass to getfont() can have a ".font" extension or not. If
- it doesn't, then it will be appended. Also be aware that if you specify a
- full pathname for name, that font need NOT be in the current FONTS:
- directory. This is a little known but true fact.
-
- Size should simply be the point size of the font you want. For example
- if you want Times 17, you would use size == 17.
-
- To open a font called "helvetica" in a 23 point size you would do this:
-
- struct Window *wind; /* assume we opened it earlier */
- struct TextFont *tf;
-
- /* open the font and error check the result */
- tf = getfont("helvetica", 23);
- if (tf == NULL)
- no_font();
-
- SetFont(wind->RPort, tf); /* from now on we can use the font */
-
- ..... /* do other stuff */
-
- CloseFont(tf); /* do this BEFORE calling killwindow() */
-
-
- NOTE : You should call CloseFont() before calling killwindow(). This will
- prevent fonts from being kept in memory unnecessarily. It is best
- if you can call CloseFont() as soon as you are done with the font.
- This prevents wasting memory.
-
-
- Essentially, there are 3 steps to using a disk font. Open the font
- with getfont(). Then call SetFont() for the window/screen you wish to use
- the font on. Then use the graphics library text routines for whatever you
- want. Finally call CloseFont() when you are done. Nice and easy.
-
-
-
- TODO : should probably be some sort of resource tracking so that you don't
- have to call CloseFont().
-
- would be nice if there was a single call you could make to open and
- set the font for a window (and then not have to worry about after
- that because of the item above).
-
-
- BUGS : ha! c'mon -(;-) (smiley with a mohawk!)
-
- SEE ALSO : makewindow(); makescreen();
-
-
-