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