[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FONTROTATE()
 Rotates and mirrors images within a font string
------------------------------------------------------------------------------
 Syntax

     FONTROTATE(<cFontstring>,<nTurnDirection>
        [<nPixelHeight>],[<nStart>]) --> cNewFontString

 Arguments

     <cFontstring>[@]  Designates the font in character string form,
     within which the characters are rotated or mirrored.

     <nTurnDirection>  Designates the rotation axis or rotation direction
     in numeric form with a value from 1 to 3 (see Description).

     <nPixelHeight>  Designates the accompanying pixel height and number
     of bytes that represent an individual character within a font string.
     This is only necessary for modes 1 and 3.

     <nStart>  (This is for only for mode 1.)  Designates from which
     pixel line (from which byte), the 8 bytes are rotated.  Based on
     <nPixelHeight>, the bytes before and after this range are deleted (set
     to 0).  The first byte of the character corresponds to the 0 value.

 Returns

     If CSETREF() is not implemented, FONTROTATE() returns an amended font
     string.

 Description

     FONTROTATE() rotates the characters within a font string in different
     directions.  Rotation direction affects the number of characters that
     can rotate.

 Constructing Fonts

     If a font is transferred to a string with GETFONT() and the same number
     of bytes are used for an individual character each time, as specified by
     the current font height from CHARPIX().  For example, if a 14-pixel font
     is installed, then the font string contains 256 groups of 14 bytes.
     Each of these bytes represents a horizontal pixel line.  Since the
     characters are always 8 pixels wide, one bit always represents this
     pixel.

 Direction of Rotation 1

     If a font uses GETFONT() to transfer a string, then a comparable number
     of bytes are used each time for an individual character, as specified by
     the current font height in CHARPIX().  Since only an
     8-pixel width is ever available, only 8 bytes are rotated for each
     character every time.  To determine these bytes, you must designate the
     pixel height <nPixelheight> and the start of the 8-byte area
      <nStart> .  All bytes above and below the rotation are cleared (set to
     0). The rotation point is determined by the computation <nStart> + 4.

 Direction of Rotation 2

     In this mode, the characters are rotated 180 degrees on the vertical
     axis (the Y-axis), and thereby mirrored.  The <nPixelheight> and
     <nStart> parameters are unnecessary, since only the bits in each byte
     are mirrored.

 Direction of Rotation 3

     In this mode, the characters are rotated 180 degrees on the horizontal
     axis (X-axis), and thereby mirrored in the other direction.  You must
     specify the <nPixelheight> parameter.  The <nStart> parameter is not
     needed, since the character is affected through its entire height.

 Combinations

     Since modes 1 to 3 support all three rotation directions, multiple
     function calls allow you to combine the rotation operations and create
     rotated and mirrored characters.

 Notes

     .  The entire string is always worked on.  If you only want to
        change a region of characters on the screen, it can be done easily
        and is regulated by the SETFONT() optional parameter, when you write
        the font back to the screen adapter.

     .  If the parameter is passed by reference, use CSETREF() to
        suppress the return value and increase the speed.

 Example

     In the following example, the screen is first filled with characters and
     then rotated.  This is particularly useful in the VGA 50-line mode,
     since it has an 8 x 8 pixel matrix and none of the characters are cut
     off.

     All parameters for FONTROTATE() are designated in such a generalized
     manner that you can use them for other pixel relationships.

     CSETREF(.T.)                   // Optimize by reference method
     nMODE  := GETSCRMODE()         // Save old mode
     VGA50()
     FOR I := 0 TO MAXROW()         // Build screen
        @ I, 0 SAY CENTER("ABCDEFGHIJKLMNOPQRSTUVWXYZ- 1234567890")
     NEXT I
     nPixel  :=  CHARPIX()          // Determine font pixel count
     cFont   :=  GETFONT()          // Load font to variable
     nKey      :=  0
     DO WHILE Key <<>> 27
        MILLISEC(100)               // Time delay
        FONTROTATE(@cFont, 1, nPixel, (nPixel-8)/2)
        SETFONT(cFont)
        nKey  :=  INKEY()
     ENDDO
     SETSCRMODE(nMODE)              // Reset to original mode
     RETURN


See Also: SETFONT() CSETREF()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson