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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 Creates a font and bitmap server graphics context for the device and activates
20 It is the responsibility of the caller to delete the graphics context when
21 it is no longer needed.
23 @param aGc On return, contains a pointer to the graphics context.
24 @return KErrNone if successful, otherwise, another one of the system-wide error
27 TInt CFbsDevice::CreateContext(CGraphicsContext*& aGc)
29 return CreateContext((CFbsBitGc*&)aGc);// relies on CFbsDevice deriving _only_ from CBitmapDevice
32 /** Creates a client-side FBSERV font from those available in the device's typeface store
33 that most closely matches a font specification.
35 When the font is no longer needed, call ReleaseFont().
37 This function is replaced by GetNearestFontToDesignHeightInTwips().
39 @param aFont On return, points to the font which most closely matches the
41 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
43 @return KErrNone if successful; otherwise, another one of the system-wide error
46 TInt CFbsDevice::GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
48 return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
51 /** Creates a client-side FBSERV font from those available in the device's typeface store
52 that most closely matches a font specification.
54 When the font is no longer needed, call ReleaseFont().
56 This function is replaced by GetNearestFontToDesignHeightInPixels().
58 @param aFont On return, points to the font which most closely matches the
60 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
62 @return KErrNone if successful; otherwise, another of the system-wide error
65 TInt CFbsDevice::GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
67 return GetNearestFontToDesignHeightInPixels(aFont, aFontSpec);
70 /** Creates a client-side FBSERV font from those available in the device's typeface store
71 that most closely matches a font specification.
73 When the font is no longer needed, call ReleaseFont().
75 This function replaces GetNearestFontInTwips().
77 @param aFont On return, points to the font which most closely matches the
79 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
81 @return KErrNone if successful; otherwise, another one of the system-wide error
83 TInt CFbsDevice::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
85 return GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
88 /** Creates a client-side FBSERV font from those available in the device's typeface store
89 that most closely matches a font specification.
91 When the font is no longer needed, call ReleaseFont().
93 This function replaces GetNearestFontInPixels().
95 @param aFont On return, points to the font which most closely matches the
97 @param aFontSpec An absolute font specification. Its iHeight member is interpreted
99 @return KErrNone if successful; otherwise, another of the system-wide error
101 TInt CFbsDevice::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
103 return GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
106 /** Creates a client-side FBSERV font from those available in the device's typeface store
107 that most closely matches a font specification.
109 When the font is no longer needed, call ReleaseFont().
111 The font and bitmap server returns a pointer to the nearest matching font
112 from those available. Matches to max height of font - this does its best
113 to return a font that will fit within the maximum height specified (but
114 note that variations due to hinting algorithms may rarely result in this
115 height being exceeded by up to one pixel). Problems can also be
116 encountered with bitmap fonts where the typeface exists but doesn't have
119 @param aFont On return, the pointer is set to point to the device font which
120 most closely approximates to the required font specification.
121 @param aFontSpec An absolute font specification.
122 @param aMaxHeight The maximum height in twips within which the font must
123 fit - this overrides the height specified in aFontSpec.
124 @return KErrNone, if successful; otherwise, another of the system-wide error
126 TInt CFbsDevice::GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
128 return GetNearestFontToMaxHeightInTwips((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
131 /** Creates a client-side FBSERV font from those available in the device's typeface store
132 that most closely matches a font specification.
134 When the font is no longer needed, call ReleaseFont().
136 The font and bitmap server returns a pointer to the nearest matching font
137 from those available. Matches to max height of font - this does its best
138 to return a font that will fit within the maximum height specified (but
139 note that variations due to hinting algorithms may rarely result in this
140 height being exceeded by up to one pixel). Problems can also be
141 encountered with bitmap fonts where the typeface exists but doesn't have
144 @param aFont On return, the pointer is set to point to the device font which
145 most closely approximates to the required font specification.
146 @param aFontSpec An absolute font specification.
147 @param aMaxHeight The maximum height in pixels within which the font must
148 fit - this overrides the height specified in aFontSpec.
149 @return KErrNone, if successful; otherwise, another of the system-wide error
151 TInt CFbsDevice::GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
153 return GetNearestFontToMaxHeightInPixels((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
156 /** Gets a specific bitmap font, identified by its UID, from the device's typeface store.
158 When the font is no longer needed, call ReleaseFont().
160 @param aFont On return, set to point to the font.
161 @param aFileId The UID identifying the bitmap font.
162 @param aStyle Algorithmic style for the font.
163 @return KErrNone if successful; otherwise, another of the system-wide error
165 TInt CFbsDevice::GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle)
167 return GetFontById((CFont*&)aFont,aFileId,aStyle);// relies on CFbsFont deriving _only_ from CFont
170 /** Gets a pointer to the 2D graphics accelerator owned by the device. If one is
171 available, it is used to accelerate various CFbsBitGc graphics operations.
173 @return Pointer to the graphics accelerator or NULL if not supported.
174 @see CFbsBitmapDevice::NewL() */
175 CGraphicsAccelerator* CFbsDevice::GraphicsAccelerator() const
177 return iGraphicsAccelerator;
181 /** Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation().
183 @return The device's orientation. */
184 CFbsBitGc::TGraphicsOrientation CFbsDevice::Orientation() const