graphicsdeviceinterface/bitgdi/tbit/TFONT.CPP
changeset 136 62bb7c97884c
parent 0 5d03bc08d59c
child 164 25ffed67c7ef
equal deleted inserted replaced
121:d72fc2aace31 136:62bb7c97884c
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   231 	TInt topNew=0;
   231 	TInt topNew=0;
   232 	TInt bottomNew=0;
   232 	TInt bottomNew=0;
   233 	TInt top=0;
   233 	TInt top=0;
   234 	TInt bottom=0;
   234 	TInt bottom=0;
   235 
   235 
       
   236 	// Maximum height of font allowed by iType rasteriser
       
   237 	const TInt KMaxITypeHeightInPixels = 256;
       
   238 
   236 	for (TInt count = 0; count < typefaces; count++)
   239 	for (TInt count = 0; count < typefaces; count++)
   237 		{
   240 		{
   238 		iDev->TypefaceSupport(info,count);
   241 		iDev->TypefaceSupport(info,count);
   239 
   242 
   240 		for (TInt index = 0; index < info.iNumHeights; index++)
   243 		for (TInt index = 0; index < info.iNumHeights; index++)
   241 			{
   244 			{
   242 			TInt height = iDev->FontHeightInPixels(count,index);
   245 			TInt height = iDev->FontHeightInPixels(count,index);
       
   246 			if (height > KMaxITypeHeightInPixels)
       
   247 				{
       
   248 				continue;
       
   249 				}
   243 			fs.iTypeface = info.iTypeface;
   250 			fs.iTypeface = info.iTypeface;
   244 			fs.iHeight = height;
   251 			fs.iHeight = height;
   245 
   252 
   246 			User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
   253 			User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs));
   247 			TEST(iFont->HeightInPixels() == height);
   254 			TInt heightInPixels = iFont->HeightInPixels();
       
   255 			if ( heightInPixels == height )
       
   256 				{
       
   257 				TEST( ETrue );
       
   258 				}
       
   259 			else
       
   260 				{
       
   261 				TOpenFontFaceAttrib attrib;
       
   262 				if( iFont->GetFaceAttrib( attrib ) )
       
   263 					{
       
   264 					_LIT(KErrorMessageWithFontName, "Font: %S, pixel height requested: %d, pixel height of font: %d");
       
   265 					INFO_PRINTF4(KErrorMessageWithFontName, &attrib.FullName(), height, heightInPixels);
       
   266 					}
       
   267 				else
       
   268 					{
       
   269 					_LIT(KErrorMessage, "Pixel height requested: %d, pixel height of font: %d");
       
   270 					INFO_PRINTF3(KErrorMessage, height, heightInPixels);
       
   271 					}
       
   272 				TEST( EFalse );
       
   273 				}
   248 
   274 
   249 			if (height >= 5)
   275 			if (height >= 5)
   250 				{
   276 				{
   251 				iGc->UseFont(iFont);
   277 				iGc->UseFont(iFont);
   252 				
   278