1 coefontprovider.h |
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 #ifndef __COEFONTPROVIDER_H__ |
|
17 #define __COEFONTPROVIDER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <e32def.h> |
|
21 #include <coefont.h> |
|
22 #include <coemain.h> |
|
23 #include <coeaui.h> |
|
24 #include <coecntss.h> |
|
25 |
|
26 /** A helper object designed to make obtaining a font easier, taking into account |
|
27 zoom factors. |
|
28 |
|
29 @publishedAll |
|
30 @released |
|
31 */ |
|
32 class CCoeFontProvider : public CBase |
|
33 { |
|
34 public: // life |
|
35 IMPORT_C static CCoeFontProvider* NewL(); |
|
36 IMPORT_C static CCoeFontProvider* NewL(const TDesC& aTypefaceName); |
|
37 ~CCoeFontProvider(); |
|
38 public: // methods |
|
39 IMPORT_C const CFont& Font(const TCoeFont& aFont, const TZoomFactor& aZoomFactor) const; |
|
40 public: // properties |
|
41 IMPORT_C void SetTypeface(const TTypeface aTypeface); |
|
42 IMPORT_C void UseSystemTypeface(); |
|
43 IMPORT_C TTypeface Typeface() const; |
|
44 public: //but not exported |
|
45 void RefetchPixelMappingL(); |
|
46 |
|
47 private: |
|
48 CCoeFontProvider(const TDesC& aTypefaceName); |
|
49 void ConstructL(); |
|
50 void ReleaseAllFonts(); |
|
51 private: |
|
52 class TFont |
|
53 { |
|
54 public: |
|
55 TFont(const TCoeFont& aFontSpec, TInt aZoomFactor, const CFont* aFont = NULL); |
|
56 static TInt Compare(const TFont& aFirst, const TFont& aSecond); |
|
57 public: |
|
58 const TCoeFont iCoeFont; |
|
59 const TInt iZoomFactor; |
|
60 const CFont* iFont; |
|
61 }; |
|
62 private: |
|
63 mutable RArray<TFont> iFonts; |
|
64 TTypeface iTypeface; |
|
65 RArray<TInt> iLogicalToPixelSizes; |
|
66 }; |
|
67 |
|
68 #endif // __COEFONTPROVIDER_H__ |