class PFont: public PObject

A class representing the attributes of a text font.

Inheritance:


Public Classes

[more]enum Style
The style bits that are returned in GetStyles().

Public Methods

[more] PFont ( const char * fontDescriptionPtr )
Create a new font with the specified attributes.
[more]virtual PObject* Clone () const
Create a copy of the font object.
[more]virtual Comparison Compare ( const PObject & obj ) const
Determine if the two fonts are the same.
[more]PCaselessString GetDescription () const
Get the description string for the font specification.
[more]PCaselessString GetFacename () const
Get the face name of the created font eg "Courier".
[more]PDIMENSION GetSize () const
Get the size of characters in the font.
[more]WORD GetStyles () const
Get the current style bits for the font.
[more]BOOL IsBold () const
Determine if the font was created as a bold font.
[more]BOOL IsItalic () const
Determine if the font was created as an italic font.
[more]BOOL IsUnderlined () const
Determine if the font was created as an underlined font.

Public

[more] Overrides from class PInteractor
[more] New methods for class

Protected Fields

[more]PCaselessString facename
Face name string for the font.
[more]PDIMENSION size
The size of the font.
[more]WORD styles
Indication of the font styles eg bold etc.


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions

Miscellaneous functions


Documentation

A class representing the attributes of a text font. This is the specification for a font request. The font may not be representable on the particular PCanvas that text is to drawn. A matching algorithm is performed to find the nearest font that actually exists for the canvas. This is called realising the font and will return a PRealFont object. A realised font is tied to the device that a PCanvas is drawing to. Thus a PPrintCanvas may realise a different font than a PDrawCanvas would given the same PFont specification.
oenum Style
The style bits that are returned in GetStyles().

o Regular
Font has no styles.

o Bold
Font has the Bold style.

o Italic
Font has the Italic or Oblique style.

o Underline
Font has the Underline style.

o PFont( const char * fontDescriptionPtr )
Create a new font with the specified attributes.

A font description string consists of three fields separated by commas. The first field is the face name, the second is the font size in points and the last field has the any combination of the letters 'B', 'I' and 'U' for bold, italic and underlined respectively. The last field is optional.

Example description strings are: "Times,12,B" for times 12 point bold, "Hevetica, 24, IU" for helvetica 24 point italic with underline, "Courier,10" for regular courier 10 point.

Note the font size are in printers points (1/72 inch).

Parameters:
fontDescriptionPtr - C String description of a font specification.

o Overrides from class PInteractor

ovirtual PObject* Clone() const
Create a copy of the font object.

Returns:
a new copy of the font on the heap.

ovirtual Comparison Compare( const PObject & obj ) const
Determine if the two fonts are the same. That is they have the same face name, size and attributes.

Returns:
EqualTo if fonts the same, GreaterThan if different.
Parameters:
obj - Other font to compare against.

o New methods for class

oPCaselessString GetDescription() const
Get the description string for the font specification.

A font description string consists of three fields separated by commas. The first field is the face name, the second is the font size in points and the last field has the any combination of the letters 'B', 'I' and 'U' for bold, italic and underlined respectively. The last field is optional.

Example description strings are: "Times,12,B" for times 12 point bold, "Hevetica, 24, IU" for helvetica 24 point italic with underline, "Courier,10" for regular courier 10 point.

Returns:
description string.

oPCaselessString GetFacename() const
Get the face name of the created font eg "Courier".

Returns:
string for the font face.

oPDIMENSION GetSize() const
Get the size of characters in the font. The font size is a nominal height for characters. The actual height of characters for the font is determined only when a font is realised.

Returns:
size of the font in printers points (1/72 inch).

oWORD GetStyles() const
Get the current style bits for the font. The style bits are defined by the constants in the Style enum.

Returns:
style bits for font.

oBOOL IsBold() const
Determine if the font was created as a bold font.

Returns:
TRUE if is bold.

oBOOL IsItalic() const
Determine if the font was created as an italic font.

Returns:
TRUE if is italic.

oBOOL IsUnderlined() const
Determine if the font was created as an underlined font.

Returns:
TRUE if is underlined.

oPCaselessString facename
Face name string for the font.

oPDIMENSION size
The size of the font.

oWORD styles
Indication of the font styles eg bold etc.


Direct child classes:
PRealFont

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.