home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD2.0 / Text_Autodocs / diskfont.doc < prev    next >
Encoding:
Text File  |  1992-09-02  |  7.9 KB  |  244 lines

  1. TABLE OF CONTENTS
  2.  
  3. diskfont.library/AvailFonts
  4. diskfont.library/DisposeFontContents
  5. diskfont.library/NewFontContents
  6. diskfont.library/NewScaledDiskFont
  7. diskfont.library/OpenDiskFont
  8. diskfont.library/AvailFonts                       diskfont.library/AvailFonts
  9.  
  10.    NAME
  11.     AvailFonts -- Inquire available memory & disk fonts.
  12.  
  13.    SYNOPSIS
  14.     error = AvailFonts(buffer, bufBytes, flags);
  15.                        A0      D0        D1
  16.     
  17.     LONG AvailFonts( struct AvailFontsHeader *buffer, LONG bufBytes,
  18.         ULONG flags );
  19.  
  20.    FUNCTION
  21.     AvailFonts fills a user supplied buffer with the structure,
  22.     described below, that contains information about all the
  23.     fonts available in memory and/or on disk.  Those fonts
  24.     available on disk need to be loaded into memory and opened
  25.     via OpenDiskFont, those already in memory are accessed via
  26.     OpenFont.  The TextAttr structure required by the open calls
  27.     is part of the information AvailFonts supplies.
  28.  
  29.     When AvailFonts fails, it returns the number of extra bytes
  30.     it needed to complete the command.  Add this number to your
  31.     current buffer size, allocate a new buffer, and try again.
  32.  
  33.    INPUTS
  34.     buffer - memory to be filled with struct AvailFontsHeader
  35.         followed by an array of AvailFonts elements, which
  36.         contains entries for the available fonts and their
  37.         names.
  38.     
  39.     bufBytes - the number of bytes in the buffer
  40.     flags - AFF_MEMORY is set to search memory for fonts to fill
  41.         the structure, AFF_DISK is set to search the disk for
  42.         fonts to fill the structure.  AFF_SCALED is set to
  43.         not filter out memory fonts that are not designed.
  44.         Any combination may be specified.  AFF_TAGGED is set
  45.         to fill the buffer with TAvailFonts elements instead
  46.         of AvailFonts elements.
  47.  
  48.    RESULTS
  49.     buffer - filled with struct AvailFontsHeader followed by the
  50.         [T]AvailFonts elements, There will be duplicate entries
  51.         for fonts found both in memory and on disk, differing
  52.         only by type.  The existence of a disk font in the
  53.         buffer indicates that it exists as an entry in a font
  54.         contents file -- the underlying font file has not been
  55.         checked for validity, thus an OpenDiskFont of it may
  56.         fail.
  57.     error - if non-zero, this indicates the number of bytes needed
  58.         for AvailFonts in addition to those supplied.  Thus
  59.         structure elements were not returned because of
  60.         insufficient bufBytes.
  61.  
  62.    EXAMPLE
  63.     int afShortage, afSize;
  64.     struct AvailFontsHeader *afh;
  65.  
  66.     ...
  67.  
  68.     afSize = 400;
  69.     do {
  70.         afh = (struct AvailFontsHeader *) AllocMem(afSize, 0);
  71.         if (afh) {
  72.             afShortage = AvailFonts(afh, afSize, AFF_MEMORY|AFF_DISK);
  73.             if (afShortage) {
  74.                 FreeMem(afh, afSize);
  75.                 afSize += afShortage;
  76.             }
  77.         }
  78.         else {
  79.             fail("AllocMem of AvailFonts buffer afh failed\n");
  80.             break;
  81.         }
  82.     }
  83.         while (afShortage);
  84.  
  85.     /*
  86.      * if (afh) non-zero here, then:
  87.      * 1. it points to a valid AvailFontsHeader
  88.      * 2. it must have FreeMem(afh, afSize) called for it after use
  89.      */
  90.  
  91. diskfont.library/DisposeFontContents     diskfont.library/DisposeFontContents
  92.  
  93.    NAME
  94.     DisposeFontContents -- Free the result from NewFontContents. (V34)
  95.  
  96.    SYNOPSIS
  97.     DisposeFontContents(fontContentsHeader)
  98.                 A1
  99.  
  100.     VOID DisposeFontContents( struct FontContentsHeader * );
  101.  
  102.    FUNCTION
  103.     This function frees the array of FontContents entries
  104.     returned by NewFontContents.
  105.  
  106.    INPUTS
  107.     fontContentsHeader - a struct FontContentsHeader pointer
  108.         returned by NewFontContents.
  109.  
  110.    EXCEPTIONS
  111.      This command was first made available as of version 34.
  112.  
  113.     A fontContentsHeader other than one acquired by a call
  114.     NewFontContents will crash.
  115.  
  116.    SEE ALSO
  117.     NewFontContents to get structure freed here.
  118.  
  119. diskfont.library/NewFontContents             diskfont.library/NewFontContents
  120.  
  121.    NAME
  122.     NewFontContents -- Create a FontContents image for a font. (V34)
  123.  
  124.    SYNOPSIS
  125.     fontContentsHeader = NewFontContents(fontsLock,fontName)
  126.        D0                                   A0        A1
  127.  
  128.     struct FontContentsHeader *NewFontContents( BPTR, char * );
  129.  
  130.    FUNCTION
  131.     This function creates a new array of FontContents entries
  132.     that describe all the fonts associated with the fontName,
  133.     specifically, all those in the font directory whose name
  134.     is that of the font sans the ".font" suffix.
  135.  
  136.    INPUTS
  137.     fontsLock - a DOS lock on the FONTS: directory (or other
  138.         directory where the font contents file and associated
  139.         font directory resides).
  140.     fontName - the font name, with the ".font" suffix, which
  141.         is also the name of the font contents file.  
  142.  
  143.    RESULT
  144.     fontContentsHeader - a struct FontContentsHeader pointer.
  145.  
  146.    EXCEPTIONS
  147.     This command was first made available as of version 34.
  148.  
  149.     D0 is zero if the fontName is does not have a ".font" suffix,
  150.     if the fontName is too long, if a DOS error occurred, or if
  151.     memory could not be allocated for the fontContentsHeader.
  152.  
  153.    SEE ALSO
  154.     DisposeFontContents to free the structure acquired here.
  155.  
  156. diskfont.library/NewScaledDiskFont         diskfont.library/NewScaledDiskFont
  157.  
  158.    NAME
  159.     NewScaledDiskFont -- Create a DiskFont scaled from another. (V36)
  160.  
  161.    SYNOPSIS
  162.     header = NewScaledDiskFont(srcFont, destTextAttr)
  163.     D0                         A0       A1
  164.  
  165.     struct DiskFontHeader *NewScaledDiskFont( struct TextFont *,
  166.         struct TTextAttr * );
  167.  
  168.    INPUTS
  169.     srcFont - the font from which the scaled font is to be
  170.         constructed.
  171.     destTextAttr - the desired attributes for the new scaled
  172.         font.  This may be a structure of type TextAttr or
  173.         TTextAttr.
  174.  
  175.    RESULT
  176.     header - a pointer to a DiskFontHeader structure.  This is not
  177.         being managed by the diskfont.library, however.
  178.  
  179.    NOTES
  180.     o   This function may use the blitter.
  181.     o   Fonts containing characters that render wholly outside
  182.         the character advance cell are currently not scalable.
  183.     o   The font, and memory allocated for the scaled font can
  184.         can be freed by calling StripFont() on the font,
  185.         and then calling UnLoadSeg() on the segment created
  186.         by this function.
  187.     
  188.         Both the TextFont structure, and segment pointer are contained
  189.         within the DiskFontHeader struct.  The DiskFontHeader structure
  190.         will also be freed as part of the UnLoadSeg() call.
  191.         StripFont() is a new graphics.library call as of V36.
  192.  
  193. diskfont.library/OpenDiskFont                   diskfont.library/OpenDiskFont
  194.  
  195.    NAME
  196.        OpenDiskFont - load and get a pointer to a disk font.
  197.  
  198.    SYNOPSIS
  199.        font = OpenDiskFont(textAttr)
  200.        D0                  A0
  201.  
  202.    FUNCTION
  203.        This function finds the font with the specified textAttr on
  204.        disk, loads it into memory, and returns a pointer to the font
  205.        that can be used in subsequent SetFont and CloseFont calls.
  206.        It is important to match this call with a corresponding
  207.        CloseFont call for effective management of font memory.
  208.  
  209.        If the font is already in memory, the copy in memory is used.
  210.        The disk copy is not reloaded.
  211.  
  212.    INPUTS
  213.        textAttr - a TextAttr structure that describes the text font
  214.                attributes desired.
  215.  
  216.    RESULTS
  217.        D0 is zero if the desired font cannot be found.
  218.  
  219.    NOTES
  220.        As of V36, OpenDiskFont() will automatically attempt to
  221.        construct a font for you if:
  222.  
  223.                You have requested a font size which does not exist
  224.                as a designed font, and
  225.  
  226.                You have not set the DESIGNED bit in the ta_Flags
  227.                field of the TextAttr, or TTextAttr struct.
  228.  
  229.        Constructed fonts are created by scaling a designed font.
  230.        A designed font is one which typically resides on disk,
  231.        or in ROM (e.g., a font which has been designed by hand
  232.        using a drawing tool).  Designed fonts generally look better
  233.        than fonts constructed by the font scaler, but designed
  234.        fonts also require disk space for each font size.
  235.  
  236.        Always set the DESIGNED bit if you do not want constructed fonts,
  237.        or use AvailFonts() to find out which font sizes already exist.
  238.        
  239.    BUGS
  240.        This routine will not work well with font names whose file
  241.        name components are longer than the maximum allowed
  242.        (30 characters).
  243.  
  244.