
Class documentation.

$Ident: This file is part of the 'Gt-library' 1.0.0 $
$Copyright: (C) 1997 by Gran Gustafsson $

-------------------------------------------------------------------------

** GtFont **
------------

Name:       GtFont
Superclass: GtBase
Include:    gtfont.h


  This class encapsulates a X font in a shared object. Since nothing can be
changed in a GtFont object all objects are created as shared. For that to
work correctly it is very important to destroy GtFont object by using the
"DeInit()" method.

  When a GtFont object is created a list of font names can be provided and
the first font found in the list is used.


Tags for GtFont:
----------------

  Name           ISGR  Type            Defaults
  ---------------------------------------------
  GT_Display    (I.G.) (GtDisplay *)   NULL
  GT_FontList   (I.G.) (char *)        GTDEF_FONT
  GT_DontFreeX  (I.G.) (sbool)         FALSE
  GT_XFont      (..G.) (Font)          0
  
  
  * GT_Display
    This tag provide the GtDisplay object to be used by the GtFont. It is
    not normally used since the GtDisplay object is provided as an argument
    to the special "Init()" method of this class.


  * GT_FontList
    This tag provide a comma or colon separated list of font names for the
    font to create. The first font found in the list is used by the object.
  

  * GT_DontFreeX
    If this tag is true the encapsulated font is not destroy when the
    GtFont object is destroyed.

    NOTE!! There will be a memory leak when this tag is true and a GtFont
    object is destroyed. This is due to a font information structure that
    can not be freed without also freeing the font which will corrupt the
    sharing of fonts.


  * GT_XFont
    This tag provide a X font to encapsulate. The "GT_DontFreeX" tag is
    by default true if this tag is used in initializing the GtFont.

    NOTE: All features of the encapsulation may not work correctly for
    objects using the "GT_XFont" tag in initialization.


Callbacks for GtFont:
---------------------

  ** NONE DEFINED **
  

Methods for GtFont:
-------------------

   -- User methods --

  void StrExtents(char *str,int len,XCharStruct *xcs)
  void MinExtents(XCharStruct *xcs)
  void MaxExtents(XCharStruct *xcs)
  int StrWidth(char *str,int len)
  int CharWidth(char c)
  int StrFit(char *str,int len,int xsize,int *fxs)
  Font XFnt(void)

   -- GtBase methods --
   
  Init, Set, Get, GetClass, IsSubClassOf, InitV, SetV, GetV, GetA,
  PrtErrHeader
   
 ----------------------------------------------------------------------------
   
  void StrExtents(char *str,int len,XCharStruct *xcs)
  
    - str : pointer to string to examine.
    - len : length of the string.
    - xcs : pointer to XCharStruct structure to fill in.

    This method examines the string and fills the <xcs> structure with
    the pixel size of the string.

 ----------------------------------------------------------------------------

  void MinExtents(XCharStruct *xcs)
  
    - xcs : pointer to XCharStruct structure to fill in.
    
    This method fills the <xcs> structure with the pixel size of the smallest
    character in the font.  
    
 ----------------------------------------------------------------------------

  void MaxExtents(XCharStruct *xcs)

    - xcs : pointer to XCharStruct structure to fill in.

    This method fills the <xcs> structure with the pixel size of the largest
    character in the font.  
  
 ----------------------------------------------------------------------------

  int StrWidth(char *str,int len)
  
    - str : pointer to the string to examine.
    - len : length of the string.

    - <result> : width of the string in pixels.
    
    This method returns the width of a string in pixels.
  
 ----------------------------------------------------------------------------

  int CharWidth(char c)

    - c : character to examine.
    
    - <result> : width of the character.

    This method returns the width of one character.

 ----------------------------------------------------------------------------

  int StrFit(char *str,int len,int xsize,int *fxs)

    - str   : pointer to the string to examine.
    - len   : length of the string.
    - xsize : size in pixel to fit the string in.
    - fxs   : pointer to a integer to be filled with pixel size of the
              fitting string.
    
    - <result> : number of characters that fit in the given pixel space.
    
    This method calculates how many characters of a string that fit in a
    given pixel space. The size of the fitting string in pixels is also
    stored in a integer.
    
 ----------------------------------------------------------------------------

  Font XFnt(void)
  
    - <result> : X font encapsulated by the object.

    This method returns the X font encapsulated by the object.
