EPOC   SDK Home Glossary Indexes Previous Next Up

TOpenFontCharMetrics class


Contents


TOpenFontCharMetrics class — Open font character metrics

Section Contents


Overview

Compatibility

Applications that use this class will not work correctly on a version of EPOC earlier than ER5.

Derivation

Not applicable.

Defined in

openfont.h

Link against

fntstr.lib

Description

Character metrics allow characters to be placed horizontally or vertically. This class defines the character metrics used in the Open Font System. In the descriptions below 'origin' means the pen point before the character is drawn.

Width

width of the character bitmap in pixels

Height

height of the character bitmap in pixels

HorizBearingX

x distance in pixels from the origin to the left edge of the bitmap, when drawing horizontally: a positive value means that the left edge of the bitmap is right of the origin

HorizBearingY

y distance in pixels from the origin to the top edge of the bitmap, when drawing horizontally: a positive value means that the top edge of the bitmap is above the origin

HorizAdvance

amount added to the x coordinate of the origin after the character is drawn; what most people understand by the width of a character; also known as escapement.

VertBearingX

same as HorizBearingX, only used when drawing vertically

VertBearingY

same as HorizBearingY, only used when drawing vertically

VertAdvance

same as HorizAdvance, only used when drawing vertically

Note : Vertical drawing (in the sense of characters drawn with horizontal baselines, but in a vertical line) is not yet supported by EPOC.


Construction and destruction

The constructor sets all data members to zero. A constructor can also be initialised with a TCharacterMetrics (old character metrics style) object. As for other T classes, there is no need to explicitly cleanup TOpenFontCharMetrics objects.


Metric attribute query functions

Metrics can be queried through a number of public functions. However, typically the exported function GetTCharacterMetrics() would be used.

The public query functions are:


GetTCharacterMetrics() — Get old-style character metrics

TBool GetTCharacterMetrics(TCharacterMetrics& aMetrics) const;

Description

Returns old-style character metrics from open system character definition

Arguments

TCharacterMetrics& aMetrics

aMetrics takes the old-style metrics of the character

Return value

TBool

Returns TRUE if it was possible to get the metrics


Width() — Get character width

TInt Width() const;

Description

Returns the width of the character’s bitmap in pixels

Return value

TInt

width in pixels


Height() — Get character height

TInt Height() const;      

Description

Returns the height of the character’s bitmap in pixels

Return value

TInt

height in pixels


HorizBearingX() — Get horizontal bearing X

TInt HorizBearingX() const;

Description

Returns the horizontal distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing horizontally. A positive value means that the left edge of the bitmap is right of the origin

Return value

TInt

horizontal bearing x in pixels


HorizBearingY() — Get horizontal bearing Y

TInt HorizBearingY() const;      

Description

Returns the vertical distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing horizontally. A positive value means that the top edge of the bitmap is above the origin

Return value

TInt

horizontal bearing y in pixels


HorizAdvance() — Get horizontal advance

TInt HorizAdvance() const;

Description

Returns the amount added to the x co-ordinate of the origin after the character is drawn; what most people understand by the width or escapement of a character.

Return value

TInt

horizontal advance in pixels


VertBearingX() — Get vertical bearing X

TInt VertBearingX() const;

Description

Returns the horizontal distance in pixels from the pen point before the character is drawn (the origin) to the left edge of the bitmap, when drawing vertically. A positive value means that the left edge of the bitmap is right of the origin

Return value

TInt

vertical bearing X in pixels


VertBearingY() — Get vertical bearing Y

TInt VertBearingY() const;

Description

Returns the vertical distance in pixels from the pen point before the character is drawn (the origin) to the top edge of the bitmap, when drawing vertically. A positive value means that the top edge of the bitmap is above the origin.

Return value

TInt

vertical bearing Y in pixels


VertAdvance() — Get vertical advance

TInt VertAdvance() const;

Description

Returns the amount added to the y co-ordinate of the origin after the character is drawn. This is the escapement value used when drawing vertically; but note that this form of vertical drawing is not supported by EPOC Release 5.

Return value

TInt

vertical advance in pixels


Metric attribute modifier functions

Metrics can be modified through a number of public functions:


SetWidth() — Set width

void SetWidth(TInt aWidth);

Description

Sets character width (in pixels).

Arguments

TInt aWidth

character width (in pixels)


SetHeight() — Set height

void SetHeight(TInt aHeight);

Description

Sets character height (in pixels).

Arguments

TInt aHeight

character height (in pixels)


SetHorizBearingX() — Set horizontal bearing X

void SetHorizBearingX(TInt aHorizBearingX);

Description

Set the horizontal bearing X (in pixels)

Arguments

TInt aHorizBearingX

horizontal bearing X (in pixels)


SetHorizBearingY() — Set horizontal bearing Y

void SetHorizBearingY(TInt aHorizBearingY);

Description

Sets the horizontal bearing Y (in pixels)

Arguments

TInt aHorizBearingY

horizontal bearing Y (in pixels)


SetHorizAdvance() — Set horizontal advance

void SetHorizAdvance(TInt aHorizAdvance);

Description

Sets the horizontal advance attribute.

Arguments

TInt aHorizAdvance

horizontal advance (in pixels)


SetVertBearingX() — Set vertical bearing X

void SetVertBearingX(TInt aVertBearingX);

Description

Sets the vertical bearing X attribute.

Arguments

TInt aVertBearingX

vertical bearing X (in pixels)


SetVertBearingY() — Set vertical bearing Y

void SetVertBearingY(TInt aVertBearingY);

Description

Set vertical bearing Y attribute.

Arguments

TInt aVertBearingY

vertical bearing Y (in pixels)


SetVertAdvance() — Set vertical advance

void SetVertAdvance(TInt aVertAdvance);

Description

Set vertical advance attribute.

Arguments

TInt aVertAdvance

vertical advance (in pixels)


Data members

All data members are private. Access is via the public functions.

EPOC       SDK Home Glossary Indexes Previous Next Up