Fix text extent computation in wxMSW wxGraphicsContext.
The results were incorrect for italic or bold fonts as we hardcoded FontStyleRegular instead of using the real font style. Closes #14421. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -592,6 +592,7 @@ MSW:
|
|||||||
- Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
|
- Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
|
||||||
- Fix crash in wxTreeCtrl when calling GetSelection() from selection changed
|
- Fix crash in wxTreeCtrl when calling GetSelection() from selection changed
|
||||||
event handler under Vista and later (sbrowne).
|
event handler under Vista and later (sbrowne).
|
||||||
|
- Fix text extent computation in wxGraphicsContext (juria90).
|
||||||
|
|
||||||
OSX:
|
OSX:
|
||||||
|
|
||||||
|
@@ -1770,12 +1770,15 @@ void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDo
|
|||||||
|
|
||||||
REAL factorY = m_fontScaleRatio;
|
REAL factorY = m_fontScaleRatio;
|
||||||
|
|
||||||
REAL rDescent = ffamily.GetCellDescent(FontStyleRegular) *
|
// Notice that we must use the real font style or the results would be
|
||||||
f->GetSize() / ffamily.GetEmHeight(FontStyleRegular);
|
// incorrect for italic/bold fonts.
|
||||||
REAL rAscent = ffamily.GetCellAscent(FontStyleRegular) *
|
const INT style = f->GetStyle();
|
||||||
f->GetSize() / ffamily.GetEmHeight(FontStyleRegular);
|
REAL rDescent = ffamily.GetCellDescent(style) *
|
||||||
REAL rHeight = ffamily.GetLineSpacing(FontStyleRegular) *
|
f->GetSize() / ffamily.GetEmHeight(style);
|
||||||
f->GetSize() / ffamily.GetEmHeight(FontStyleRegular);
|
REAL rAscent = ffamily.GetCellAscent(style) *
|
||||||
|
f->GetSize() / ffamily.GetEmHeight(style);
|
||||||
|
REAL rHeight = ffamily.GetLineSpacing(style) *
|
||||||
|
f->GetSize() / ffamily.GetEmHeight(style);
|
||||||
|
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = rHeight * factorY;
|
*height = rHeight * factorY;
|
||||||
|
Reference in New Issue
Block a user