I'm trying to implement printing using the wxPython printing framework.
I'm expanding the example in wxPIA (Chapter 17) by adding word-wrapping
based on Robin's code in wx.lib.wordwrap.
How does wx.DC.SetUserScale work? From what I've read it looks like it
is supposed to change the relationship between logical pixels and device
pixels. I assume that a scale of 0.5 would mean that one device pixel
correspond to 2 logical pixels. At least this is what I infer from the
wxPIA code. I could make a logical argument that a scale factor of 0.5
would mean that one device pixel corresponds to 0.5 logical pixels.
The help file for wxWidgets just says:
"Sets the user scaling factor, useful for applications which require
'zooming'."
In "Cross-Platform GUI Programming with wxWidgets," it just says that a
scale of 1.0 means that device and logical pixels are the same.
So could someone clarify this for me?
Secondly, shouldn't scaling affect wx.DC.GetPartialTextExtents? I ran a
test where did dc.SetFont(x) and got the results from
GetPartialTextExtents for a string. I then called
dc.SetUserScale(0.5,0.5). I called GetPartialTextExtents with the same
string. I would have expected the numbers to due to the change in scale,
but the values were the same.
How is text rendered when device context scaling is in effect? If have
a scale factor of, say 0.5 and chose a 10 point font, does it render a 5
point font? If the scaling results in a non-intregal font size (say
6.6667 points), does it render at that size or is the font size
rounded/truncated to an integral value? The reason I ask is I thought I
had my print preview working, but as I changed scale, the length of the
text drifted around as I changed the preview magnification. For
example, I disabled the clipping rectangle and observed where the page
edge intersected the text. As I changed the magnification percentage,
the intersection of the page edge and the text would move from the right
side of a character to the left side of the same character, or maybe one
character right or left.
Any help would be appreciated. I really thought I understood this
stuff, but things aren't behaving the way I expected.
I'm trying to implement printing using the wxPython printing framework.
I'm expanding the example in wxPIA (Chapter 17) by adding word-wrapping
based on Robin's code in wx.lib.wordwrap.
How does wx.DC.SetUserScale work? From what I've read it looks like it
is supposed to change the relationship between logical pixels and device
pixels. I assume that a scale of 0.5 would mean that one device pixel
correspond to 2 logical pixels. At least this is what I infer from the
wxPIA code. I could make a logical argument that a scale factor of 0.5
would mean that one device pixel corresponds to 0.5 logical pixels.
The help file for wxWidgets just says:
"Sets the user scaling factor, useful for applications which require
'zooming'."
In "Cross-Platform GUI Programming with wxWidgets," it just says that a
scale of 1.0 means that device and logical pixels are the same.
I think so. In fact it does on Windows, but not wxGTK or wxMac. GetTextExtent is also adjusted on Windows but not the other platforms. Please create a bug report that describes these platform differences.
How is text rendered when device context scaling is in effect? If have
a scale factor of, say 0.5 and chose a 10 point font, does it render a 5
point font? If the scaling results in a non-intregal font size (say
6.6667 points), does it render at that size or is the font size
rounded/truncated to an integral value?
Everything is rounded/truncated. That will change with wx.GraphicsContext, but it doesn't support printing yet.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I guess I can't figure out SourceForge. I go to wxPython.org and click
on Report a Bug. I fill out the information and submit the bug report.
It tells me I have to log in. So I create a SF account, activate the
account and log in, but I can't get back to the page where I entered the
bug information to submit.
···
On Tue, 2008-03-11 at 16:01 -0700, Robin Dunn wrote:
I think so. In fact it does on Windows, but not wxGTK or wxMac.
GetTextExtent is also adjusted on Windows but not the other
platforms.
Please create a bug report that describes these platform differences.
On Tue, 2008-03-11 at 16:01 -0700, Robin Dunn wrote:
I think so. In fact it does on Windows, but not wxGTK or wxMac. GetTextExtent is also adjusted on Windows but not the other
platforms. Please create a bug report that describes these platform differences.
I guess I can't figure out SourceForge. I go to wxPython.org and click
on Report a Bug. I fill out the information and submit the bug report.
It tells me I have to log in. So I create a SF account, activate the
account and log in, but I can't get back to the page where I entered the
bug information to submit.