sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Tests FNTSTORE with respect to the Open Font system.
|
sl@0
|
16 |
* Creates a dummy rasterizer and tests font file loading and unloading and
|
sl@0
|
17 |
* font creation. This just exercises the way the Open Font system connects to the
|
sl@0
|
18 |
* 'classic' bitmap-font-only font system.
|
sl@0
|
19 |
*
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
#ifndef __T_FSOPEN_H__
|
sl@0
|
24 |
#define __T_FSOPEN_H__
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <fntstore.h>
|
sl@0
|
27 |
#include <openfont.h>
|
sl@0
|
28 |
#include <e32base.h>
|
sl@0
|
29 |
#include "TGraphicsHarness.h"
|
sl@0
|
30 |
#include <graphics/openfontrasterizer.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
class CTFsOpen : public CTGraphicsBase
|
sl@0
|
33 |
{
|
sl@0
|
34 |
public:
|
sl@0
|
35 |
CTFsOpen(CTestStep* aStep);
|
sl@0
|
36 |
~CTFsOpen();
|
sl@0
|
37 |
protected:
|
sl@0
|
38 |
//from CTGraphicsStep
|
sl@0
|
39 |
virtual void RunTestCaseL(TInt aCurTestCase);
|
sl@0
|
40 |
virtual void ConstructL();
|
sl@0
|
41 |
private:
|
sl@0
|
42 |
void TestFont(const TFontSpec& aSpec);
|
sl@0
|
43 |
void AddAndRemoveFilesL();
|
sl@0
|
44 |
void CreateAndReleaseFontsL();
|
sl@0
|
45 |
void CreateShaperL();
|
sl@0
|
46 |
#ifdef _DEBUG
|
sl@0
|
47 |
void TestGetNearestFontHelperL();
|
sl@0
|
48 |
#endif //_DEBUG
|
sl@0
|
49 |
private:
|
sl@0
|
50 |
RHeap* iHeap;
|
sl@0
|
51 |
CFontStore* iFontStore;
|
sl@0
|
52 |
RFs iFilesys;
|
sl@0
|
53 |
};
|
sl@0
|
54 |
|
sl@0
|
55 |
class CTFsOpenStep : public CTGraphicsStep
|
sl@0
|
56 |
{
|
sl@0
|
57 |
public:
|
sl@0
|
58 |
CTFsOpenStep();
|
sl@0
|
59 |
protected:
|
sl@0
|
60 |
//from CTGraphicsStep
|
sl@0
|
61 |
virtual CTGraphicsBase* CreateTestL();
|
sl@0
|
62 |
virtual void TestSetupL();
|
sl@0
|
63 |
};
|
sl@0
|
64 |
|
sl@0
|
65 |
_LIT(KTFsOpenStep,"TFsOpen");
|
sl@0
|
66 |
|
sl@0
|
67 |
|
sl@0
|
68 |
// make dummy font rasterizer available to t_fntmem
|
sl@0
|
69 |
|
sl@0
|
70 |
class CDummyRasterizer: public COpenFontRasterizer
|
sl@0
|
71 |
{
|
sl@0
|
72 |
public:
|
sl@0
|
73 |
static CDummyRasterizer* NewL();
|
sl@0
|
74 |
// virtual function from COpenFontRasterizer
|
sl@0
|
75 |
COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession);
|
sl@0
|
76 |
};
|
sl@0
|
77 |
|
sl@0
|
78 |
// dummy shaper factory to create dummy shaper
|
sl@0
|
79 |
|
sl@0
|
80 |
class CDummyShaperFactory: public CShaperFactory
|
sl@0
|
81 |
{
|
sl@0
|
82 |
public:
|
sl@0
|
83 |
static CDummyShaperFactory* NewL();
|
sl@0
|
84 |
virtual ~CDummyShaperFactory();
|
sl@0
|
85 |
virtual CShaper* NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
|
sl@0
|
86 |
|
sl@0
|
87 |
private:
|
sl@0
|
88 |
CDummyShaperFactory();
|
sl@0
|
89 |
|
sl@0
|
90 |
};
|
sl@0
|
91 |
|
sl@0
|
92 |
// dummy shaper
|
sl@0
|
93 |
|
sl@0
|
94 |
class CDummyShaper : public CShaper
|
sl@0
|
95 |
{
|
sl@0
|
96 |
public:
|
sl@0
|
97 |
|
sl@0
|
98 |
static CShaper* NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
|
sl@0
|
99 |
~CDummyShaper();
|
sl@0
|
100 |
|
sl@0
|
101 |
virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
|
sl@0
|
102 |
|
sl@0
|
103 |
private:
|
sl@0
|
104 |
CDummyShaper();
|
sl@0
|
105 |
TInt ConstructL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* iHeap);
|
sl@0
|
106 |
|
sl@0
|
107 |
// leaving version of shaping method
|
sl@0
|
108 |
TInt DummyShapeTextL(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
|
sl@0
|
109 |
|
sl@0
|
110 |
// the client heap pointer passed in during construction
|
sl@0
|
111 |
RHeap* iClientHeap;
|
sl@0
|
112 |
|
sl@0
|
113 |
// the private heap used by the shaper
|
sl@0
|
114 |
RHeap* iHeap;
|
sl@0
|
115 |
|
sl@0
|
116 |
// memory allocated for the private heap
|
sl@0
|
117 |
TAny* iHeapMemory;
|
sl@0
|
118 |
|
sl@0
|
119 |
// buffers used to hold results from the Icu Layout engine
|
sl@0
|
120 |
TInt32* iGlyphs;
|
sl@0
|
121 |
TInt32* iIndices;
|
sl@0
|
122 |
TInt32* iPositions;
|
sl@0
|
123 |
|
sl@0
|
124 |
};
|
sl@0
|
125 |
|
sl@0
|
126 |
#endif
|
sl@0
|
127 |
|