home *** CD-ROM | disk | FTP | other *** search
- FastText revision 3.0 Copyright 1988 by Darren M. Greenwald
-
- FastText is a copyrighted program. It may be distributed freely, but it
- may NOT be sold/included in any way in any commercial, or shareware
- ventures without permission from the author. It may be distributed in
- other public domain works so long as a notice of credit appears in the
- documentation.
-
- FastText may be distributed as part of a public domain collection, and
- posted on telecommunication services so long as no additional charge is
- made above, and beyond the normal, and reasonable fees charged for
- the media, or use of system time.
-
- If you would like permission to use this program in a commercial, or
- shareware venture, I can be contacted via the following methods:
-
- On GEnie: Send E-MAIL to DMG
- On Cute (714) 532-5698: Post a message in any forum to Darren Greenwald
- At Home: (714) 545-6458
-
- Including FastText in your programs -
-
- FastText is written in assembly using the Manx Assembler. Any changes
- needed to assemble this file with other assemblers is left up to you.
- You need then only link the resulting object file with your code, and
- replace all calls too Text() with FastText(). In addition you must call the
- InitFastText() routine before calling FastText(), and finally call
- FreeFastText() as part of your cleanup/exit routine(s). See the included
- FastText demo (Ftest.c) for an example of how easy this is to use.
-
- In "C" format, the calls are defined like so:
-
- InitFastText
- ------------
-
- success=InitFastText(Font)
-
- Inputs: Font - pointer to a TextFont structure
-
- Return: TRUE, or FALSE
-
- Description:
-
- This routine does a number of things for you. It checks to make sure that
- the font is a non-proportional font; it also checks to make sure the font
- is no less then 4 bits wide, but no more then 16 bits. In any other case
- this routine returns FALSE. Should this routine fail, you need not concern
- yourself too much. In this case all calls to FastText() are automatically
- routed to call Text() instead.
-
- Two CHIP RAM buffers are allocated based on the fonts height. Fonts can be
- any height, but keep in mind that taller fonts use more memory. One chip
- ram buffer is allocated for use as a buffer to draw the text imagery in, and
- the other is used to store the unpacked font data.
-
- The font image data buffer requires 512 bytes * the font height.
-
- The drawing buffer requires 128 bytes * the font height.
-
- If this seems like a lot of memory, this is the trade off you make for the
- faster text rendering. If the memory cannot be allocated, this routine
- will return FALSE, and all calls to FastText() are routed to call Text()
- instead.
-
- Finally this routine upacks the font data, sets up the masks, blitter shift
- values, and some pointers to the image buffer. Precalculating this
- stuff means that these calculations do not have to be done each time a line
- of text is rendered.
-
- A special faster blitter routine is used for 8 bit wide fonts because 1.)
- Due to the way the blitter handles shifting it is possible to draw 8 bit
- wide fonts faster, and 2.) This works out well since 8 bit wide fonts are
- commonly used as the system font.
-
- This routine should be called as part of your programs initialization
- procedures - it is your option to check for a return value since even if
- this fails, all calls to FastText() will automatically call Text() instead.
- This routine executes lickety-split; you won't have to wait "a moment" for
- the unpacking, and set-up to complete.
-
- FastText
- --------
-
- FastText(p,string,length)
-
- Inputs: rp - pointer to a rastport structure
- string - pointer to a string
- length - length of string to draw
-
- Return: None
-
- Description:
-
- This call is very similar to Text(). It uses the exact same parameters
- as Text(), and behaves in a very similar manner. You can set drawing
- colors (via SetAPen(), SetBPen()), drawing modes, etc. The text position
- is set via the Move() function just like Text().
-
- The X drawing position in the rastport is automatically incremented by the
- length (in pixels) of the string of text.
-
- There are also some significant differences (speed of rendering included)!
-
- Unlike Text() which draws a special image for non-defined characters in a
- font, FastText() draws undefined characters as blank spaces. This could be
- changed if it causes anyone any problems. I prefer it this way, but
- perhaps you may not?
-
- FastText() does not currently support any font styles (e.g., bold,
- underline, italics). This may be changed in the future.
-
- The REVPATH flag is ignored.
-
- FastText() treats NULL's as End of Line characters regardless of the length
- of string parameter. This behavior can be changed if it causes anyone any
- problems. I like it this way, but you may not. Yes, this was intentional
- since it means I can call FastText(), and set the count to some large
- number rather then having to calculate the length of each string. Text()
- on the other hand is terminated only by the length parameter, and will
- print NULL's as a non-printable character (usually a BOXY looking image).
-
-
- FreeFastText
- ------------
-
- FreeFastText()
-
- Inputs: None
-
- Return: None
-
- Description:
-
- Frees memory allocated by InitFastText(). This routine can be called
- safely even if InitFastText() failed - in other words, it won't try to free
- memory which was never allocated.
-
- ----------------------------------------------------------------------
-
- Other notes:
-
- It is very likely that this code is less then perfect. Let the bug reports
- roll in! Let me know, and I'll try to fix it ASAP. Also hopefully I can
- further optimize the speed of the rendering routines. In the future this
- whole thing may change anyway so that multiple fonts can be opened at the
- same time.