MGraphicsDeviceMap Class Reference

class MGraphicsDeviceMap

Interface class for mapping between twips and device-specific units (pixels).

TZoomFactor is derived from MGraphicsDeviceMap.

CGraphicsDevice TZoomFactor

Constructor & Destructor Documentation

MGraphicsDeviceMap()

IMPORT_CMGraphicsDeviceMap()

Default constructor.

~MGraphicsDeviceMap()

IMPORT_C~MGraphicsDeviceMap()[virtual]

Destructor.

Member Functions Documentation

GetNearestFontInTwips(CFont *&, const TFontSpec &)

TInt GetNearestFontInTwips(CFont *&aFont,
const TFontSpec &aFontSpec
)[pure virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

Note that this deprecated function is replaced by the new GetNearestFontToDesignHeightInTwips() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every character within any given text string will fit within the given amount of twips, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Use GetNearestFontToDesignHeightInTwips

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

GetNearestFontToDesignHeightInTwips(CFont *&, const TFontSpec &)

TInt GetNearestFontToDesignHeightInTwips(CFont *&,
const TFontSpec &
)[inline, virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

This new function replaces the deprecated GetNearestFontInTwips() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every character within any given text string will fit within the given amount of twips, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Parameters

CFont *&
const TFontSpec &

GetNearestFontToMaxHeightInTwips(CFont *&, const TFontSpec &, TInt)

TInt GetNearestFontToMaxHeightInTwips(CFont *&,
const TFontSpec &,
TInt
)[inline, virtual]

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont().

The font and bitmap server returns a pointer to the nearest matching font from those available. Matches to max height of font - this does its best to return a font that will fit within the maximum height specified (but note that variations due to hinting algorithms may rarely result in this height being exceeded by up to one pixel). Problems can also be encountered with bitmap fonts where the typeface exists but doesn't have a font small enough.

Parameters

CFont *&
const TFontSpec &
TInt

HorizontalPixelsToTwips(TInt)

TInt HorizontalPixelsToTwips(TIntaPixels)const [pure virtual]

Converts a horizontal dimension from pixels to twips.

An implementation is supplied by a derived class.

Parameters

TInt aPixelsA horizontal dimension of a device in pixels.

HorizontalTwipsToPixels(TInt)

TInt HorizontalTwipsToPixels(TIntaTwips)const [pure virtual]

Converts a horizontal dimension from twips to pixels.

An implementation is supplied by a derived class.

Parameters

TInt aTwipsA horizontal dimension of a device in twips.

PixelsToTwips(const TPoint &)

IMPORT_C TPointPixelsToTwips(const TPoint &aPixelPoint)const

Converts a point in pixels to a point in twips.

Parameters

const TPoint & aPixelPointA point on the graphics device in pixels.

PixelsToTwips(const TRect &)

IMPORT_C TRectPixelsToTwips(const TRect &aPixelRect)const

Converts a rectangle in pixels to a rectangle in twips.

Parameters

const TRect & aPixelRectA rectangle on the graphics device in pixels.

ReleaseFont(CFont *)

voidReleaseFont(CFont *aFont)[pure virtual]

Releases the specified font.

It is used to indicate that the specified font is no longer needed for use by the device map. As fonts can be shared between applications, this function does not delete the copy of the font from RAM unless the font was only being used by this particular device map.

An implementation is supplied by a derived class.

Parameters

CFont * aFontA pointer to the font to be released.

TwipsToPixels(const TPoint &)

IMPORT_C TPointTwipsToPixels(const TPoint &aTwipPoint)const

Converts a point in twips to a point in pixels.

Parameters

const TPoint & aTwipPointA point on the graphics device in twips.

TwipsToPixels(const TRect &)

IMPORT_C TRectTwipsToPixels(const TRect &aTwipRect)const

Converts a rectangle in twips to a rectangle in pixels.

Parameters

const TRect & aTwipRectA rectangle on the graphics device in twips

VerticalPixelsToTwips(TInt)

TInt VerticalPixelsToTwips(TIntaPixels)const [pure virtual]

Converts a vertical dimension from pixels to twips.

An implementation is supplied by a derived class.

Parameters

TInt aPixelsA vertical dimension of a device in pixels.

VerticalTwipsToPixels(TInt)

TInt VerticalTwipsToPixels(TIntaTwips)const [pure virtual]

Converts a vertical dimension from twips to pixels.

An implementation is supplied by a derived class.

Parameters

TInt aTwipsA vertical dimension of a device in twips.