uifw/EikStd/coctlsrc/EIKLABEL.CPP
branchRCL_3
changeset 29 a8834a2e9a96
parent 0 2f259fa3e83a
child 55 aecbbf00d063
equal deleted inserted replaced
25:941195f2d488 29:a8834a2e9a96
   268 		iExtension->iFlags.Set(CEikLabelExtension::ECropText);
   268 		iExtension->iFlags.Set(CEikLabelExtension::ECropText);
   269 	}
   269 	}
   270 	
   270 	
   271 TInt CEikLabel::HeightInPixels() const
   271 TInt CEikLabel::HeightInPixels() const
   272     {
   272     {
   273     return(iMargin.iTop+iMargin.iBottom + iGapBetweenLines*(iNumberOfLines-1) + iNumberOfLines*iFont->HeightInPixels());
   273     return(iMargin.iTop+iMargin.iBottom + iGapBetweenLines*(iNumberOfLines-1) + iNumberOfLines*iFont->FontMaxHeight());
   274     }
   274     }
   275 
   275 
   276 TInt CEikLabel::WidthInPixels(TPtrC& aText) const
   276 TInt CEikLabel::WidthInPixels(TPtrC& aText) const
   277     {
   277     {
   278     TInt maxLineWidth=0;
   278     TInt maxLineWidth=0;
   401         gc.SetBrushStyle(iExtension->iBrushStyle);
   401         gc.SetBrushStyle(iExtension->iBrushStyle);
   402         }
   402         }
   403     
   403     
   404     const TRect rect = Rect();
   404     const TRect rect = Rect();
   405 
   405 
   406     const TInt deltaHeight=rect.Height()-HeightInPixels();
   406     const TInt deltaHeight=rect.Height() - HeightInPixels();
   407     TInt preHeight=iMargin.iTop; // used on first line
   407     TInt preHeight=iMargin.iTop; // used on first line
   408     TInt postHeight=iMargin.iBottom; // used on last line
   408     TInt postHeight=iMargin.iBottom; // used on last line
   409     if (deltaHeight>0)
   409     if (deltaHeight>0)
   410         {
   410         {
   411         switch(iAlignment.VAlignment())
   411         switch(iAlignment.VAlignment())
   435         textPaneTopToBaseline = layoutFont->TextPaneTopToBaseline();
   435         textPaneTopToBaseline = layoutFont->TextPaneTopToBaseline();
   436         textPaneHeight = layoutFont->TextPaneHeight();
   436         textPaneHeight = layoutFont->TextPaneHeight();
   437         }
   437         }
   438     else
   438     else
   439         {
   439         {
   440         textPaneTopToBaseline = iFont->AscentInPixels();
   440         textPaneTopToBaseline = iFont->FontMaxAscent();
   441         textPaneHeight = iFont->HeightInPixels();
   441         textPaneHeight = iFont->FontMaxHeight();
   442         }
   442         }
   443     
   443     
   444     // iGapBetweenLines is defined as baseline separation - CFont::HeightInPixels
   444     // iGapBetweenLines is defined as baseline separation - CFont::HeightInPixels
   445     // Since we are using the better metrics above, we have to actually use something which is 
   445     // Since we are using the better metrics above, we have to actually use something which is 
   446     // derived from iGapBetweenLines, but is e.g. reduced if textpaneheight > heightInPixels
   446     // derived from iGapBetweenLines, but is e.g. reduced if textpaneheight > heightInPixels
   447     TInt gapBetweenTextPanes( iGapBetweenLines - (textPaneHeight - iFont->HeightInPixels()) );
   447     TInt gapBetweenTextPanes( iGapBetweenLines - (textPaneHeight - iFont->FontMaxHeight() ) );
   448 
   448 
   449     FOREVER
   449     FOREVER
   450         {
   450         {
   451         TInt ascent=textPaneTopToBaseline+preHeight;
   451         TInt ascent=textPaneTopToBaseline+preHeight;
   452         TInt lineHeight=textPaneHeight+preHeight;
   452         TInt lineHeight=textPaneHeight+preHeight;