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