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