1 bitdev.inl |
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 Creates a font and bitmap server graphics context for the device and activates |
|
20 it. |
|
21 |
|
22 It is the responsibility of the caller to delete the graphics context when |
|
23 it is no longer needed. |
|
24 |
|
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 |
|
27 codes. |
|
28 */ |
|
29 TInt CFbsDevice::CreateContext(CGraphicsContext*& aGc) |
|
30 { |
|
31 return CreateContext((CFbsBitGc*&)aGc);// relies on CFbsDevice deriving _only_ from CBitmapDevice |
|
32 } |
|
33 |
|
34 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
35 that most closely matches a font specification. |
|
36 |
|
37 When the font is no longer needed, call ReleaseFont(). |
|
38 |
|
39 This function is replaced by GetNearestFontToDesignHeightInTwips(). |
|
40 |
|
41 @param aFont On return, points to the font which most closely matches the |
|
42 specified font. |
|
43 @param aFontSpec An absolute font specification. Its iHeight member is interpreted |
|
44 as being in twips. |
|
45 @return KErrNone if successful; otherwise, another one of the system-wide error |
|
46 codes. |
|
47 @deprecated */ |
|
48 TInt CFbsDevice::GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec) |
|
49 { |
|
50 return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec); |
|
51 } |
|
52 |
|
53 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
54 that most closely matches a font specification. |
|
55 |
|
56 When the font is no longer needed, call ReleaseFont(). |
|
57 |
|
58 This function is replaced by GetNearestFontToDesignHeightInPixels(). |
|
59 |
|
60 @param aFont On return, points to the font which most closely matches the |
|
61 specified font. |
|
62 @param aFontSpec An absolute font specification. Its iHeight member is interpreted |
|
63 as being in pixels. |
|
64 @return KErrNone if successful; otherwise, another of the system-wide error |
|
65 codes. |
|
66 @deprecated */ |
|
67 TInt CFbsDevice::GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec) |
|
68 { |
|
69 return GetNearestFontToDesignHeightInPixels(aFont, aFontSpec); |
|
70 } |
|
71 |
|
72 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
73 that most closely matches a font specification. |
|
74 |
|
75 When the font is no longer needed, call ReleaseFont(). |
|
76 |
|
77 This function replaces GetNearestFontInTwips(). |
|
78 |
|
79 @param aFont On return, points to the font which most closely matches the |
|
80 specified font. |
|
81 @param aFontSpec An absolute font specification. Its iHeight member is interpreted |
|
82 as being in twips. |
|
83 @return KErrNone if successful; otherwise, another one of the system-wide error |
|
84 codes. */ |
|
85 TInt CFbsDevice::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec) |
|
86 { |
|
87 return GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont |
|
88 } |
|
89 |
|
90 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
91 that most closely matches a font specification. |
|
92 |
|
93 When the font is no longer needed, call ReleaseFont(). |
|
94 |
|
95 This function replaces GetNearestFontInPixels(). |
|
96 |
|
97 @param aFont On return, points to the font which most closely matches the |
|
98 specified font. |
|
99 @param aFontSpec An absolute font specification. Its iHeight member is interpreted |
|
100 as being in pixels. |
|
101 @return KErrNone if successful; otherwise, another of the system-wide error |
|
102 codes. */ |
|
103 TInt CFbsDevice::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec) |
|
104 { |
|
105 return GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont |
|
106 } |
|
107 |
|
108 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
109 that most closely matches a font specification. |
|
110 |
|
111 When the font is no longer needed, call ReleaseFont(). |
|
112 |
|
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 |
|
119 a font small enough. |
|
120 |
|
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 |
|
127 codes. */ |
|
128 TInt CFbsDevice::GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) |
|
129 { |
|
130 return GetNearestFontToMaxHeightInTwips((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont |
|
131 } |
|
132 |
|
133 /** Creates a client-side FBSERV font from those available in the device's typeface store |
|
134 that most closely matches a font specification. |
|
135 |
|
136 When the font is no longer needed, call ReleaseFont(). |
|
137 |
|
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 |
|
144 a font small enough. |
|
145 |
|
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 |
|
152 codes. */ |
|
153 TInt CFbsDevice::GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) |
|
154 { |
|
155 return GetNearestFontToMaxHeightInPixels((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont |
|
156 } |
|
157 |
|
158 /** Gets a specific bitmap font, identified by its UID, from the device's typeface store. |
|
159 |
|
160 When the font is no longer needed, call ReleaseFont(). |
|
161 |
|
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 |
|
166 codes. */ |
|
167 TInt CFbsDevice::GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle) |
|
168 { |
|
169 return GetFontById((CFont*&)aFont,aFileId,aStyle);// relies on CFbsFont deriving _only_ from CFont |
|
170 } |
|
171 |
|
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. |
|
174 |
|
175 @return Pointer to the graphics accelerator or NULL if not supported. |
|
176 @see CFbsBitmapDevice::NewL() */ |
|
177 CGraphicsAccelerator* CFbsDevice::GraphicsAccelerator() const |
|
178 { |
|
179 return iGraphicsAccelerator; |
|
180 } |
|
181 |
|
182 |
|
183 /** Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation(). |
|
184 |
|
185 @return The device's orientation. */ |
|
186 CFbsBitGc::TGraphicsOrientation CFbsDevice::Orientation() const |
|
187 { |
|
188 return iOrientation; |
|
189 } |