os/textandloc/fontservices/fontstore/tfs/T_FSOPEN.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/fontstore/tfs/T_FSOPEN.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,127 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* Tests FNTSTORE with respect to the Open Font system.
    1.19 +* Creates a dummy rasterizer and tests font file loading and unloading and
    1.20 +* font creation. This just exercises the way the Open Font system connects to the
    1.21 +* 'classic' bitmap-font-only font system.
    1.22 +*
    1.23 +*/
    1.24 +
    1.25 +
    1.26 +#ifndef __T_FSOPEN_H__
    1.27 +#define __T_FSOPEN_H__
    1.28 +
    1.29 +#include <fntstore.h>
    1.30 +#include <openfont.h>
    1.31 +#include <e32base.h>
    1.32 +#include "TGraphicsHarness.h"
    1.33 +#include <graphics/openfontrasterizer.h>
    1.34 +
    1.35 +class CTFsOpen : public CTGraphicsBase
    1.36 +	{
    1.37 +public:
    1.38 +	CTFsOpen(CTestStep* aStep);
    1.39 +	~CTFsOpen();
    1.40 +protected:
    1.41 +//from 	CTGraphicsStep
    1.42 +	virtual void RunTestCaseL(TInt aCurTestCase);
    1.43 +	virtual void ConstructL();
    1.44 +private:
    1.45 +	void TestFont(const TFontSpec& aSpec);
    1.46 +	void AddAndRemoveFilesL();
    1.47 +	void CreateAndReleaseFontsL();
    1.48 +	void CreateShaperL();
    1.49 +#ifdef _DEBUG
    1.50 +	void TestGetNearestFontHelperL();
    1.51 +#endif //_DEBUG
    1.52 +private:
    1.53 +	RHeap* iHeap;
    1.54 +	CFontStore* iFontStore;
    1.55 +	RFs iFilesys;
    1.56 +	};
    1.57 +
    1.58 +class CTFsOpenStep : public CTGraphicsStep
    1.59 +	{
    1.60 +public:
    1.61 +	CTFsOpenStep();
    1.62 +protected:	
    1.63 +	//from CTGraphicsStep
    1.64 +	virtual CTGraphicsBase* CreateTestL();
    1.65 +	virtual void TestSetupL();
    1.66 +	};
    1.67 +
    1.68 +_LIT(KTFsOpenStep,"TFsOpen");
    1.69 +
    1.70 +
    1.71 +// make dummy font rasterizer available to t_fntmem
    1.72 +
    1.73 +class CDummyRasterizer: public COpenFontRasterizer
    1.74 +	{
    1.75 +public:
    1.76 +	static CDummyRasterizer* NewL();
    1.77 +	// virtual function from COpenFontRasterizer
    1.78 +	COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession);
    1.79 +	};
    1.80 +	
    1.81 +// dummy shaper factory to create dummy shaper	
    1.82 +
    1.83 +class CDummyShaperFactory: public CShaperFactory
    1.84 +	{
    1.85 +public:
    1.86 +	static CDummyShaperFactory* NewL();
    1.87 +	virtual ~CDummyShaperFactory();
    1.88 +	virtual CShaper* NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
    1.89 +
    1.90 +private:
    1.91 +	CDummyShaperFactory();
    1.92 +
    1.93 +	};
    1.94 +	
    1.95 +// dummy shaper
    1.96 +
    1.97 +class CDummyShaper : public CShaper
    1.98 +	{
    1.99 +public:
   1.100 +
   1.101 +	static CShaper* NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
   1.102 +	~CDummyShaper();
   1.103 +	
   1.104 +	virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
   1.105 +		
   1.106 +private:
   1.107 +	CDummyShaper();
   1.108 +	TInt ConstructL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* iHeap);
   1.109 +
   1.110 +	// leaving version of shaping method
   1.111 +	TInt DummyShapeTextL(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
   1.112 +	
   1.113 +	// the client heap pointer passed in during construction
   1.114 +	RHeap* iClientHeap;
   1.115 +
   1.116 +	// the private heap used by the shaper
   1.117 +	RHeap* iHeap;
   1.118 +
   1.119 +	// memory allocated for the private heap	
   1.120 +	TAny* iHeapMemory;
   1.121 +
   1.122 +	// buffers used to hold results from the Icu Layout engine 
   1.123 + 	TInt32* iGlyphs;
   1.124 +    TInt32* iIndices;
   1.125 +    TInt32* iPositions;
   1.126 +    
   1.127 +    };
   1.128 +
   1.129 +#endif
   1.130 +