graphics/fntstore/inc/T_TestOpenFont.h
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2007-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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Creates a dummy rasterizer and a dummy shaper for FontStore APIs testing.
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __T_TESTOPENFONT_H__
       
    19 #define __T_TESTOPENFONT_H__
       
    20 
       
    21 #include <fntstore.h>
       
    22 #include <openfont.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 _LIT(KTestFont1, "dummy");
       
    26 _LIT(KTestFont2, "dummy_2");
       
    27 
       
    28 
       
    29 class CTestRasterizer : public COpenFontRasterizer
       
    30 	{
       
    31 public:
       
    32 	static CTestRasterizer* NewL();
       
    33 	COpenFontFile* NewFontFileL(TInt aUid, const TDesC& aFileName, RFs& aFileSession);
       
    34 	};
       
    35 	
       
    36 
       
    37 class CTestFontFile: public COpenFontFile
       
    38 	{
       
    39 public:
       
    40 	static CTestFontFile* NewL(TInt aUid,const TDesC& aFileName);
       
    41 
       
    42 	TBool GetNearestFontHelper(const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
       
    43 										TInt& aFaceIndex, TOpenFontSpec& aActualFontSpec) const;
       
    44 	void GetNearestFontInPixelsL(RHeap* aHeap, COpenFontSessionCacheList* aSessionCacheList,
       
    45 								 const TOpenFontSpec& aDesiredFontSpec, TInt aPixelWidth, TInt aPixelHeight,
       
    46 								 COpenFont*& aFont,TOpenFontSpec& aActualFontSpec);
       
    47 	void GetNearestFontToDesignHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
       
    48 								 const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
       
    49 								 COpenFont*& aFont,TOpenFontSpec& aActualFontSpec);
       
    50 	void GetNearestFontToMaxHeightInPixelsL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,
       
    51 								 const TOpenFontSpec& aDesiredFontSpec,TInt aPixelWidth,TInt aPixelHeight,
       
    52 								 COpenFont*& aFont,TOpenFontSpec& aActualFontSpec, TInt aMaxHeight);
       
    53 	virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const;
       
    54 
       
    55 private:
       
    56 	CTestFontFile(TInt aUid,const TDesC& aFileName);
       
    57 	void ConstructL();
       
    58 	};
       
    59 
       
    60 
       
    61 class CTestFont: public COpenFont
       
    62 	{
       
    63 public:
       
    64 	static CTestFont* NewL(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,CTestFontFile* aFontFile,TInt aSizeInPixels);
       
    65 private:
       
    66 	CTestFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,CTestFontFile* aFontFile,TInt aSizeInPixels);
       
    67 	virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData);
       
    68 	};
       
    69 
       
    70 
       
    71 class CTestShaperFactory: public CShaperFactory
       
    72 	{
       
    73 public:
       
    74 	static CTestShaperFactory* NewL();
       
    75 	virtual ~CTestShaperFactory();
       
    76 	virtual CShaper* NewShaperL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
       
    77 
       
    78 private:
       
    79 	CTestShaperFactory();
       
    80 	};
       
    81 	
       
    82 
       
    83 class CTestShaper : public CShaper
       
    84 	{
       
    85 public:
       
    86 
       
    87 	static CShaper* NewL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* aHeap);
       
    88 	~CTestShaper();	
       
    89 	virtual TInt ShapeText(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
       
    90 		
       
    91 private:
       
    92 	CTestShaper();
       
    93 	TInt ConstructL(CBitmapFont* aBitmapfont, TInt aScript, TInt aLanguage, RHeap* iHeap);
       
    94 	TInt TestShapeTextL(TShapeHeader*& aOutput, const TInput& aInput, RHeap* aHeapForOutput);
       
    95 	
       
    96 private:	
       
    97 	RHeap* iClientHeap;
       
    98 	RHeap* iHeap;
       
    99 	TAny* iHeapMemory;
       
   100  	TInt32* iGlyphs;
       
   101     TInt32* iIndices;
       
   102     TInt32* iPositions;    
       
   103     };
       
   104 
       
   105 #endif // __T_TESTOPENFONT_H__
       
   106