Rogue Wave Views
Foundation Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Friends
IlvFont Class Reference

Resource class. More...

#include <ilviews/base/resource.h>

Inheritance diagram for IlvFont:
IlvResource

Public Member Functions

IlvDim ascent () const
 Gets the ascent value. More...
 
IlvDim descent () const
 Gets the descent value. More...
 
const char * getFamily () const
 Gets the font family name. More...
 
const char * getFoundry () const
 Gets the font foundry. More...
 
IlvFontSize getSize () const
 Gets the font size. More...
 
IlvFontStyle getStyle () const
 Gets the font style. More...
 
IlvDim height () const
 Gets the height. More...
 
IlBoolean isFixed () const
 Tells you if it is a fixed-width font. More...
 
IlvDim maxWidth () const
 Gets the maximum character width of a font. More...
 
IlvDim minWidth () const
 Gets the minimum character width of a font. More...
 
virtual void setName (const char *name)
 Sets the name of the resource. More...
 
void sizes (const char *string, int length, IlvDim &w, IlvDim &h, IlvDim &d) const
 Gets font dimensions of a string. More...
 
IlvDim stringHeight (const char *string, int length=-1) const
 Gets the logical height of a string. More...
 
IlvDim stringWidth (const char *string, int length=-1) const
 Gets the logical width of a string. More...
 
- Public Member Functions inherited from IlvResource
IlvDisplaygetDisplay () const
 Gets the IlvDisplay instance. More...
 
const char * getName () const
 Gets the resource name. More...
 
void lock ()
 Locks the resource. More...
 
virtual void unLock ()
 Unlocks the resource. More...
 

Friends

class IlvDisplay
 
class IlvSystemPort
 

Detailed Description

Resource class.

Library: xviews or winviews or mviews (mutually exclusive)
The IlvFont class defines a font that is used to draw strings with specific spacing values as in the following illustration:


- Font -

See also
IlvDisplay::defaultFont(), IlvDisplay::getFont(), IlvDisplay::getFontSizes().

Member Function Documentation

§ ascent()

IlvDim IlvFont::ascent ( ) const

Gets the ascent value.

Retrieves the ascent spacing value of a given IlvFont object. Refer to the figure "Font" for an illustration.

Returns
The font's ascent value.

§ descent()

IlvDim IlvFont::descent ( ) const

Gets the descent value.

Retrieves the descent spacing value of a given IlvFont object. Refer to the figure "Font" for an illustration. You can also get this quantity for a specific string by calling the member function sizes().

Returns
The font's descent value.

§ getFamily()

const char* IlvFont::getFamily ( ) const

Gets the font family name.

Retrieves the font family of a given IlvFont object.

Returns
The font family name.

§ getFoundry()

const char* IlvFont::getFoundry ( ) const

Gets the font foundry.

Retrieves the font foundry of a given IlvFont object.

Returns
The font foundry.

§ getSize()

IlvFontSize IlvFont::getSize ( ) const

Gets the font size.

Retrieves the font size of a given IlvFont object.

Returns
The font size.

§ getStyle()

IlvFontStyle IlvFont::getStyle ( ) const

Gets the font style.

Retrieves the font style of a given IlvFont object.

Returns
The font style.

§ height()

IlvDim IlvFont::height ( ) const

Gets the height.

Retrieves the height spacing value of a given IlvFont object. You can also get this quantity for a specific string by calling the member functions stringHeight() or sizes() of the IlvFont class.

Returns
The font's height.

§ isFixed()

IlBoolean IlvFont::isFixed ( ) const

Tells you if it is a fixed-width font.

Returns
IlTrue if this font object has a fixed width for all characters.

§ maxWidth()

IlvDim IlvFont::maxWidth ( ) const

Gets the maximum character width of a font.

Returns
The width of the widest characters of the font.

§ minWidth()

IlvDim IlvFont::minWidth ( ) const

Gets the minimum character width of a font.

Note that when both maxWidth() and minWidth() return the same value, then isFixed() returns IlTrue.

Returns
The width of the narrowest characters of the font.

§ setName()

virtual void IlvFont::setName ( const char *  name)
virtual

Sets the name of the resource.

Names your resource by means of a unique name string descriptor that is internally copied.

Reimplemented from IlvResource.

§ sizes()

void IlvFont::sizes ( const char *  string,
int  length,
IlvDim w,
IlvDim h,
IlvDim d 
) const

Gets font dimensions of a string.

This method returns logical dimensions. It does not return the precise painted rectangle but the dimensions of a box that provides minimum spacing to other graphical effects (such as a border surrounding the text). In other words, it is different from the bounding box of the ink used to draw the text.

Parameters
stringThe string to be measured.
lengthThe length of the string, in bytes. If a negative value is provided, the length is computed using strlen().
wUsed to return the width of the string, in pixels.
hUsed to return the height of the string, in pixels.
dUsed to return the descent of the string, in pixels.
See also
IlvFont::stringHeight(), IlvFont::stringWidth()

§ stringHeight()

IlvDim IlvFont::stringHeight ( const char *  string,
int  length = -1 
) const

Gets the logical height of a string.

Just like IlvFont::sizes(), this method returns a logical dimension. It does not return the precise height of the painted rectangle but the height of a box that provides minimum spacing to other graphical effects (such as a border surrounding the text). In other words, it is different from the height of the ink used to draw the text.

Parameters
stringThe string to be measured.
lengthThe length of the string, in bytes. If a negative value is provided, the length is computed using strlen().
Returns
The logical height of the string, in pixels, when displayed with this font.
See also
IlvFont::sizes(), IlvFont::stringWidth()

§ stringWidth()

IlvDim IlvFont::stringWidth ( const char *  string,
int  length = -1 
) const

Gets the logical width of a string.

Just like IlvFont::sizes(), this method returns a logical dimension. It does not return the precise width of the painted rectangle but the width of a box that provides minimum spacing to other graphical effects (such as a border surrounding the text). In other words, it is different from the width of the ink used to draw the text.

Parameters
stringThe string to be measured.
lengthThe length of the string, in bytes. If a negative value is provided, the length is computed using strlen().
Returns
The logical width of the string, in pixels, when displayed with this font.
See also
IlvFont::sizes(), IlvFont::stringHeight()

© Copyright 2017, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.