sl@0: /*
sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: * Tests FNTSTORE with respect to the Open Font system.
sl@0: * Creates a dummy rasterizer and tests font file loading and unloading and
sl@0: * font creation. This just exercises the way the Open Font system connects to the
sl@0: * 'classic' bitmap-font-only font system.
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #ifndef __T_FSOPEN_H__
sl@0: #define __T_FSOPEN_H__
sl@0: 
sl@0: #include <fntstore.h>
sl@0: #include <openfont.h>
sl@0: #include <e32base.h>
sl@0: #include "TGraphicsHarness.h"
sl@0: #include <graphics/openfontrasterizer.h>
sl@0: 
sl@0: class CTFsOpen : public CTGraphicsBase
sl@0: 	{
sl@0: public:
sl@0: 	CTFsOpen(CTestStep* aStep);
sl@0: 	~CTFsOpen();
sl@0: protected:
sl@0: //from 	CTGraphicsStep
sl@0: 	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0: 	virtual void ConstructL();
sl@0: private:
sl@0: 	void TestFont(const TFontSpec& aSpec);
sl@0: 	void AddAndRemoveFilesL();
sl@0: 	void CreateAndReleaseFontsL();
sl@0: 	void CreateShaperL();
sl@0: #ifdef _DEBUG
sl@0: 	void TestGetNearestFontHelperL();
sl@0: #endif //_DEBUG
sl@0: private:
sl@0: 	RHeap* iHeap;
sl@0: 	CFontStore* iFontStore;
sl@0: 	RFs iFilesys;
sl@0: 	};
sl@0: 
sl@0: class CTFsOpenStep : public CTGraphicsStep
sl@0: 	{
sl@0: public:
sl@0: 	CTFsOpenStep();
sl@0: protected:	
sl@0: 	//from CTGraphicsStep
sl@0: 	virtual CTGraphicsBase* CreateTestL();
sl@0: 	virtual void TestSetupL();
sl@0: 	};
sl@0: 
sl@0: _LIT(KTFsOpenStep,"TFsOpen");
sl@0: 
sl@0: 
sl@0: // make dummy font rasterizer available to t_fntmem
sl@0: 
sl@0: class CDummyRasterizer: public COpenFontRasterizer
sl@0: 	{
sl@0: public:
sl@0: 	static CDummyRasterizer* NewL();
sl@0: 	// virtual function from COpenFontRasterizer
sl@0: 	COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession);
sl@0: 	};
sl@0: 	
sl@0: // dummy shaper factory to create dummy shaper	
sl@0: 
sl@0: class CDummyShaperFactory: public CShaperFactory
sl@0: 	{
sl@0: public:
sl@0: 	static CDummyShaperFactory* NewL();
sl@0: 	virtual ~CDummyShaperFactory();
sl@0: 	virtual CShaper* NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
sl@0: 
sl@0: private:
sl@0: 	CDummyShaperFactory();
sl@0: 
sl@0: 	};
sl@0: 	
sl@0: // dummy shaper
sl@0: 
sl@0: class CDummyShaper : public CShaper
sl@0: 	{
sl@0: public:
sl@0: 
sl@0: 	static CShaper* NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
sl@0: 	~CDummyShaper();
sl@0: 	
sl@0: 	virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
sl@0: 		
sl@0: private:
sl@0: 	CDummyShaper();
sl@0: 	TInt ConstructL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* iHeap);
sl@0: 
sl@0: 	// leaving version of shaping method
sl@0: 	TInt DummyShapeTextL(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
sl@0: 	
sl@0: 	// the client heap pointer passed in during construction
sl@0: 	RHeap* iClientHeap;
sl@0: 
sl@0: 	// the private heap used by the shaper
sl@0: 	RHeap* iHeap;
sl@0: 
sl@0: 	// memory allocated for the private heap	
sl@0: 	TAny* iHeapMemory;
sl@0: 
sl@0: 	// buffers used to hold results from the Icu Layout engine 
sl@0:  	TInt32* iGlyphs;
sl@0:     TInt32* iIndices;
sl@0:     TInt32* iPositions;
sl@0:     
sl@0:     };
sl@0: 
sl@0: #endif
sl@0: