VCF::Font Class Reference
A
Font wraps the windowing system's graphics font object.
More...
#include <vcf/GraphicsKit/Font.h>
Inheritance diagram for VCF::Font:
List of all members.
|
Public Types |
| enum | FontChangeEvent {
fcFontName = 0xF097,
fcFontItalic,
fcFontBold,
fcFontStrikeOut,
fcFontUnderline,
fcFontSize,
fcFontColor,
fcFontLocale,
fcAll
} |
| | This enum describes the various event types that changes to a font can produce. More...
|
Public Member Functions |
| | Font () |
| | Font (const String &fontName) |
| | Constructs a font from a valid font name (say "Tiems New Roman") - the size of the font is the default font size for the system.
|
| | Font (const String &fontName, const double &pointSize) |
| | Constructs a font from a name and a size in points.
|
| | Font (const Font &font) |
| virtual | ~Font () |
| Font & | operator= (const Font &rhs) |
| bool | isTrueType () const |
| | Returns true if the font is a True Type font.
|
| Color * | getColor () |
| | returns the Color the Font will be rendered in
|
| void | setColor (Color *color) |
| | sets the Color to render the Font in
|
| double | getPointSize () const |
| | return the point size of the Font.
|
| void | setPointSize (const double &pointSize) |
| | sets the point size of the Font
|
| double | getPixelSize () const |
| void | setPixelSize (const double &pixelSize) |
| void | setBold (const bool &bold) |
| bool | getBold () const |
| bool | getItalic () const |
| void | setItalic (const bool &italic) |
| bool | getUnderlined () const |
| void | setUnderlined (const bool &underlined) |
| bool | getStrikeOut () const |
| void | setStrikeOut (const bool &strikeout) |
| String | getName () const |
| void | setName (const String &name) |
| void | setAttributes (const double &pointSize, const bool &bold, const bool &italic, const bool &underlined, const bool &struckOut, const Color *color, const String &name) |
| FontPeer * | getFontPeer () |
| virtual void | copy (Object *source) |
| | Copies the data from source to this object.
|
| virtual Object * | clone (bool deep) |
| double | getAscent () const |
| double | getDescent () const |
| double | getHeight () const |
| bool | isFixedPitch () const |
| Locale * | getLocale () const |
| | Get the locale associated with this font.
|
| void | setLocale (Locale *locale) |
| | Set the locale of this font.
|
| void | setGraphicsContext (GraphicsContext *context) |
| | Sets the GraphicsContext for the font.
|
| GraphicsContext * | getGraphicsContext () |
| | Returns the current graphics context that's associated with this font.
|
| virtual uint64 | Font::sizeOf () const |
| double | getTextWidth (const String &text) |
| double | getTextHeight (const String &text) |
Public Attributes |
| VCF::Delegate | FontChangedDelegate |
| | FontChanged |
Protected Member Functions |
| void | changed (int eventType) |
Protected Attributes |
| FontPeer * | peer_ |
| Color | color_ |
| Locale * | locale_ |
| GraphicsContext * | context_ |
Detailed Description
A
Font wraps the windowing system's graphics font object.
Fonts are used to (partially) describe how a string of text will be rendered, for example the size of the glyphs used to paint the text characters on the screen.
A Font has a number of properties that can be set, such as it's name, color, size (both in points and in pixels), and so on. If you change a font's property, the font will fire off an event that can be handled by some other object, for example if you needed to recalculate some setting based on the characteristics of teh font, you handle this kind of event to always keep in synch with the font's settings.
Member Enumeration Documentation
|
|
This enum describes the various event types that changes to a font can produce.
- Enumerator:
-
| fcFontName |
An event is fired of this type if the font's name is changed. |
| fcFontItalic |
An event is fired of this type if the font's italic attribute (true or false) is changed. |
| fcFontBold |
An event is fired of this type if the font's bold attribute (true or false) is changed. |
| fcFontStrikeOut |
An event is fired of this type if the font's strike out attribute (true or false) is changed. |
| fcFontUnderline |
An event is fired of this type if the font's underline attribute (true or false) is changed. |
| fcFontSize |
An event is fired of this type if the font's size attribute is changed. |
| fcFontColor |
An event is fired of this type if the font's color attribute is changed. |
| fcFontLocale |
An event is fired of this type if the font's locale instance is changed. |
| fcAll |
|
|
Constructor & Destructor Documentation
| VCF::Font::Font |
( |
const String & |
fontName |
) |
|
|
|
|
Constructs a font from a valid font name (say "Tiems New Roman") - the size of the font is the default font size for the system.
|
| VCF::Font::Font |
( |
const String & |
fontName, |
|
|
const double & |
pointSize |
|
) |
|
|
|
|
Constructs a font from a name and a size in points.
|
| VCF::Font::Font |
( |
const Font & |
font |
) |
|
|
| virtual VCF::Font::~Font |
( |
|
) |
[virtual] |
|
Member Function Documentation
| void VCF::Font::changed |
( |
int |
eventType |
) |
[protected] |
|
| virtual Object* VCF::Font::clone |
( |
bool |
deep |
) |
[inline, virtual] |
|
| virtual void VCF::Font::copy |
( |
Object * |
source |
) |
[virtual] |
|
|
|
Copies the data from source to this object.
This is the equivalent of operator=()
Reimplemented from VCF::Object. |
| virtual uint64 VCF::Font::Font::sizeOf |
( |
|
) |
const [virtual] |
|
| double VCF::Font::getAscent |
( |
|
) |
const |
|
| bool VCF::Font::getBold |
( |
|
) |
const |
|
| Color* VCF::Font::getColor |
( |
|
) |
|
|
|
|
returns the Color the Font will be rendered in
|
| double VCF::Font::getDescent |
( |
|
) |
const |
|
|
|
Returns the current graphics context that's associated with this font.
By default this value will be NULL. |
| double VCF::Font::getHeight |
( |
|
) |
const |
|
| bool VCF::Font::getItalic |
( |
|
) |
const |
|
| Locale* VCF::Font::getLocale |
( |
|
) |
const [inline] |
|
|
|
Get the locale associated with this font.
May be NULL, in which case this is whatever the System's default locale is. |
| String VCF::Font::getName |
( |
|
) |
const |
|
| double VCF::Font::getPixelSize |
( |
|
) |
const |
|
| double VCF::Font::getPointSize |
( |
|
) |
const |
|
|
|
return the point size of the Font.
One point is 1/72 of an inch ( or 0.0352552 cm for our more civilized friends !), so to figure out the pixels involved, find out the Pixels per Inch and then apply the following formula (PointSize / 72) * PPI where PPI represents the Pixels Per Inch |
| bool VCF::Font::getStrikeOut |
( |
|
) |
const |
|
| double VCF::Font::getTextHeight |
( |
const String & |
text |
) |
|
|
| double VCF::Font::getTextWidth |
( |
const String & |
text |
) |
|
|
| bool VCF::Font::getUnderlined |
( |
|
) |
const |
|
| bool VCF::Font::isFixedPitch |
( |
|
) |
const |
|
| bool VCF::Font::isTrueType |
( |
|
) |
const |
|
|
|
Returns true if the font is a True Type font.
On Windows some font's are not True Type font's and because of this they will not respond to certain effects (such as being rotated). |
| Font& VCF::Font::operator= |
( |
const Font & |
rhs |
) |
|
|
| void VCF::Font::setAttributes |
( |
const double & |
pointSize, |
|
|
const bool & |
bold, |
|
|
const bool & |
italic, |
|
|
const bool & |
underlined, |
|
|
const bool & |
struckOut, |
|
|
const Color * |
color, |
|
|
const String & |
name |
|
) |
|
|
| void VCF::Font::setBold |
( |
const bool & |
bold |
) |
|
|
| void VCF::Font::setColor |
( |
Color * |
color |
) |
|
|
|
|
Sets the GraphicsContext for the font.
This is used for special cases where calculations may need to be determined based on the information in the GraphicsContext. For example, the font peer may need information from the context peer when making font size calculations, particularly during printing. |
| void VCF::Font::setItalic |
( |
const bool & |
italic |
) |
|
|
| void VCF::Font::setLocale |
( |
Locale * |
locale |
) |
|
|
|
|
Set the locale of this font.
This may change the script used by the font when being rendered. |
| void VCF::Font::setName |
( |
const String & |
name |
) |
|
|
| void VCF::Font::setPixelSize |
( |
const double & |
pixelSize |
) |
|
|
| void VCF::Font::setPointSize |
( |
const double & |
pointSize |
) |
|
|
|
|
sets the point size of the Font
|
| void VCF::Font::setStrikeOut |
( |
const bool & |
strikeout |
) |
|
|
| void VCF::Font::setUnderlined |
( |
const bool & |
underlined |
) |
|
|
Member Data Documentation
|
|
- Event Delegate:
- FontChanged this is is fired every time a font is changed. This let the peer of a control to be notified of the change even when the font is not changed through its associated control.
event class: Event
event type: FontChangeEvent
|
The documentation for this class was generated from the following file: