graphics/fntstore/src/T_DataFontStore.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 /*
       
     2  * Copyright (c) 2005-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 the License "Symbian Foundation License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 /**
       
    18  @test
       
    19  @internalComponent
       
    20 
       
    21  This contains CT_DataFontStore
       
    22  */
       
    23 #include "T_DataFontStore.h"
       
    24 #include "T_GraphicsUtil.h"
       
    25 #include "T_TestOpenFont.h"
       
    26 
       
    27 /*@{*/
       
    28 ///	Parameters
       
    29 _LIT(KFldTypefaceName,				"typefacename");
       
    30 _LIT(KFldHeapSize,					"heapsize");
       
    31 _LIT(KFldFontFile,					"fontfile");
       
    32 _LIT(KFldId,						"id");
       
    33 _LIT(KFldExpectedGlyphBitmapType,	"expected_bmptype");
       
    34 _LIT(KFldGlyphBitmapType,			"bmptype");
       
    35 _LIT(KFldSessionHandle,				"sessionhandle");
       
    36 _LIT(KFldTypefaceIndex,				"typeface_index");
       
    37 _LIT(KFldHeightIndex,				"height_index");
       
    38 _LIT(KFldExpectedHeight,			"expected_height");
       
    39 _LIT(KFldFontUid,					"fontuid");
       
    40 _LIT(KFldAlgStyle,					"alg_style");
       
    41 _LIT(KFldFont,						"font");
       
    42 _LIT(KFldOpenFont,					"openfont");
       
    43 _LIT(KFldMaxHeight,					"maxheight");
       
    44 _LIT(KFldUseTestClass,				"usetestclass");
       
    45 _LIT(KFldRasterizer,				"rasterizer");
       
    46 _LIT(KFldShaperFactory,				"shaperfactory");
       
    47 
       
    48 ///	Commands
       
    49 _LIT(KCmdNewL,						"NewL");
       
    50 _LIT(KCmdDestructor,				"~");
       
    51 _LIT(KCmdAddFileL,					"AddFileL");
       
    52 _LIT(KCmdRemoveFile,				"RemoveFile");
       
    53 _LIT(KCmdDefaultBitmapType,			"DefaultBitmapType");
       
    54 _LIT(KCmdDeleteSessionCache,		"DeleteSessionCache");
       
    55 _LIT(KCmdFontHeightInPixels,		"FontHeightInPixels");
       
    56 _LIT(KCmdGetFontById,				"GetFontById");
       
    57 _LIT(KCmdGetNearestFontToDesignHeightInPixels,	"GetNearestFontToDesignHeightInPixels");
       
    58 _LIT(KCmdGetNearestFontToDesignHeightInTwips,	"GetNearestFontToDesignHeightInTwips");
       
    59 _LIT(KCmdGetNearestFontToMaxHeightInPixels,		"GetNearestFontToMaxHeightInPixels");
       
    60 _LIT(KCmdGetNearestFontToMaxHeightInTwips,		"GetNearestFontToMaxHeightInTwips");
       
    61 _LIT(KCmdInstallRasterizerL,					"InstallRasterizerL");
       
    62 _LIT(KCmdInstallShaperFactoryL,		"InstallShaperFactoryL");
       
    63 _LIT(KCmdSetDefaultBitmapType,		"SetDefaultBitmapType");
       
    64 
       
    65 /// Logs
       
    66 _LIT(KLogMissingParameter,			"Missing parameter '%S'");
       
    67 _LIT(KLogError,						"Error=%d");
       
    68 _LIT(KLogMissingFilename,			"File '%S' not found in array");
       
    69 _LIT(KLogFontSpec,					"font_spec or openfont_spec");
       
    70 /*@}*/
       
    71 
       
    72 /**
       
    73  * Two phase constructor
       
    74  */
       
    75 CT_DataFontStore* CT_DataFontStore::NewL()
       
    76 	{
       
    77 	CT_DataFontStore* ret = new (ELeave) CT_DataFontStore();
       
    78 	CleanupStack::PushL(ret);
       
    79 	ret->ConstructL();
       
    80 	CleanupStack::Pop(ret);
       
    81 	return ret;
       
    82 	}
       
    83 /**
       
    84  * Protected second phase construction
       
    85  */
       
    86 void CT_DataFontStore::ConstructL()
       
    87 	{
       
    88 	}
       
    89 
       
    90 /**
       
    91  * Protected constructor. First phase construction
       
    92  */
       
    93 CT_DataFontStore::CT_DataFontStore() :
       
    94 	CT_DataTypefaceStore(), iFntStore(NULL)
       
    95 	{
       
    96 	}
       
    97 
       
    98 /**
       
    99  * Destructor.
       
   100  */
       
   101 CT_DataFontStore::~CT_DataFontStore()
       
   102 	{
       
   103 	DestroyData();
       
   104 	iFile.Reset();
       
   105 	iFile.Close();
       
   106 	iId.Reset();
       
   107 	iId.Close();
       
   108 	}
       
   109 
       
   110 /**
       
   111  * cleanup implementation.
       
   112  */
       
   113 void CT_DataFontStore::DestroyData()
       
   114 	{
       
   115 	delete iFntStore;
       
   116 	iFntStore = NULL;
       
   117 	}
       
   118 
       
   119 TAny* CT_DataFontStore::GetObject()
       
   120 	{
       
   121 	return iFntStore;
       
   122 	}
       
   123 
       
   124 void CT_DataFontStore::SetObjectL(TAny* aObject)
       
   125 	{
       
   126 	DestroyData();
       
   127 	iFntStore = static_cast<CFontStore*> (aObject);
       
   128 	}
       
   129 
       
   130 void CT_DataFontStore::DisownObjectL()
       
   131 	{
       
   132 	iFntStore = NULL;
       
   133 	}
       
   134 
       
   135 CTypefaceStore* CT_DataFontStore::GetTypefaceStore() const
       
   136 	{
       
   137 	return iFntStore;
       
   138 	}
       
   139 
       
   140 /**
       
   141  * Process a command read from the ini file
       
   142  *
       
   143  * @param aDataWrapper	test step requiring command to be processed
       
   144  * @param aCommand	the command to process
       
   145  * @param aSection		the entry in the ini file requiring the command to be processed
       
   146  *
       
   147  * @return ETrue if the command is processed
       
   148  */
       
   149 TBool CT_DataFontStore::DoCommandL(const TTEFFunction& aCommand,
       
   150 		const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
   151 	{
       
   152 	TBool retVal = ETrue;
       
   153 
       
   154 	if (aCommand == KCmdNewL)
       
   155 		{
       
   156 		DoCmdNewL(aSection);
       
   157 		}
       
   158 	else if (aCommand == KCmdDestructor)
       
   159 		{
       
   160 		DoCmdDestructor();
       
   161 		}
       
   162 	else if (aCommand == KCmdAddFileL)
       
   163 		{
       
   164 		DoCmdAddFileL(aSection);
       
   165 		}
       
   166 	else if (aCommand == KCmdRemoveFile)
       
   167 		{
       
   168 		DoCmdRemoveFile(aSection);
       
   169 		}
       
   170 	else if (aCommand == KCmdDefaultBitmapType)
       
   171 		{
       
   172 		DoCmdDefaultBitmapType(aSection);
       
   173 		}
       
   174 	else if (aCommand == KCmdDeleteSessionCache)
       
   175 		{
       
   176 		DoCmdDeleteSessionCache(aSection);
       
   177 		}
       
   178 	else if (aCommand == KCmdFontHeightInPixels)
       
   179 		{
       
   180 		DoCmdFontHeightInPixels(aSection);
       
   181 		}
       
   182 	else if (aCommand == KCmdGetFontById)
       
   183 		{
       
   184 		DoCmdGetFontByIdL(aSection);
       
   185 		}
       
   186 	else if (aCommand == KCmdGetNearestFontToDesignHeightInPixels)
       
   187 		{
       
   188 		DoCmdGetNearestFontToDesignHeightInPixelsL(aSection);
       
   189 		}
       
   190 	else if (aCommand == KCmdGetNearestFontToDesignHeightInTwips)
       
   191 		{
       
   192 		if (!DoCmdGetNearestFontToDesignHeightInTwipsL(aSection))
       
   193 			{
       
   194 			retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   195 			}
       
   196 		}
       
   197 	else if (aCommand == KCmdGetNearestFontToMaxHeightInPixels)
       
   198 		{
       
   199 		DoCmdGetNearestFontToMaxHeightInPixelsL(aSection);
       
   200 		}
       
   201 	else if (aCommand == KCmdGetNearestFontToMaxHeightInTwips)
       
   202 		{
       
   203 		if (!DoCmdGetNearestFontToMaxHeightInTwipsL(aSection))
       
   204 			{
       
   205 			retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   206 			}
       
   207 		}
       
   208 	else if (aCommand == KCmdInstallRasterizerL)
       
   209 		{
       
   210 		DoCmdInstallRasterizerL(aSection);
       
   211 		}
       
   212 	else if (aCommand == KCmdInstallShaperFactoryL)
       
   213 		{
       
   214 		DoCmdInstallShaperFactoryL(aSection);
       
   215 		}
       
   216 	else if (aCommand == KCmdSetDefaultBitmapType)
       
   217 		{
       
   218 		DoCmdSetDefaultBitmapType(aSection);
       
   219 		}
       
   220 	else
       
   221 		{
       
   222 		retVal = CT_DataTypefaceStore::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   223 		}
       
   224 
       
   225 	return retVal;
       
   226 	}
       
   227 
       
   228 ////////////////// COMMANDS IMPLEMENTATION  ////////////////////////
       
   229 
       
   230 /** Creates an instance of CT_DataFontStore class */
       
   231 void CT_DataFontStore::DoCmdNewL(const TDesC& aSection)
       
   232 	{
       
   233 	// cleanup if any
       
   234 	DestroyData();
       
   235 
       
   236 	TInt heapsize;
       
   237 	TInt err;
       
   238 	
       
   239 	INFO_PRINTF1(_L("execute CFontStore::NewL(RHeap*)"));
       
   240 	if (GetIntFromConfig(aSection, KFldHeapSize, heapsize))
       
   241 		{
       
   242 		RHeap* heap = NULL;
       
   243 		if (heapsize != 0)
       
   244 			{
       
   245 			heap = UserHeap::ChunkHeap(NULL, heapsize, heapsize);
       
   246 			}
       
   247 		TRAP(err, iFntStore = CFontStore::NewL(heap));
       
   248 		}
       
   249 	else
       
   250 		{
       
   251 		// Use heap of the thread.
       
   252 		TRAP(err, iFntStore = CFontStore::NewL(&User::Heap()));
       
   253 		}
       
   254 	
       
   255 	if (err != KErrNone)
       
   256 		{
       
   257 		ERR_PRINTF2(KLogError, err);
       
   258 		SetError(err);
       
   259 		}
       
   260 	}
       
   261 
       
   262 void CT_DataFontStore::DoCmdDestructor()
       
   263 	{
       
   264 	// cleanup if any
       
   265 	DestroyData();
       
   266 	}
       
   267 
       
   268 void CT_DataFontStore::DoCmdAddFileL(const TDesC& aSection)
       
   269 	{
       
   270 	TPtrC name;
       
   271 	
       
   272 	if (!GetStringFromConfig(aSection, KFldFontFile, name))
       
   273 		{
       
   274 		ERR_PRINTF2(KLogMissingParameter, &KFldFontFile());
       
   275 		SetBlockResult(EFail);
       
   276 		}
       
   277 	else
       
   278 		{
       
   279 		TUid id;
       
   280 		
       
   281 		INFO_PRINTF1(_L("execute CFontStore::AddFileL(const TDesC&)"));
       
   282 		TRAPD(err, id = iFntStore->AddFileL(name));
       
   283 		
       
   284 		if (err != KErrNone)
       
   285 			{
       
   286 			ERR_PRINTF2(KLogError, err);
       
   287 			SetError(err);
       
   288 			}
       
   289 		else
       
   290 			{
       
   291 			iFile.AppendL(name);
       
   292 			iId.AppendL(id.iUid);
       
   293 			}
       
   294 		}
       
   295 	}
       
   296 
       
   297 TBool CT_DataFontStore::FindIdByName(const TDesC& aName, TInt& aId)
       
   298 	{
       
   299 	TBool found = EFalse;
       
   300 	for (TInt index = 0; index < iFile.Count(); ++index)
       
   301 		{
       
   302 		if (iFile[index] == aName)
       
   303 			{
       
   304 			aId = iId[index];
       
   305 			iFile.Remove(index);
       
   306 			iId.Remove(index);
       
   307 			found = ETrue;
       
   308 			break;
       
   309 			}
       
   310 		}
       
   311 	return found;
       
   312 	}
       
   313 
       
   314 void CT_DataFontStore::DoCmdRemoveFile(const TDesC& aSection)
       
   315 	{
       
   316 	TBool dataOk = ETrue;
       
   317 	TInt id;
       
   318 	
       
   319 	// Get the uid
       
   320 	if (!GetIntFromConfig(aSection, KFldId(), id))
       
   321 		{
       
   322 		TPtrC file;
       
   323 		
       
   324 		// No uid provided. Get file name instead.
       
   325 		if (!GetStringFromConfig(aSection, KFldFontFile(), file))
       
   326 			{
       
   327 			dataOk = EFalse;
       
   328 			}
       
   329 		else
       
   330 			{
       
   331 			// Get uid by file name.
       
   332 			if (!FindIdByName(file, id))
       
   333 				{
       
   334 				dataOk = EFalse;
       
   335 				}
       
   336 			}
       
   337 		}
       
   338 
       
   339 	if (dataOk)
       
   340 		{
       
   341 		INFO_PRINTF1(_L("execute CFontStore::RemoveFile(TUid)"));
       
   342 		iFntStore->RemoveFile(TUid::Uid(id));
       
   343 		}
       
   344 	else
       
   345 		{
       
   346 		INFO_PRINTF1(_L("execute CFontStore::RemoveFile(TUid::Null())"));
       
   347 		iFntStore->RemoveFile(TUid::Null());
       
   348 		}
       
   349 	}
       
   350 
       
   351 void CT_DataFontStore::DoCmdDefaultBitmapType(const TDesC& aSection)
       
   352 	{
       
   353 	TGlyphBitmapType actual = iFntStore->DefaultBitmapType();
       
   354 	INFO_PRINTF2(_L("execute CFontStore::DefaultBitmapType() = %d"), actual);
       
   355 	
       
   356 	TGlyphBitmapType expected;
       
   357 	if(CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KFldExpectedGlyphBitmapType(), expected))
       
   358 		{
       
   359 		if (actual != expected)
       
   360 			{
       
   361 			ERR_PRINTF3(_L("The expected result %d is not equal to the actual result %d!"), expected, actual);
       
   362 			SetBlockResult(EFail);
       
   363 			}
       
   364 		}
       
   365 	}
       
   366 
       
   367 void CT_DataFontStore::DoCmdDeleteSessionCache(const TDesC& aSection)
       
   368 	{
       
   369 	TInt handle;
       
   370 
       
   371 	if (!GetIntFromConfig(aSection, KFldSessionHandle, handle))
       
   372 		{
       
   373 		ERR_PRINTF2(KLogMissingParameter, &KFldSessionHandle());
       
   374 		SetBlockResult(EFail);
       
   375 		}
       
   376 	else
       
   377 		{
       
   378 		INFO_PRINTF1(_L("execute CFontStore::DeleteSessionCache(TInt)"));
       
   379 		iFntStore->DeleteSessionCache(handle);
       
   380 		}
       
   381 	}
       
   382 
       
   383 void CT_DataFontStore::DoCmdFontHeightInPixels(const TDesC& aSection)
       
   384 	{
       
   385 	TInt tfindex;
       
   386 	TInt heightindex;
       
   387 	TBool dataOk = ETrue;
       
   388 	
       
   389 	if (!GetIntFromConfig(aSection, KFldTypefaceIndex, tfindex))
       
   390 		{
       
   391 		dataOk = EFalse;
       
   392 		ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceIndex());
       
   393 		SetBlockResult(EFail);
       
   394 		}
       
   395 	
       
   396 	if (!GetIntFromConfig(aSection, KFldHeightIndex, heightindex))
       
   397 		{
       
   398 		dataOk = EFalse;
       
   399 		ERR_PRINTF2(KLogMissingParameter, &KFldHeightIndex());
       
   400 		SetBlockResult(EFail);
       
   401 		}
       
   402 	
       
   403 	if (dataOk)
       
   404 		{
       
   405 		TInt actual = iFntStore->FontHeightInPixels(tfindex, heightindex);
       
   406 		INFO_PRINTF2(_L("execute CFontStore::FontHeightInPixels(TInt, TInt) = %d"), actual);
       
   407 		
       
   408 		TInt expected;
       
   409 		if (GetIntFromConfig(aSection, KFldExpectedHeight, expected))
       
   410 			{
       
   411 			if (expected != actual)
       
   412 				{
       
   413 				ERR_PRINTF3(_L("The expected result %d is not equal to the actual result %d!"), expected, actual);
       
   414 				SetBlockResult(EFail);
       
   415 				}
       
   416 			}
       
   417 		}
       
   418 	}
       
   419 
       
   420 void CT_DataFontStore::DoCmdGetFontByIdL(const TDesC& aSection)
       
   421 	{
       
   422 	TBool dataOk = ETrue;
       
   423 	TAlgStyle* algStyle = NULL;
       
   424 	TPtrC wrapperName;
       
   425 	TInt fontUid;
       
   426 
       
   427 	// get font uid
       
   428 	if (!GetIntFromConfig(aSection, KFldFontUid(), fontUid))
       
   429 		{
       
   430 		dataOk = EFalse;
       
   431 		ERR_PRINTF2(KLogMissingParameter, &KFldFontUid());
       
   432 		SetBlockResult(EFail);
       
   433 		}
       
   434 	// get algorithmic style
       
   435 	if	(!CT_GraphicsUtil::GetAlgStyleL(*this, aSection, KFldAlgStyle(), algStyle) && NULL == algStyle)
       
   436 		{
       
   437 		dataOk = EFalse;
       
   438 		ERR_PRINTF2(KLogMissingParameter, &KFldAlgStyle());
       
   439 		SetBlockResult(EFail);
       
   440 		}
       
   441 	if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
       
   442 		{
       
   443 		dataOk = EFalse;
       
   444 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   445 		SetBlockResult(EFail);
       
   446 		}
       
   447 
       
   448 	if (dataOk)
       
   449 		{
       
   450 		CFont* font = NULL;
       
   451 		INFO_PRINTF1(_L("execute CFontStore::GetFontById(CFont *&, TUid, const TAlgStyle&)"));
       
   452 		TInt err = iFntStore->GetFontById(font, TUid::Uid(fontUid), *algStyle);
       
   453 
       
   454 		if (KErrNone != err)
       
   455 			{
       
   456 			ERR_PRINTF2(KLogError, err);
       
   457 			SetError(err);
       
   458 			}
       
   459 		else
       
   460 			{
       
   461 			SetDataObjectL(wrapperName, font);
       
   462 			}
       
   463 		}
       
   464 	}
       
   465 
       
   466 void CT_DataFontStore::DoCmdGetNearestFontToDesignHeightInPixelsL(
       
   467 		const TDesC& aSection)
       
   468 	{
       
   469 	TPtrC wrapperName;
       
   470 	
       
   471 	if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
       
   472 		{
       
   473 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   474 		SetBlockResult(EFail);
       
   475 		}
       
   476 	else
       
   477 		{
       
   478 		TFontSpec fontSpec;
       
   479 		TInt err;
       
   480 		CFont* font;
       
   481 		TBool fxnCalled = EFalse;
       
   482 		
       
   483 		if (GetFontSpecFromConfig(aSection, KFldFont, fontSpec))
       
   484 			{
       
   485 			fxnCalled = ETrue;
       
   486 			INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInPixels(CFont*&, const TFontSpec&)"));
       
   487 			err = iFntStore->GetNearestFontToDesignHeightInPixels(font, fontSpec);
       
   488 			}
       
   489 		else if (GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
       
   490 			{
       
   491 			fxnCalled = ETrue;
       
   492 			INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInPixels(CFont*&, const TOpenFontSpec&)"));
       
   493 			err = iFntStore->GetNearestFontToDesignHeightInPixels(font, TOpenFontSpec(fontSpec));
       
   494 			}
       
   495 		else
       
   496 			{
       
   497 			ERR_PRINTF2(KLogMissingParameter, &KLogFontSpec());
       
   498 			SetBlockResult(EFail);
       
   499 			}
       
   500 		
       
   501 		if (fxnCalled)
       
   502 			{
       
   503 			if (err != KErrNone)
       
   504 				{
       
   505 				ERR_PRINTF2(KLogError, err);
       
   506 				SetError(err);
       
   507 				}
       
   508 			else
       
   509 				{
       
   510 				SetDataObjectL(wrapperName, font);
       
   511 				}
       
   512 			}
       
   513 		}
       
   514 	}
       
   515 
       
   516 TBool CT_DataFontStore::DoCmdGetNearestFontToDesignHeightInTwipsL(
       
   517 		const TDesC& aSection)
       
   518 	{
       
   519 	TPtrC wrapperName;
       
   520 
       
   521 	if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
       
   522 		{
       
   523 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   524 		SetBlockResult(EFail);
       
   525 		}
       
   526 	else
       
   527 		{
       
   528 		TFontSpec fontSpec;
       
   529 		TInt err;
       
   530 		CFont* font;
       
   531 
       
   532 		if (!GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
       
   533 			{
       
   534 			return EFalse;
       
   535 			}
       
   536 		else
       
   537 			{
       
   538 			INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToDesignHeightInTwips(CFont*&, const TOpenFontSpec&)"));
       
   539 			err = iFntStore->GetNearestFontToDesignHeightInTwips(font, TOpenFontSpec(fontSpec));
       
   540 			if (err != KErrNone)
       
   541 				{
       
   542 				ERR_PRINTF2(KLogError, err);
       
   543 				SetError(err);
       
   544 				}
       
   545 			else
       
   546 				{
       
   547 				SetDataObjectL(wrapperName, font);
       
   548 				}
       
   549 			}
       
   550 		}
       
   551 	return ETrue;
       
   552 	}
       
   553 
       
   554 void CT_DataFontStore::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
       
   555 	{
       
   556 	TBool dataOk = ETrue;
       
   557 
       
   558 	TPtrC wrapperName;
       
   559 	if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
       
   560 		{
       
   561 		dataOk = EFalse;
       
   562 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   563 		SetBlockResult(EFail);
       
   564 		}
       
   565 	
       
   566 	TInt maxHeight;
       
   567 	if (!GetIntFromConfig(aSection, KFldMaxHeight, maxHeight))
       
   568 		{
       
   569 		dataOk = EFalse;
       
   570 		ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
       
   571 		SetBlockResult(EFail);
       
   572 		}
       
   573 	
       
   574 	if (dataOk)
       
   575 		{
       
   576 		TFontSpec fontSpec;
       
   577 		TInt err;
       
   578 		CFont* font;
       
   579 		TBool fxnCalled = EFalse;
       
   580 
       
   581 		if (GetFontSpecFromConfig(aSection, KFldFont, fontSpec))
       
   582 			{
       
   583 			fxnCalled = ETrue;
       
   584 			INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInPixels(CFont*&, const TFontSpec&, TInt)"));
       
   585 			err = iFntStore->GetNearestFontToMaxHeightInPixels(font, fontSpec, maxHeight);
       
   586 			}
       
   587 		else if (GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
       
   588 			{
       
   589 			fxnCalled = ETrue;
       
   590 			INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInPixels(CFont*&, const TOpenFontSpec&, TInt)"));
       
   591 			err = iFntStore->GetNearestFontToMaxHeightInPixels(font, TOpenFontSpec(fontSpec), maxHeight);
       
   592 			}
       
   593 		else
       
   594 			{
       
   595 			ERR_PRINTF2(KLogMissingParameter, &KLogFontSpec());
       
   596 			SetBlockResult(EFail);
       
   597 			}
       
   598 
       
   599 		if (fxnCalled)
       
   600 			{
       
   601 			if (err != KErrNone)
       
   602 				{
       
   603 				ERR_PRINTF2(KLogError, err);
       
   604 				SetError(err);
       
   605 				}
       
   606 			else
       
   607 				{
       
   608 				SetDataObjectL(wrapperName, font);
       
   609 				}
       
   610 			}
       
   611 		}
       
   612 	}
       
   613 
       
   614 TBool CT_DataFontStore::DoCmdGetNearestFontToMaxHeightInTwipsL(const TDesC& aSection)
       
   615 	{
       
   616 	TBool dataOk = ETrue;
       
   617 	TPtrC wrapperName;
       
   618 	if (!GetStringFromConfig(aSection, KFldFont, wrapperName))
       
   619 		{
       
   620 		dataOk = EFalse;
       
   621 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   622 		SetBlockResult(EFail);
       
   623 		}
       
   624 
       
   625 	TInt maxHeight;
       
   626 	if (!GetIntFromConfig(aSection, KFldMaxHeight, maxHeight))
       
   627 		{
       
   628 		dataOk = EFalse;
       
   629 		ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
       
   630 		SetBlockResult(EFail);
       
   631 		}
       
   632 	
       
   633 	TFontSpec fontSpec;
       
   634 	if (!GetFontSpecFromConfig(aSection, KFldOpenFont, fontSpec))
       
   635 		{
       
   636 		return EFalse;
       
   637 		}
       
   638 	
       
   639 	if (dataOk)
       
   640 		{
       
   641 		TInt err;
       
   642 		CFont* font;
       
   643 
       
   644 		INFO_PRINTF1(_L("execute CFontStore::GetNearestFontToMaxHeightInTwips(CFont*&, const TOpenFontSpec&, TInt)"));
       
   645 		err = iFntStore->GetNearestFontToMaxHeightInTwips(font, TOpenFontSpec(fontSpec), maxHeight);
       
   646 		if (err != KErrNone)
       
   647 			{
       
   648 			ERR_PRINTF2(KLogError, err);
       
   649 			SetError(err);
       
   650 			}
       
   651 		else
       
   652 			{
       
   653 			SetDataObjectL(wrapperName, font);
       
   654 			}
       
   655 		}
       
   656 	return ETrue;
       
   657 	}
       
   658 
       
   659 void CT_DataFontStore::DoCmdInstallRasterizerL(const TDesC& aSection)
       
   660 	{
       
   661 	COpenFontRasterizer* rasterizer = NULL;
       
   662 	TInt err;
       
   663 	TBool useDummy;
       
   664 	
       
   665 	if (!GetBoolFromConfig(aSection, KFldUseTestClass, useDummy))
       
   666 		{
       
   667 		ERR_PRINTF2(KLogMissingParameter, &KFldUseTestClass());
       
   668 		SetBlockResult(EFail);
       
   669 		}
       
   670 	else
       
   671 		{
       
   672 		if (useDummy)
       
   673 			{
       
   674 			TRAP(err, rasterizer = CTestRasterizer::NewL());
       
   675 			if (err != KErrNone)
       
   676 				{
       
   677 				ERR_PRINTF2(KLogError, err);
       
   678 				SetError(err);
       
   679 				return;
       
   680 				}
       
   681 			}
       
   682 		else
       
   683 			{
       
   684 			CT_GraphicsUtil::GetRasterizerL(*this, aSection, KFldRasterizer, rasterizer);
       
   685 			}
       
   686 		
       
   687 		if (rasterizer == NULL)
       
   688 			{
       
   689 			INFO_PRINTF1(_L("execute CFontStore::InstallRasterizerL(NULL)"));
       
   690 			}
       
   691 		else
       
   692 			{
       
   693 			INFO_PRINTF1(_L("execute CFontStore::InstallRasterizerL(COpenFontRasterizer*)"));
       
   694 			}
       
   695 		TRAP(err, iFntStore->InstallRasterizerL(rasterizer));
       
   696 		if (err != KErrNone)
       
   697 			{
       
   698 			ERR_PRINTF2(KLogError, err);
       
   699 			SetError(err);
       
   700 			}
       
   701 		}
       
   702 	}
       
   703 
       
   704 void CT_DataFontStore::DoCmdInstallShaperFactoryL(const TDesC& aSection)
       
   705 	{
       
   706 	CShaperFactory* shaper = NULL;
       
   707 	TInt err;
       
   708 	TBool useDummy;
       
   709 	
       
   710 	if (!GetBoolFromConfig(aSection, KFldUseTestClass, useDummy))
       
   711 		{
       
   712 		ERR_PRINTF2(KLogMissingParameter, &KFldUseTestClass());
       
   713 		SetBlockResult(EFail);
       
   714 		}
       
   715 	else
       
   716 		{
       
   717 		if (useDummy)
       
   718 			{
       
   719 			TRAP(err, shaper = CTestShaperFactory::NewL());
       
   720 			if (err != KErrNone)
       
   721 				{
       
   722 				ERR_PRINTF2(KLogError, err);
       
   723 				SetError(err);
       
   724 				return;
       
   725 				}
       
   726 			}
       
   727 		else
       
   728 			{
       
   729 			CT_GraphicsUtil::GetShaperFactoryL(*this, aSection, KFldShaperFactory, shaper);
       
   730 			}
       
   731 
       
   732 		if (shaper == NULL)
       
   733 			{
       
   734 			INFO_PRINTF1(_L("execute CFontStore::InstallShaperFactoryL(NULL)"));
       
   735 			}
       
   736 		else
       
   737 			{
       
   738 			INFO_PRINTF1(_L("execute CFontStore::InstallShaperFactoryL(CShaperFactory*)"));
       
   739 			}
       
   740 		TRAP(err, iFntStore->InstallShaperFactoryL(shaper));
       
   741 		if (err != KErrNone)
       
   742 			{
       
   743 			ERR_PRINTF2(KLogError, err);
       
   744 			SetError(err);
       
   745 			}
       
   746 		}
       
   747 	}
       
   748 
       
   749 void CT_DataFontStore::DoCmdSetDefaultBitmapType(const TDesC& aSection)
       
   750 	{
       
   751 	TGlyphBitmapType bmptype;
       
   752 	
       
   753 	if (!CT_GraphicsUtil::ReadGlyphBitmapType(*this, aSection, KFldGlyphBitmapType(), bmptype))
       
   754 		{
       
   755 		ERR_PRINTF2(KLogMissingParameter, &KFldGlyphBitmapType());
       
   756 		SetBlockResult(EFail);
       
   757 		}
       
   758 	else
       
   759 		{
       
   760 		INFO_PRINTF1(_L("execute CFontStore::SetDefaultBitmapType(TGlyphBitmapType)"));
       
   761 		iFntStore->SetDefaultBitmapType(bmptype);
       
   762 		}
       
   763 	}