|
1 // tfinfo.cpp |
|
2 // |
|
3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #include <fshell/ioutils.h> |
|
14 #include <w32std.h> |
|
15 #include <gdi.h> |
|
16 #include <fbs.h> |
|
17 |
|
18 using namespace IoUtils; |
|
19 |
|
20 class CCmdTfinfo : public CCommandBase |
|
21 { |
|
22 public: |
|
23 static CCommandBase* NewLC(); |
|
24 ~CCmdTfinfo(); |
|
25 private: |
|
26 CCmdTfinfo(); |
|
27 private: // From CCommandBase. |
|
28 virtual const TDesC& Name() const; |
|
29 virtual void DoRunL(); |
|
30 virtual void ArgumentsL(RCommandArgumentList& aArguments); |
|
31 virtual void OptionsL(RCommandOptionList& aOptions); |
|
32 private: |
|
33 RWsSession iWsSession; |
|
34 CWsScreenDevice* iScreenDevice; |
|
35 CFbsTypefaceStore* iTypefaceStore; |
|
36 TBool iVerbose; |
|
37 }; |
|
38 |
|
39 |
|
40 CCommandBase* CCmdTfinfo::NewLC() |
|
41 { |
|
42 CCmdTfinfo* self = new(ELeave) CCmdTfinfo(); |
|
43 CleanupStack::PushL(self); |
|
44 self->BaseConstructL(); |
|
45 return self; |
|
46 } |
|
47 |
|
48 CCmdTfinfo::~CCmdTfinfo() |
|
49 { |
|
50 delete iTypefaceStore; |
|
51 delete iScreenDevice; |
|
52 iWsSession.Close(); |
|
53 } |
|
54 |
|
55 CCmdTfinfo::CCmdTfinfo() |
|
56 { |
|
57 } |
|
58 |
|
59 const TDesC& CCmdTfinfo::Name() const |
|
60 { |
|
61 _LIT(KName, "tfinfo"); |
|
62 return KName; |
|
63 } |
|
64 |
|
65 void CCmdTfinfo::DoRunL() |
|
66 { |
|
67 LeaveIfErr(iWsSession.Connect(), _L("Couldn't connect to the Window Server")); |
|
68 iScreenDevice = new(ELeave) CWsScreenDevice(iWsSession); |
|
69 iScreenDevice->Construct(); |
|
70 iTypefaceStore = CFbsTypefaceStore::NewL(iScreenDevice); |
|
71 |
|
72 TInt numTypeFaces = iTypefaceStore->NumTypefaces(); |
|
73 if (iVerbose) |
|
74 { |
|
75 Printf(_L("%d type faces found\r\n"), numTypeFaces); |
|
76 } |
|
77 for (TInt i = 0; i < numTypeFaces; ++i) |
|
78 { |
|
79 TTypefaceSupport typefaceSupport; |
|
80 iTypefaceStore->TypefaceSupport(typefaceSupport, i); |
|
81 Printf(_L("%S\r\n"), &typefaceSupport.iTypeface.iName); |
|
82 if (iVerbose) |
|
83 { |
|
84 Printf(_L("\tProportional: %d\r\n"), typefaceSupport.iTypeface.IsProportional()); |
|
85 Printf(_L("\tSerif: %d\r\n"), typefaceSupport.iTypeface.IsSerif()); |
|
86 Printf(_L("\tSymbol: %d\r\n"), typefaceSupport.iTypeface.IsSymbol()); |
|
87 Printf(_L("\tScalable: %d\r\n"), typefaceSupport.iIsScalable); |
|
88 if (!typefaceSupport.iIsScalable) |
|
89 { |
|
90 Printf(_L("\tNumber of heights: %d\r\n"), typefaceSupport.iNumHeights); |
|
91 Printf(_L("\tMin height in twips: %d\r\n"), typefaceSupport.iMinHeightInTwips); |
|
92 Printf(_L("\tMax height in twips: %d\r\n"), typefaceSupport.iMaxHeightInTwips); |
|
93 } |
|
94 } |
|
95 } |
|
96 } |
|
97 |
|
98 void CCmdTfinfo::ArgumentsL(RCommandArgumentList&) |
|
99 { |
|
100 } |
|
101 |
|
102 void CCmdTfinfo::OptionsL(RCommandOptionList& aOptions) |
|
103 { |
|
104 _LIT(KOptVerbose, "verbose"); |
|
105 aOptions.AppendBoolL(iVerbose, KOptVerbose); |
|
106 } |
|
107 |
|
108 |
|
109 EXE_BOILER_PLATE(CCmdTfinfo) |
|
110 |