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