1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2006-2009 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 |
|
239 for (TInt count = 0; count < typefaces; count++) |
236 for (TInt count = 0; count < typefaces; count++) |
240 { |
237 { |
241 iDev->TypefaceSupport(info,count); |
238 iDev->TypefaceSupport(info,count); |
242 |
239 |
243 for (TInt index = 0; index < info.iNumHeights; index++) |
240 for (TInt index = 0; index < info.iNumHeights; index++) |
244 { |
241 { |
245 TInt height = iDev->FontHeightInPixels(count,index); |
242 TInt height = iDev->FontHeightInPixels(count,index); |
246 if (height > KMaxITypeHeightInPixels) |
|
247 { |
|
248 continue; |
|
249 } |
|
250 fs.iTypeface = info.iTypeface; |
243 fs.iTypeface = info.iTypeface; |
251 fs.iHeight = height; |
244 fs.iHeight = height; |
252 |
245 |
253 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs)); |
246 User::LeaveIfError(GetNearestFontToDesignHeightInPixels(iFont,fs)); |
254 TInt heightInPixels = iFont->HeightInPixels(); |
247 TEST(iFont->HeightInPixels() == height); |
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 } |
|
274 |
248 |
275 if (height >= 5) |
249 if (height >= 5) |
276 { |
250 { |
277 iGc->UseFont(iFont); |
251 iGc->UseFont(iFont); |
278 |
252 |