Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>gfntload()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 GFNTLOAD()
 Load a font file into memory
------------------------------------------------------------------------------
 Syntax

     GFNTLOAD(<cFontFile>) --> aFont

 Arguments

     <cFontFile> is a character value that represents the name of the
     font file to load.

 Returns

     GFNTLOAD() returns a pointer to the VMM region where the font is loaded.
     This value can later be used as input to GFNTERASE().

 Description

        CA-Clipper supports two types of fonts:

        1.  Video ROM fonts--.FND

        Video ROM .FND fonts are used in all the standard CA-Clipper terminal
        calls such as DEVOUT(), TBROWSE(), and GWRITEAT().  The size of .FND
        fonts is always 16x8.  If you want to use a different size font, such
        as 8x8, you will need to supply the font file.

        2.  Windows Bitmap fonts--.FNT

        The Windows Bitmap .FNT fonts can be used with the GWRITEAT()
        function.

     .  Using .FND fonts:  The .FND fonts are 16 pixels high.
        Therefore, the font is displayed from pixel 1 to pixel 16 of each
        screen row.  CA-Clipper allows you to control the number of pixel
        rows to use for the font:

        GFNTSET(aFont, nClipTop, nClipBottom)

        Pass <aFont> as NIL if you only want to change the <nClipTop> and
        <nClipBottom>.

        This feature provides the ability to display a one pixel frame around
        a GET or MENU PROMPT, etc. without having to use GWRITEAT(), because
        DEVOUT() (@..SAY..) is faster than GWRITEAT().

     .  Using .FNT fonts:  Be aware that .FNT fonts are proportional.
        For example, this means that the characters "m" and "i" will not be
        the same number of pixels in width.

        To use .FNT fonts, load a FNT font into memory :

        aFntFont := GFNTLOAD( "MyFnt.FNT" )

        GWRITEAT( X, Y, cString, nColor, LLG_MODE_SET, aFont )

        By passing LLG_MODE_NIL to GWRITEAT(), you can retrieve the width of
        the string to be displayed on screen (without displaying it).

        <nWidth> will contain the # of pixels of the string:

        nWidth := GWRITEAT( X , Y, cString, nColor, LLG_MODE_NIL, aFntFont)

        <nColumns> will contain the # of columns:

        nColumns := nWidth / 8.

 Examples

     .  This example loads a Font file called MyFont.FND:`

        // Function ShowOneFont (cString)
        LOCAL aFont
        // Load a specific font file (MyFont.FND) into memory
        aFont := GFNTLOAD("MyFont.FND")
        // Display cString using the loaded font
        GWRITEAT(X, Y, cString, nColor, LLG_MODE_SET, aFont)
        // *Important*
        // You must erase the font from memory if it is no longer
        // needed.
        // This is because CA-Clipper's VMM is unable to automatically
        // free the memory occupied by aFont.
        GFNTERASE(aFont)
        RETURN

 Files   Library is LLIBG.LIB, header file is Llibg.ch.


See Also: GFNTSET() GFNTERASE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson