1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // 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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 Creates a font and bitmap server graphics context for the device and activates
22 It is the responsibility of the caller to delete the graphics context when
23 it is no longer needed.
25 @param aGc On return, contains a pointer to the graphics context.
26 @return KErrNone if successful, otherwise, another one of the system-wide error
29 TInt CFbsDevice::CreateContext(CGraphicsContext*& aGc)
31 return CreateContext((CFbsBitGc*&)aGc);// relies on CFbsDevice deriving _only_ from CBitmapDevice
34 /** Creates a client-side FBSERV font from those available in the device's typeface store
35 that most closely matches a font specification.
37 When the font is no longer needed, call ReleaseFont().
39 This function is replaced by GetNearestFontToDesignHeightInTwips().
41 @param aFont On return, points to the font which most closely matches the
43 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
45 @return KErrNone if successful; otherwise, another one of the system-wide error
48 TInt CFbsDevice::GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
50 return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
53 /** Creates a client-side FBSERV font from those available in the device's typeface store
54 that most closely matches a font specification.
56 When the font is no longer needed, call ReleaseFont().
58 This function is replaced by GetNearestFontToDesignHeightInPixels().
60 @param aFont On return, points to the font which most closely matches the
62 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
64 @return KErrNone if successful; otherwise, another of the system-wide error
67 TInt CFbsDevice::GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
69 return GetNearestFontToDesignHeightInPixels(aFont, aFontSpec);
72 /** Creates a client-side FBSERV font from those available in the device's typeface store
73 that most closely matches a font specification.
75 When the font is no longer needed, call ReleaseFont().
77 This function replaces GetNearestFontInTwips().
79 @param aFont On return, points to the font which most closely matches the
81 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
83 @return KErrNone if successful; otherwise, another one of the system-wide error
85 TInt CFbsDevice::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
87 return GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
90 /** Creates a client-side FBSERV font from those available in the device's typeface store
91 that most closely matches a font specification.
93 When the font is no longer needed, call ReleaseFont().
95 This function replaces GetNearestFontInPixels().
97 @param aFont On return, points to the font which most closely matches the
99 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
101 @return KErrNone if successful; otherwise, another of the system-wide error
103 TInt CFbsDevice::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
105 return GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
108 /** Creates a client-side FBSERV font from those available in the device's typeface store
109 that most closely matches a font specification.
111 When the font is no longer needed, call ReleaseFont().
113 The font and bitmap server returns a pointer to the nearest matching font
114 from those available. Matches to max height of font - this does its best
115 to return a font that will fit within the maximum height specified (but
116 note that variations due to hinting algorithms may rarely result in this
117 height being exceeded by up to one pixel). Problems can also be
118 encountered with bitmap fonts where the typeface exists but doesn't have
121 @param aFont On return, the pointer is set to point to the device font which
122 most closely approximates to the required font specification.
123 @param aFontSpec An absolute font specification.
124 @param aMaxHeight The maximum height in twips within which the font must
125 fit - this overrides the height specified in aFontSpec.
126 @return KErrNone, if successful; otherwise, another of the system-wide error
128 TInt CFbsDevice::GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
130 return GetNearestFontToMaxHeightInTwips((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
133 /** Creates a client-side FBSERV font from those available in the device's typeface store
134 that most closely matches a font specification.
136 When the font is no longer needed, call ReleaseFont().
138 The font and bitmap server returns a pointer to the nearest matching font
139 from those available. Matches to max height of font - this does its best
140 to return a font that will fit within the maximum height specified (but
141 note that variations due to hinting algorithms may rarely result in this
142 height being exceeded by up to one pixel). Problems can also be
143 encountered with bitmap fonts where the typeface exists but doesn't have
146 @param aFont On return, the pointer is set to point to the device font which
147 most closely approximates to the required font specification.
148 @param aFontSpec An absolute font specification.
149 @param aMaxHeight The maximum height in pixels within which the font must
150 fit - this overrides the height specified in aFontSpec.
151 @return KErrNone, if successful; otherwise, another of the system-wide error
153 TInt CFbsDevice::GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
155 return GetNearestFontToMaxHeightInPixels((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
158 /** Gets a specific bitmap font, identified by its UID, from the device's typeface store.
160 When the font is no longer needed, call ReleaseFont().
162 @param aFont On return, set to point to the font.
163 @param aFileId The UID identifying the bitmap font.
164 @param aStyle Algorithmic style for the font.
165 @return KErrNone if successful; otherwise, another of the system-wide error
167 TInt CFbsDevice::GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle)
169 return GetFontById((CFont*&)aFont,aFileId,aStyle);// relies on CFbsFont deriving _only_ from CFont
172 /** Gets a pointer to the 2D graphics accelerator owned by the device. If one is
173 available, it is used to accelerate various CFbsBitGc graphics operations.
175 @return Pointer to the graphics accelerator or NULL if not supported.
176 @see CFbsBitmapDevice::NewL() */
177 CGraphicsAccelerator* CFbsDevice::GraphicsAccelerator() const
179 return iGraphicsAccelerator;
183 /** Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation().
185 @return The device's orientation. */
186 CFbsBitGc::TGraphicsOrientation CFbsDevice::Orientation() const