/** function used to create the linked typefaces
 */
void CTLinkedTypefaceCreator::CreateL()
	{
	CFbsTypefaceStore* store = CFbsTypefaceStore::NewL(iDev);
	CleanupStack::PushL(store);

	for (TInt counter=0; counter< sizeof(KLinkedTypefaces)/sizeof(TTLinkedTypeface);counter++)
		{
		//creating the groups needs to be done for every typeface since ownwership is taken
		//after adding the group to one linked typeface specification
		//leave on any failure e.g. out of memory, which is not expected
		CreateGroupsL(KGroupList, sizeof(KGroupList)/sizeof(TTGroup*));

		//create the linked typeface elements for this linked typeface
		CreateElementsL(KLinkedTypefaces[counter].iElements);

		//add the groups and elements, but first create the spec
		CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KLinkedTypefaces[counter].iTypefaceName);
		
		//add the groups
		for (TInt groupCounter=0; groupCounter<iGroups.Count();groupCounter++)
			{
			spec->AddLinkedTypefaceGroupL(*iGroups[groupCounter]);//ownership is taken
			iGroups[groupCounter]=NULL;
			}

		//add the elements
		for (TInt elementCounter=0; elementCounter<iElements.Count();elementCounter++)
			{
			spec->AddTypefaceAtBackL(*iElements[elementCounter]);//ownership is taken
			iElements[elementCounter]=NULL;
			}
		iElements.ResetAndDestroy();
		iGroups.ResetAndDestroy();

		//register
		TInt err=KErrNone;
		TRAP(err,spec->RegisterLinkedTypefaceL(*store)); //may fail if something is wrong with the tables, want to try to continue

		//do not report test failure if already registered
		iStep->testBooleanTrue(err==KErrNone || err==KErrAlreadyExists, (TText8*)__FILE__, __LINE__);

		//delete spec
		CleanupStack::PopAndDestroy();
		}
	CleanupStack::PopAndDestroy();//store
	}