javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtlabel.cpp
branchRCL_3
changeset 23 e5618cc85d74
parent 17 0fd27995241b
child 24 6c158198356e
equal deleted inserted replaced
21:4376525cdefb 23:e5618cc85d74
   481     }
   481     }
   482 
   482 
   483     const CFont* font = iEikLabel->Font();
   483     const CFont* font = iEikLabel->Font();
   484 
   484 
   485     // Estimate how many text rows within given rectangle
   485     // Estimate how many text rows within given rectangle
   486     // Use HeightInPixels same as MinimumHeight
   486     TInt textPaneHeight = GetFontHeight(font);
   487     TInt textPaneHeight = font->HeightInPixels();
       
   488     const TInt gap = iEikLabel->PixelGapBetweenLines();
   487     const TInt gap = iEikLabel->PixelGapBetweenLines();
   489 
   488 
   490     // The last row in label does not add a gap after it. So...
   489     // The last row in label does not add a gap after it. So...
   491     // aHHint = rows * textPaneHeight + (rows - 1) * gap; and therefore...
   490     // aHHint = rows * textPaneHeight + (rows - 1) * gap; and therefore...
   492     TInt rows = (aHHint + gap) / (textPaneHeight + gap);
   491     TInt rows = (aHHint + gap) / (textPaneHeight + gap);
   618 
   617 
   619     // Compared to CEikLabel's MinimumHeight() we add one more gap.
   618     // Compared to CEikLabel's MinimumHeight() we add one more gap.
   620     // This is to fix some fonts getting clipped from above.
   619     // This is to fix some fonts getting clipped from above.
   621     // Do not change this ever, as wrapping will surely brake.
   620     // Do not change this ever, as wrapping will surely brake.
   622     return aLineCount * iEikLabel->PixelGapBetweenLines()
   621     return aLineCount * iEikLabel->PixelGapBetweenLines()
   623            + aLineCount * iEikLabel->Font()->HeightInPixels();
   622            + aLineCount * GetFontHeight(iEikLabel->Font());
   624 }
   623 }
   625 
   624 
   626 // ---------------------------------------------------------------------------
   625 // ---------------------------------------------------------------------------
   627 // CSwtLabel::DoSetFontL
   626 // CSwtLabel::DoSetFontL
   628 // ---------------------------------------------------------------------------
   627 // ---------------------------------------------------------------------------
   644         // This is to fix some fonts getting to much space after last line.
   643         // This is to fix some fonts getting to much space after last line.
   645         iEikLabel->iMargin.iTop = aFont->FontMaxDescent();
   644         iEikLabel->iMargin.iTop = aFont->FontMaxDescent();
   646 
   645 
   647         TRAP_IGNORE(ClipTextL(iEikLabel->Size().iWidth));
   646         TRAP_IGNORE(ClipTextL(iEikLabel->Size().iWidth));
   648     }
   647     }
       
   648 }
       
   649 
       
   650 // ---------------------------------------------------------------------------
       
   651 // CSwtLabel::GetFontHeight
       
   652 // ---------------------------------------------------------------------------
       
   653 //
       
   654 TInt CSwtLabel::GetFontHeight(const CFont* aFont) const
       
   655 {
       
   656     if (!aFont)
       
   657     {
       
   658         return 0;
       
   659     }
       
   660 
       
   661 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   662     return aFont->FontMaxHeight();
       
   663 #else
       
   664     return aFont->HeightInPixels();
       
   665 #endif
   649 }
   666 }
   650 
   667 
   651 // ---------------------------------------------------------------------------
   668 // ---------------------------------------------------------------------------
   652 // CSwtLabel::Draw
   669 // CSwtLabel::Draw
   653 // From CCoeControl
   670 // From CCoeControl