williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: Creates a font and bitmap server graphics context for the device and activates williamr@2: it. williamr@2: williamr@2: It is the responsibility of the caller to delete the graphics context when williamr@2: it is no longer needed. williamr@2: williamr@2: @param aGc On return, contains a pointer to the graphics context. williamr@2: @return KErrNone if successful, otherwise, another one of the system-wide error williamr@2: codes. williamr@2: */ williamr@2: TInt CFbsDevice::CreateContext(CGraphicsContext*& aGc) williamr@2: { williamr@2: return CreateContext((CFbsBitGc*&)aGc);// relies on CFbsDevice deriving _only_ from CBitmapDevice williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: This function is replaced by GetNearestFontToDesignHeightInTwips(). williamr@2: williamr@2: @param aFont On return, points to the font which most closely matches the williamr@2: specified font. williamr@2: @param aFontSpec An absolute font specification. Its iHeight member is interpreted williamr@2: as being in twips. williamr@2: @return KErrNone if successful; otherwise, another one of the system-wide error williamr@2: codes. williamr@2: @deprecated */ williamr@2: TInt CFbsDevice::GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec) williamr@2: { williamr@2: return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec); williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: This function is replaced by GetNearestFontToDesignHeightInPixels(). williamr@2: williamr@2: @param aFont On return, points to the font which most closely matches the williamr@2: specified font. williamr@2: @param aFontSpec An absolute font specification. Its iHeight member is interpreted williamr@2: as being in pixels. williamr@2: @return KErrNone if successful; otherwise, another of the system-wide error williamr@2: codes. williamr@2: @deprecated */ williamr@2: TInt CFbsDevice::GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec) williamr@2: { williamr@2: return GetNearestFontToDesignHeightInPixels(aFont, aFontSpec); williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: This function replaces GetNearestFontInTwips(). williamr@2: williamr@2: @param aFont On return, points to the font which most closely matches the williamr@2: specified font. williamr@2: @param aFontSpec An absolute font specification. Its iHeight member is interpreted williamr@2: as being in twips. williamr@2: @return KErrNone if successful; otherwise, another one of the system-wide error williamr@2: codes. */ williamr@2: TInt CFbsDevice::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec) williamr@2: { williamr@2: return GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: This function replaces GetNearestFontInPixels(). williamr@2: williamr@2: @param aFont On return, points to the font which most closely matches the williamr@2: specified font. williamr@2: @param aFontSpec An absolute font specification. Its iHeight member is interpreted williamr@2: as being in pixels. williamr@2: @return KErrNone if successful; otherwise, another of the system-wide error williamr@2: codes. */ williamr@2: TInt CFbsDevice::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec) williamr@2: { williamr@2: return GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: The font and bitmap server returns a pointer to the nearest matching font williamr@2: from those available. Matches to max height of font - this does its best williamr@2: to return a font that will fit within the maximum height specified (but williamr@2: note that variations due to hinting algorithms may rarely result in this williamr@2: height being exceeded by up to one pixel). Problems can also be williamr@2: encountered with bitmap fonts where the typeface exists but doesn't have williamr@2: a font small enough. williamr@2: williamr@2: @param aFont On return, the pointer is set to point to the device font which williamr@2: most closely approximates to the required font specification. williamr@2: @param aFontSpec An absolute font specification. williamr@2: @param aMaxHeight The maximum height in twips within which the font must williamr@2: fit - this overrides the height specified in aFontSpec. williamr@2: @return KErrNone, if successful; otherwise, another of the system-wide error williamr@2: codes. */ williamr@2: TInt CFbsDevice::GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) williamr@2: { williamr@2: return GetNearestFontToMaxHeightInTwips((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont williamr@2: } williamr@2: williamr@2: /** Creates a client-side FBSERV font from those available in the device's typeface store williamr@2: that most closely matches a font specification. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: The font and bitmap server returns a pointer to the nearest matching font williamr@2: from those available. Matches to max height of font - this does its best williamr@2: to return a font that will fit within the maximum height specified (but williamr@2: note that variations due to hinting algorithms may rarely result in this williamr@2: height being exceeded by up to one pixel). Problems can also be williamr@2: encountered with bitmap fonts where the typeface exists but doesn't have williamr@2: a font small enough. williamr@2: williamr@2: @param aFont On return, the pointer is set to point to the device font which williamr@2: most closely approximates to the required font specification. williamr@2: @param aFontSpec An absolute font specification. williamr@2: @param aMaxHeight The maximum height in pixels within which the font must williamr@2: fit - this overrides the height specified in aFontSpec. williamr@2: @return KErrNone, if successful; otherwise, another of the system-wide error williamr@2: codes. */ williamr@2: TInt CFbsDevice::GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) williamr@2: { williamr@2: return GetNearestFontToMaxHeightInPixels((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont williamr@2: } williamr@2: williamr@2: /** Gets a specific bitmap font, identified by its UID, from the device's typeface store. williamr@2: williamr@2: When the font is no longer needed, call ReleaseFont(). williamr@2: williamr@2: @param aFont On return, set to point to the font. williamr@2: @param aFileId The UID identifying the bitmap font. williamr@2: @param aStyle Algorithmic style for the font. williamr@2: @return KErrNone if successful; otherwise, another of the system-wide error williamr@2: codes. */ williamr@2: TInt CFbsDevice::GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle) williamr@2: { williamr@2: return GetFontById((CFont*&)aFont,aFileId,aStyle);// relies on CFbsFont deriving _only_ from CFont williamr@2: } williamr@2: williamr@2: /** Gets a pointer to the 2D graphics accelerator owned by the device. If one is williamr@2: available, it is used to accelerate various CFbsBitGc graphics operations. williamr@2: williamr@2: @return Pointer to the graphics accelerator or NULL if not supported. williamr@2: @see CFbsBitmapDevice::NewL() */ williamr@2: CGraphicsAccelerator* CFbsDevice::GraphicsAccelerator() const williamr@2: { williamr@2: return iGraphicsAccelerator; williamr@2: } williamr@2: williamr@2: williamr@2: /** Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation(). williamr@2: williamr@2: @return The device's orientation. */ williamr@2: CFbsBitGc::TGraphicsOrientation CFbsDevice::Orientation() const williamr@2: { williamr@2: return iOrientation; williamr@2: }