From e2a846e1822f1104f8b083638c30206827ef7480 Mon Sep 17 00:00:00 2001 From: David Vanderson Date: Mon, 8 Aug 2016 14:03:12 +0200 Subject: [PATCH] Fix correct screen DPI and not hard-coded 72 in wxOSX Don't hard-code screen DPI as 72, use the real number instead (which is now returned correctly, after the last commit). Closes #17615. --- docs/changes.txt | 2 +- src/osx/core/printmac.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5a49e023ef..f08b98f8d5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -120,7 +120,7 @@ wxMSW: wxOSX: - Fix handling of non-BMP characters in GetPartialTextExtents() (ARATA Mizuki). -- Implement wxGetDisplaySizeMM() correctly (David Vanderson). +- Implement wxGetDisplaySizeMM() and fix printing DPI (David Vanderson). - Remove extra borders around wxFilePickerCtrl (John Roberts). - Set up extensions filter correctly in wxFileDialog (nick863). - Turn off automatic quotes substitutions in wxTextCtrl (Xlord2). diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index b6c1eb625f..9bc7f7fccf 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -585,8 +585,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) return false; } - // on the mac we have always pixels as addressing mode with 72 dpi - printout->SetPPIScreen(72, 72); + printout->SetPPIScreen(wxGetDisplayPPI()); PMResolution res; PMPrinter printer; @@ -764,10 +763,9 @@ void wxMacPrintPreview::DetermineScaling(void) int screenWidth , screenHeight ; wxDisplaySize( &screenWidth , &screenHeight ) ; - wxSize ppiScreen( 72 , 72 ) ; + wxSize ppiScreen = wxGetDisplayPPI(); wxSize ppiPrinter( 72 , 72 ) ; - // Note that with Leopard, screen dpi=72 is no longer a given m_previewPrintout->SetPPIScreen( ppiScreen.x , ppiScreen.y ) ; wxCoord w , h ;