### IFont

  The IFont class manages the use of fonts. Use this class to select a font through the IFont functions. You can also use the font dialog to do the following:

  - Get font information
  - Set the font when drawing text
  IFont attempts to match the requested font. If it cannot find an exact match, IFont uses the nearest match.
  Note: An IFont object represents a particular font that is available on the system. It does not represent the following:
  - A font actually being used by a control
  - The currently selected font for a presentation space

  IWindow::setFont changes the font used to draw text in a control.

  The function beginUsingFont causes all subsequent text drawn to the specified presentation space to be in the font represented by the IFont object. You can use beginUsingFont in conjunction with an IPaintHandler object.

#### Portability Considerations

  If you are porting a program to another operating system, be aware that the font names vary between these systems. The only fonts that you can be reasonably sure of finding on each operating system are Courier and Helvetica. If you try to construct an IFont object for a nonexistent font, you will get Courier as the default font.

#### AIX Considerations

  Some of the set and use functions, such as setCharHeight and useBitmapOnly, accept an optional parameter of type IPresSpaceHandle. Because the AIX version of IFont does not support printer fonts, there is no need to supply the optional IPresSpaceHandle parameter.

  The members in this class that refer to vector fonts use scalable fonts in the X-Motif environment.

#### OS/2 Considerations

  Some of the set and use functions (such as setCharHeight and useBitmapOnly) accept an optional parameter of type IPresSpaceHandle. If you are using IFont to represent printer fonts, you must provide this parameter. If you do not specify a presentation space, IFont uses the presentation space of the desktop.

### IFont - Member Functions and Data by Group

### Constructors & Destructor

Use these members to construct, copy, assign, and destruct objects of this class.

