Don't return invalid pixel size from GetPixelSize() under wxQt
This commit is contained in:
parent
2f6052e337
commit
ec1763d3a9
1 changed files with 13 additions and 1 deletions
|
|
@ -394,7 +394,19 @@ double wxNativeFontInfo::GetFractionalPointSize() const
|
|||
|
||||
wxSize wxNativeFontInfo::GetPixelSize() const
|
||||
{
|
||||
return wxSize(0, m_qtFont.pixelSize());
|
||||
// Note that QFont::pixelSize() returns -1 if the size was set with setPointSize().
|
||||
// If so, fall back to QFontInfo::pixelSize() which returns the pixel size of the
|
||||
// matched window system font.
|
||||
|
||||
int pixelSize = m_qtFont.pixelSize();
|
||||
|
||||
if ( pixelSize < 0 )
|
||||
{
|
||||
QFontInfo fontInfo(m_qtFont);
|
||||
pixelSize = fontInfo.pixelSize();
|
||||
}
|
||||
|
||||
return wxSize(0, pixelSize);
|
||||
}
|
||||
|
||||
wxFontStyle wxNativeFontInfo::GetStyle() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue