As can be seen in the printing sample, the print preview is too small at 200% DPI scaling.
If running the sample DPI unaware and DPI aware, the preview should have the same size on the screen in both cases.
But currently, in case of DPI awareness, the preview is too small by the DPI scaling factor.
print-preview-DPI-unaware-vs-aware.png (view on web)
It seems that the size of wxPreviewFrame
can be easily fixed as follows
diff --git "a/src/common/prntbase.cpp" "b/src/common/prntbase.cpp" index 408c4b6336..54b12ea20b 100644 --- "a/src/common/prntbase.cpp" +++ "b/src/common/prntbase.cpp" @@ -940,7 +940,7 @@ wxScrolledWindow(parent, wxID_ANY, pos, size, style | wxFULL_REPAINT_ON_RESIZE, // Use some reasonable default size for this window, roughly proportional // to the paper sheet. - SetInitialSize(wxSize(600, 750)); + SetInitialSize(FromDIP(wxSize(600, 750))); } wxPreviewCanvas::~wxPreviewCanvas()
print-preview-DPI-unaware-vs-aware-with-patched-frame.png (view on web)
but I have no idea how to fix the size of its content (the preview of the page).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
See dsa-t@c9cfb7f
Not tested on other operating systems.
I noticed that window sizing can be wrong when moving between screens for some reason (unrelated bug).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I can confirm that with your changes it looks correct with wxMSW.
But your changes have side effects with wxGTK, where the preview of the page becomes too large on a high-resolution monitor (at 200% scaling).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The changes (backported to 3.2.5) also cause my actual application with wxGTK to crash.
Call stack:
#0 0x7ffff734a384 cairo_translate() (/lib/x86_64-linux-gnu/libcairo.so.2:??)
#1 0x7ffff7765eb1 ???() (/lib/x86_64-linux-gnu/libgtk-3.so.0:??)
#2 0x7ffff7604388 gtk_main_do_event() (/lib/x86_64-linux-gnu/libgtk-3.so.0:??)
#3 0x7ffff7c62407 ???() (/lib/x86_64-linux-gnu/libgdk-3.so.0:??)
#4 0x7ffff7c74769 ???() (/lib/x86_64-linux-gnu/libgdk-3.so.0:??)
#5 0x7ffff7c78e35 ???() (/lib/x86_64-linux-gnu/libgdk-3.so.0:??)
#6 0x7ffff7c79041 ???() (/lib/x86_64-linux-gnu/libgdk-3.so.0:??)
#7 0x1a465c5 wxWindow::Update(this=0x3582e40) (./src/gtk/window.cpp:5339)
#8 0x1a6df34 wxStatusBar::DoUpdateStatusText(this=0x3582e40, number=0) (./src/generic/statusbr.cpp:166)
#9 0x1b8b077 wxStatusBarBase::SetStatusText(this=0x3582e40, text=..., number=0) (./src/common/statbar.cpp:262)
#10 0x1b054d0 wxFrameBase::SetStatusText(this=0x3b23dd0, text=..., number=0) (./src/common/framecmn.cpp:409)
#11 0x1b73f33 wxPrintPreviewBase::RenderPage(this=0x38726f0, pageNum=1) (./src/common/prntbase.cpp:2137)
#12 0x1b73026 wxPrintPreviewBase::UpdatePageRendering(this=0x38726f0) (./src/common/prntbase.cpp:2003)
#13 0x1b74981 wxPrintPreview::UpdatePageRendering(this=0x387d0a0) (./src/common/prntbase.cpp:2290)
#14 0x1b6f111 wxPreviewCanvas::OnPaint(this=0x3a8c380) (./src/common/prntbase.cpp:952)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.