~IFont

      public:
      virtual ~IFont()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IFont

  Overload 1

      public:
      IFont(const IFont& fntCopy)

  You can construct objects of this class from another IFont object. The parameter for this constructor is the following:

  fntCopy
    The font you want to copy.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IFont( const char* faceName,
             unsigned long pointSize = 0,
             bool useFixedFont = false,
             bool useVectorFont = false,
             const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  You can construct objects of this class by specifying the name and size of the font desired, along with additional parameters. The parameters for this constructor are the following:

  faceName
    The face name of the font you want.
  pointSize
    The specific point size you want for the font.
  useFixedFont
    Specify whether you want the font fixed or proportional. The default is proportional.
  useVectorFont
    Specify whether you want a vector or bitmap font. The default is a bitmap font.
  presSpaceHandle
    The presentation space handle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      public:
      IFont(const IPresSpaceHandle& presSpaceHandle)

  You can construct objects of this class using a presentation space. This constructs a font corresponding to the font used in the specified presentation space. The parameter for this constructor is the following:

  presSpaceHandle
    The presentation space handle.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 4

      public:
      IFont(const IWindow* window = 0)

  You can construct objects of this class using a window's font. This constructs a font from the current font being used in the window. The parameter for this constructor is the following:

  window
    The window to query for the font to use.
  If you do not specify a window, the system default font is used.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  In the AIX release, if you do not specify a window, the default font of the current display is used.

OS/2 Considerations

  In the OS/2 operating system, if the IWindow* is a multi-line edit field (MLE), Presentation Manager returns the desktop presentation space instead of the MLE presentation space. In doing so, a different font is displayed.

operator =

      public:
      IFont& operator =(const IFont& font)

  Assigns the value of one font object to another.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Accessing Operating System Structures Related to Font

Use these members to access operating system specific font information.

fattrs

      public:
      const struct _FATTRS* fattrs() const

  Returns a pointer to the font's OS/2 Presentation Manager FATTRS structure.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | No

fontmetrics

      public:
      const struct _FONTMETRICS* fontmetrics() const

  Returns a pointer to the font's OS/2 Presentation Manager FONTMETRICS structure.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | No

fontSet

      public:
      _XFontSet* fontSet()

  Return a pointer to the internal _XFontSet structure.

Supported Platforms

  Windows | OS/2 | AIX
  No | No | Yes

logfont

      public:
      const struct tagLOGFONTA* logfont() const

  Returns a pointer to the font's Windows LOGFONT structure.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | No | No

mFontList

      public:
      _XmFontListRec* mFontList()

  Returns a pointer to the internal _XmFontListRec structure.

Supported Platforms

  Windows | OS/2 | AIX
  No | No | Yes

### Cursor-Related Functions

Use these members with a cursor to retrieve font information.

faceNameAt

      public:
      static IString
        faceNameAt( const FaceNameCursor& faceNameCursor )

  Queries a font face name for the current position of the specified cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

pointSizeAt

      public:
      static long
        pointSizeAt( const PointSizeCursor& pointSizeCursor )

  Queries the point size of a font for the current position of the specified cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

### Drawing Functions

Use these members to draw text using a font.

beginUsingFont

      public:
      virtual IFont&
        beginUsingFont( const IPresSpaceHandle& presSpaceHandle )

  Sets the presentation space to use the font.

Exception

  IAccessError | The operating system is unable to create or set the font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

endUsingFont

      public:
      virtual IFont&
        endUsingFont( const IPresSpaceHandle& presSpaceHandle )

  Restores the presentation space to the default font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Font Types

Use these members to query and set the types of fonts used by the IFont object.

isBitmapOnly

      public:
      bool isBitmapOnly() const

  If the IFont object uses only bitmap fonts, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isNonPropOnly

      public:
      bool isNonPropOnly() const

  If the IFont object uses only nonproportional fonts, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isVectorOnly

      public:
      bool isVectorOnly() const

  If the IFont object uses only vector fonts, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

useBitmapOnly

      public:
      virtual IFont&
        useBitmapOnly( bool bitmapOnly = true,
                       const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets whether the IFont object uses only bitmap fonts.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

useNonPropOnly

      public:
      virtual IFont&
        useNonPropOnly( bool nonProportionalOnly = true,
                        const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets whether the IFont object uses only nonproportional fonts.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

useVectorOnly

      public:
      virtual IFont&
        useVectorOnly( bool vectorOnly = true,
                       const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets whether the IFont object uses only vector fonts.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Geometry Accessors

Use these members to query information about the size of the font.

avgCharWidth

      public:
      unsigned long avgCharWidth() const

  Returns the average character's width.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

avgLowercase

      public:
      unsigned long avgLowercase() const

  Returns the nominal height above the baseline for lowercase characters.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

avgUppercase

      public:
      unsigned long avgUppercase() const

  Returns the height of the Em square. This corresponds to the point size.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

charWidth

      public:
      unsigned long charWidth(char c) const

  Returns the width of a specific single-byte character.

  c
    An SBCS character.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  This member function is not MBCS-enabled.

OS/2 Considerations

  This member function is not DBCS-enabled.

externalLeading

      public:
      unsigned long externalLeading() const

  Returns the amount of white space that appears between adjacent rows of text for this font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

internalLeading

      public:
      unsigned long internalLeading() const

  Returns the approximate position of the top of a row of characters. You can use this value to position the first line of a block of text by doing both of the following:

  1. Subtracting the internalLeading value from the value returned by maxAscender.
  2. Positioning the baseline of the first line of text below the item (such as text or graphics) that is above the text. Use the value you obtained in step 1 to do so.
  Note: There is no guarantee that the positioned characters will not write over the item that is above them. Test to see if anything is overwritten and allocate additional space, if necessary.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

maxAscender

      public:
      unsigned long maxAscender() const

  Returns the height of the largest ascender above the baseline.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

maxCharHeight

      public:
      unsigned long maxCharHeight() const

  Returns the height portion of IFont::maxSize.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

maxDescender

      public:
      unsigned long maxDescender() const

  Returns the height of the largest descender below the baseline.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

maxLowercaseAscender

      public:
      unsigned long maxLowercaseAscender() const

  Returns the height of the largest lowercase ascender.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

maxLowercaseDescender

      public:
      unsigned long maxLowercaseDescender() const

  Returns the height of the largest lowercase descender.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

maxSize

      public:
      ISize maxSize() const

  Returns the maximum width and height.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

maxUppercaseSize

      public:
      ISize maxUppercaseSize() const

  Returns the maximum size for an uppercase character.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

minTextWidth

      public:
      unsigned long minTextWidth(const char* line) const

  Returns the width of the widest word.

  line
    Pointer to character string. You can only specify an SBCS string.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  This member function is not MBCS-enabled.

OS/2 Considerations

  This member function is not DBCS-enabled.

subscriptOffset

      public:
      ISize subscriptOffset() const

  Returns the recommended size of the baseline X-Y offset for subscripts.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

subscriptSize

      public:
      ISize subscriptSize() const

  Returns the recommended size for subscripts.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

superscriptOffset

      public:
      ISize superscriptOffset() const

  Returns the recommended size of the baseline X-Y offset for superscripts.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

superscriptSize

      public:
      ISize superscriptSize() const

  Returns the recommended size for superscripts.

Supported Platforms

  Windows | OS/2 | AIX
  No | Yes | Yes

textLines

      public:
      unsigned long
        textLines( const char* text,
                   unsigned long lineWidth ) const

  Returns the number of lines required to fit the specified text using the specified maximum line width.

  text
    Pointer to character string. You can only specify an SBCS string.
  lineWidth
    The maximum line width.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  This member function is not MBCS-enabled.

OS/2 Considerations

  This member function is not DBCS-enabled.

textWidth

  Returns the width of the specified string.

  Overload 1

      public:
      unsigned long
        textWidth( const char* text,
                   IBidiSettings& settings ) const

  Returns the width of the specified string using the specified bidirectional attributes. This member function is not DBCS-enabled.

  text
    Pointer to character string. You can only specify an SBCS string.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | No

  Overload 2

      public:
      unsigned long textWidth(const char* text) const

  Returns the width of the specified string. This member function is not DBCS-enabled.

  text
    Pointer to character string. You can only specify an SBCS string.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  This member function is not MBCS-enabled.

OS/2 Considerations

  This member function is not DBCS-enabled.

### Getting Font Attributes

Use these members to query the attributes of the current font.

isBitmap

      public:
      bool isBitmap() const

  If the IFont object uses a bitmap font, true is returned. If the IFont object uses a vector font, false is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isFixed

      public:
      bool isFixed() const

  If the IFont object uses a fixed-size (that is, nonproportional) font, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

name

      public:
      IString name() const

  Returns the face name of the font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

pointSize

      public:
      unsigned long pointSize() const

  Returns the point size of the font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

qualifiedName

      public:
      IString qualifiedName() const

  Returns a tagged font descriptor which can be used to construct a specific font by passing the qualified name in as the facename parameter on the appropriate IFont constructor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  Returns the X Windows Logical Font Description (XLFD) in the following format: IOC:xlfd string

OS/2 Considerations

  Returns the qualified name in the following format: IOC:faceName:pointSize

Windows Considerations

  Returns the qualified name in the following format: IOC:faceName:pointSize

### Getting Font Style

Use these members to query the appearance of a font.

isBold

      public:
      bool isBold() const

  If the IFont object uses a font that is bold, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isItalic

      public:
      bool isItalic() const

  If the IFont object uses an italicized font, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isOutline

      public:
      bool isOutline() const

  If the IFont object uses a font that appears hollow, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Ignored | Yes | Ignored

isStrikeout

      public:
      bool isStrikeout() const

  If the IFont object uses a font with a line drawn through the characters, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

isUnderscore

      public:
      bool isUnderscore() const

  If the IFont object uses a font with a line drawn under the characters, true is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

styleSet

      public:
      ITextStyleSet styleSet() const

  Returns a style set representing the current font.

  Recommended usage of this function is to make all modifications to the font prior to querying the style set. Modifying the style set could result in a different font selected when used by 2D graphics, for example.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Setting Font Direction

Use these members to set the direction that the font is drawn in.

setDirection

      public:
      virtual IFont& setDirection(Direction direction)

  Sets the direction to draw the font in.

  direction
    Use the enumeration Direction to specify.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

AIX Considerations

  In the AIX release, the system locale information determines the font direction.

### Setting Font Style

Use these members to change the appearance of a font.

setAllEmphasis

      public:
      virtual IFont& setAllEmphasis(bool turnOn = true)

  If you specify true, all of the styles are set on. If you specify false, all of the styles are set off.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setBold

      public:
      virtual IFont& setBold(bool bold = true)

  Changes the font to bold.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setItalic

      public:
      virtual IFont& setItalic(bool italics = true)

  Changes the font to italic.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setOutline

      public:
      virtual IFont& setOutline(bool outline = true)

  Causes the font to appear hollow.

Supported Platforms

  Windows | OS/2 | AIX
  Ignored | Yes | Ignored

setStrikeout

      public:
      virtual IFont& setStrikeout(bool strikeout = true)

  Draws a line through the characters.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

setUnderscore

      public:
      virtual IFont& setUnderscore(bool underscore = true)

  Draws a line under the characters.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

### Setting General Font Attributes

Use these members to set the attributes of any font being managed by the IFont class.

setName

      public:
      virtual IFont&
        setName( const char* name,
                 const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the font's face name.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setPointSize

      public:
      virtual IFont&
        setPointSize( unsigned long size,
                      const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the font's point size.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Setting Vector Font Attributes

Use these members to set the attributes of vector fonts. They have no effect when applied to a bitmap font.

setCharHeight

      public:
      virtual IFont&
        setCharHeight( unsigned long height,
                       const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the height of the characters of a vector font. This function has no effect when applied to a bitmap font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

setCharSize

      public:
      virtual IFont&
        setCharSize( const ISize& size,
                     const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the size of the characters of a vector font. This function has no effect when applied to a bitmap font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

setCharWidth

      public:
      virtual IFont&
        setCharWidth( unsigned long width,
                      const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the width of the characters of a vector font. This function has no effect when applied to a bitmap font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

setFontAngle

      public:
      virtual IFont&
        setFontAngle( const IPoint& point,
                      const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the angle used to draw the vector font. This function has no effect when applied to a bitmap font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

setFontShear

      public:
      virtual IFont&
        setFontShear( const IPoint& point,
                      const IPresSpaceHandle& presSpaceHandle = IPresSpaceHandle ( ) )

  Sets the amount of shear to apply to the vector font. This function has no effect when applied to a bitmap font.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Ignored

### Setting Window Font

Use these members to apply the current font to an IWindow object.

setWindowFont

      public:
      virtual bool setWindowFont(IWindow* window) const

  Sets the font for the specified IWindow to the current font. If the font is successfully changed, true is returned.

Exception

  IAccessError | The operating system is unable to set the font for the window.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IFont - Enumerations

Direction

      enum Direction { defaultDir,
                       leftToRight,
                       topToBottom,
                       rightToLeft,
                       bottomToTop }

  Use these enumerators to specify the direction in which a font is drawn. You can use these enumerators as input to setDirection.

  defaultDir
    Draws the font in the default direction.
  leftRight
    Draws the font from left to right.
  topBottom
    Draws the font from top to bottom.
  rightLeft
    Draws the font from right to left.
  bottomTop
    Draws the font from bottom to top.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IFont - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None