Don't call Font::GetSize() and FontFamily::GetEmHeight() thrice, just do it
once and store the results. This makes the code both simpler and shorter and
marginally more efficient.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71822
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Notice that we must use the real font style or the results would be
// incorrect for italic/bold fonts.
const INT style = f->GetStyle();
// Notice that we must use the real font style or the results would be
// incorrect for italic/bold fonts.
const INT style = f->GetStyle();
- REAL rDescent = ffamily.GetCellDescent(style) *
- f->GetSize() / ffamily.GetEmHeight(style);
- REAL rAscent = ffamily.GetCellAscent(style) *
- f->GetSize() / ffamily.GetEmHeight(style);
- REAL rHeight = ffamily.GetLineSpacing(style) *
- f->GetSize() / ffamily.GetEmHeight(style);
+ const REAL size = f->GetSize();
+ const REAL emHeight = ffamily.GetEmHeight(style);
+ REAL rDescent = ffamily.GetCellDescent(style) * size / emHeight;
+ REAL rAscent = ffamily.GetCellAscent(style) * size / emHeight;
+ REAL rHeight = ffamily.GetLineSpacing(style) * size / emHeight;
if ( height )
*height = rHeight * factorY;
if ( height )
*height = rHeight * factorY;