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