williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
Creates a font and bitmap server graphics context for the device and activates
|
williamr@2
|
20 |
it.
|
williamr@2
|
21 |
|
williamr@2
|
22 |
It is the responsibility of the caller to delete the graphics context when
|
williamr@2
|
23 |
it is no longer needed.
|
williamr@2
|
24 |
|
williamr@2
|
25 |
@param aGc On return, contains a pointer to the graphics context.
|
williamr@2
|
26 |
@return KErrNone if successful, otherwise, another one of the system-wide error
|
williamr@2
|
27 |
codes.
|
williamr@2
|
28 |
*/
|
williamr@2
|
29 |
TInt CFbsDevice::CreateContext(CGraphicsContext*& aGc)
|
williamr@2
|
30 |
{
|
williamr@2
|
31 |
return CreateContext((CFbsBitGc*&)aGc);// relies on CFbsDevice deriving _only_ from CBitmapDevice
|
williamr@2
|
32 |
}
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
35 |
that most closely matches a font specification.
|
williamr@2
|
36 |
|
williamr@2
|
37 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
38 |
|
williamr@2
|
39 |
This function is replaced by GetNearestFontToDesignHeightInTwips().
|
williamr@2
|
40 |
|
williamr@2
|
41 |
@param aFont On return, points to the font which most closely matches the
|
williamr@2
|
42 |
specified font.
|
williamr@2
|
43 |
@param aFontSpec An absolute font specification. Its iHeight member is interpreted
|
williamr@2
|
44 |
as being in twips.
|
williamr@2
|
45 |
@return KErrNone if successful; otherwise, another one of the system-wide error
|
williamr@2
|
46 |
codes.
|
williamr@2
|
47 |
@deprecated */
|
williamr@2
|
48 |
TInt CFbsDevice::GetNearestFontInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
return GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
|
williamr@2
|
51 |
}
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
54 |
that most closely matches a font specification.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
57 |
|
williamr@2
|
58 |
This function is replaced by GetNearestFontToDesignHeightInPixels().
|
williamr@2
|
59 |
|
williamr@2
|
60 |
@param aFont On return, points to the font which most closely matches the
|
williamr@2
|
61 |
specified font.
|
williamr@2
|
62 |
@param aFontSpec An absolute font specification. Its iHeight member is interpreted
|
williamr@2
|
63 |
as being in pixels.
|
williamr@2
|
64 |
@return KErrNone if successful; otherwise, another of the system-wide error
|
williamr@2
|
65 |
codes.
|
williamr@2
|
66 |
@deprecated */
|
williamr@2
|
67 |
TInt CFbsDevice::GetNearestFontInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
|
williamr@2
|
68 |
{
|
williamr@2
|
69 |
return GetNearestFontToDesignHeightInPixels(aFont, aFontSpec);
|
williamr@2
|
70 |
}
|
williamr@2
|
71 |
|
williamr@2
|
72 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
73 |
that most closely matches a font specification.
|
williamr@2
|
74 |
|
williamr@2
|
75 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
76 |
|
williamr@2
|
77 |
This function replaces GetNearestFontInTwips().
|
williamr@2
|
78 |
|
williamr@2
|
79 |
@param aFont On return, points to the font which most closely matches the
|
williamr@2
|
80 |
specified font.
|
williamr@2
|
81 |
@param aFontSpec An absolute font specification. Its iHeight member is interpreted
|
williamr@2
|
82 |
as being in twips.
|
williamr@2
|
83 |
@return KErrNone if successful; otherwise, another one of the system-wide error
|
williamr@2
|
84 |
codes. */
|
williamr@2
|
85 |
TInt CFbsDevice::GetNearestFontToDesignHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec)
|
williamr@2
|
86 |
{
|
williamr@2
|
87 |
return GetNearestFontToDesignHeightInTwips((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
|
williamr@2
|
88 |
}
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
91 |
that most closely matches a font specification.
|
williamr@2
|
92 |
|
williamr@2
|
93 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
94 |
|
williamr@2
|
95 |
This function replaces GetNearestFontInPixels().
|
williamr@2
|
96 |
|
williamr@2
|
97 |
@param aFont On return, points to the font which most closely matches the
|
williamr@2
|
98 |
specified font.
|
williamr@2
|
99 |
@param aFontSpec An absolute font specification. Its iHeight member is interpreted
|
williamr@2
|
100 |
as being in pixels.
|
williamr@2
|
101 |
@return KErrNone if successful; otherwise, another of the system-wide error
|
williamr@2
|
102 |
codes. */
|
williamr@2
|
103 |
TInt CFbsDevice::GetNearestFontToDesignHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec)
|
williamr@2
|
104 |
{
|
williamr@2
|
105 |
return GetNearestFontToDesignHeightInPixels((CFont*&)aFont, aFontSpec); // relies on CFbsFont deriving _only_ from CFont
|
williamr@2
|
106 |
}
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
109 |
that most closely matches a font specification.
|
williamr@2
|
110 |
|
williamr@2
|
111 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
112 |
|
williamr@2
|
113 |
The font and bitmap server returns a pointer to the nearest matching font
|
williamr@2
|
114 |
from those available. Matches to max height of font - this does its best
|
williamr@2
|
115 |
to return a font that will fit within the maximum height specified (but
|
williamr@2
|
116 |
note that variations due to hinting algorithms may rarely result in this
|
williamr@2
|
117 |
height being exceeded by up to one pixel). Problems can also be
|
williamr@2
|
118 |
encountered with bitmap fonts where the typeface exists but doesn't have
|
williamr@2
|
119 |
a font small enough.
|
williamr@2
|
120 |
|
williamr@2
|
121 |
@param aFont On return, the pointer is set to point to the device font which
|
williamr@2
|
122 |
most closely approximates to the required font specification.
|
williamr@2
|
123 |
@param aFontSpec An absolute font specification.
|
williamr@2
|
124 |
@param aMaxHeight The maximum height in twips within which the font must
|
williamr@2
|
125 |
fit - this overrides the height specified in aFontSpec.
|
williamr@2
|
126 |
@return KErrNone, if successful; otherwise, another of the system-wide error
|
williamr@2
|
127 |
codes. */
|
williamr@2
|
128 |
TInt CFbsDevice::GetNearestFontToMaxHeightInTwips(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
|
williamr@2
|
129 |
{
|
williamr@2
|
130 |
return GetNearestFontToMaxHeightInTwips((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
|
williamr@2
|
131 |
}
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/** Creates a client-side FBSERV font from those available in the device's typeface store
|
williamr@2
|
134 |
that most closely matches a font specification.
|
williamr@2
|
135 |
|
williamr@2
|
136 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
137 |
|
williamr@2
|
138 |
The font and bitmap server returns a pointer to the nearest matching font
|
williamr@2
|
139 |
from those available. Matches to max height of font - this does its best
|
williamr@2
|
140 |
to return a font that will fit within the maximum height specified (but
|
williamr@2
|
141 |
note that variations due to hinting algorithms may rarely result in this
|
williamr@2
|
142 |
height being exceeded by up to one pixel). Problems can also be
|
williamr@2
|
143 |
encountered with bitmap fonts where the typeface exists but doesn't have
|
williamr@2
|
144 |
a font small enough.
|
williamr@2
|
145 |
|
williamr@2
|
146 |
@param aFont On return, the pointer is set to point to the device font which
|
williamr@2
|
147 |
most closely approximates to the required font specification.
|
williamr@2
|
148 |
@param aFontSpec An absolute font specification.
|
williamr@2
|
149 |
@param aMaxHeight The maximum height in pixels within which the font must
|
williamr@2
|
150 |
fit - this overrides the height specified in aFontSpec.
|
williamr@2
|
151 |
@return KErrNone, if successful; otherwise, another of the system-wide error
|
williamr@2
|
152 |
codes. */
|
williamr@2
|
153 |
TInt CFbsDevice::GetNearestFontToMaxHeightInPixels(CFbsFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight)
|
williamr@2
|
154 |
{
|
williamr@2
|
155 |
return GetNearestFontToMaxHeightInPixels((CFont*&)aFont, aFontSpec, aMaxHeight); // relies on CFbsFont deriving _only_ from CFont
|
williamr@2
|
156 |
}
|
williamr@2
|
157 |
|
williamr@2
|
158 |
/** Gets a specific bitmap font, identified by its UID, from the device's typeface store.
|
williamr@2
|
159 |
|
williamr@2
|
160 |
When the font is no longer needed, call ReleaseFont().
|
williamr@2
|
161 |
|
williamr@2
|
162 |
@param aFont On return, set to point to the font.
|
williamr@2
|
163 |
@param aFileId The UID identifying the bitmap font.
|
williamr@2
|
164 |
@param aStyle Algorithmic style for the font.
|
williamr@2
|
165 |
@return KErrNone if successful; otherwise, another of the system-wide error
|
williamr@2
|
166 |
codes. */
|
williamr@2
|
167 |
TInt CFbsDevice::GetFontById(CFbsFont*& aFont,TUid aFileId,const TAlgStyle& aStyle)
|
williamr@2
|
168 |
{
|
williamr@2
|
169 |
return GetFontById((CFont*&)aFont,aFileId,aStyle);// relies on CFbsFont deriving _only_ from CFont
|
williamr@2
|
170 |
}
|
williamr@2
|
171 |
|
williamr@2
|
172 |
/** Gets a pointer to the 2D graphics accelerator owned by the device. If one is
|
williamr@2
|
173 |
available, it is used to accelerate various CFbsBitGc graphics operations.
|
williamr@2
|
174 |
|
williamr@2
|
175 |
@return Pointer to the graphics accelerator or NULL if not supported.
|
williamr@2
|
176 |
@see CFbsBitmapDevice::NewL() */
|
williamr@2
|
177 |
CGraphicsAccelerator* CFbsDevice::GraphicsAccelerator() const
|
williamr@2
|
178 |
{
|
williamr@2
|
179 |
return iGraphicsAccelerator;
|
williamr@2
|
180 |
}
|
williamr@2
|
181 |
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/** Gets the device's orientation. The orientation can be set using CFbsBitGc::SetOrientation().
|
williamr@2
|
184 |
|
williamr@2
|
185 |
@return The device's orientation. */
|
williamr@2
|
186 |
CFbsBitGc::TGraphicsOrientation CFbsDevice::Orientation() const
|
williamr@2
|
187 |
{
|
williamr@2
|
188 |
return iOrientation;
|
williamr@2
|
189 |
}
|