possible bug in GraphicsContext.DrawText

First of all, I can’t seem to find where I can file a bug/ticket/tracker/jira/etc for this project. If someone can point me in that direction, I’ll be happy to do that. In the meantime, please accept my apologies if this isn’t the appropriate place to send this information.

I’m experiencing a rendering problem with GraphicsContext.DrawText. I’ve created a relatively simple test case illustrating the problem which I’ve attached here. I’ve also included a dropbox link below in case the attachment get stripped.

https://www.dropbox.com/s/zzlrwvbqpb76i4u/phoenix_drawtext_bug.zip?dl=0

The problem I’m experiencing is this:

As the line of text being rendered gets longer, the background that’s painted and the dimensions being returned by GraphicsContext.GetTextExtent() are wider than the actual text rendered.

Another thing I noticed, which I didn’t included in the code demo above, is as the length of text being drawn increases, you can observe letters that start off with a bit more spacing between them will get packed together.

It looks like it might be a floating point / rounding issue.

I can work around the problem by rendering characters independently, but that’s a performance hit I don’t want to take if I don’t have to.

Just in case this is a video driver or screen DPI kind of issue and you have difficult reproducing it, I have also attached a screenshot.

https://www.dropbox.com/s/z6h5l4daem6x0hd/screenshot.png?dl=0

I’m running on Windows 10, screen resolution is 1820x1026, Desktop DPI scaling is set to 125%, video card is a NVIDIA GeForce GTX 970 with the latest drivers.

I just updated Phoenix to make sure it hasn’t already been fixed:

D:\cvs\teledigm\teledigm>pip install --upgrade --trusted-host wxpython.org --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix

Collecting wxPython_Phoenix

Downloading http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2163+2b688df-cp35-cp35m-win32.whl (11.8MB)

100% |################################| 11.8MB 3.3MB/s

Installing collected packages: wxPython-Phoenix

Found existing installation: wxPython-Phoenix 3.0.3.dev2158+4d05434

Uninstalling wxPython-Phoenix-3.0.3.dev2158+4d05434:

Successfully uninstalled wxPython-Phoenix-3.0.3.dev2158+4d05434

Successfully installed wxPython-Phoenix-3.0.3.dev2163+2b688df

I also ran this on my desktop at the office and it is experiencing the same thing.

It is also Windows 10, 1920x1080, DPI scaling is 100%. Video card is an AMD Radeon HD 6900 Series that hasn’t had it’s drivers updated in a while.

I just updated that computer from wxPython-Phoenix-3.0.3.dev1964+f780b21 to wxPython-Phoenix-3.0.3.dev2163+2b688df, exists in both places.

wxPython 3.0 (non-phoenix) also seems to have this same problem.

Please forgive me, I don’t have the time to setup a C++ environment to confirm that this may be a bug in native wxWidgets and not the Python wrapper.

phoenix_drawtext_bug.zip (965 Bytes)

screenshot.png

I seem to have narrowed it down to something to do with the GraphicsContext. If I don’t create a GraphicsContext and just use the DC functions then I don’t experience the problem.

···

On Saturday, June 18, 2016 at 4:24:17 PM UTC-5, Royce Mitchell III wrote:

First of all, I can’t seem to find where I can file a bug/ticket/tracker/jira/etc for this project. If someone can point me in that direction, I’ll be happy to do that. In the meantime, please accept my apologies if this isn’t the appropriate place to send this information.

I’m experiencing a rendering problem with GraphicsContext.DrawText. I’ve created a relatively simple test case illustrating the problem which I’ve attached here. I’ve also included a dropbox link below in case the attachment get stripped.

https://www.dropbox.com/s/zzlrwvbqpb76i4u/phoenix_drawtext_bug.zip?dl=0

The problem I’m experiencing is this:

As the line of text being rendered gets longer, the background that’s painted and the dimensions being returned by GraphicsContext.GetTextExtent() are wider than the actual text rendered.

Another thing I noticed, which I didn’t included in the code demo above, is as the length of text being drawn increases, you can observe letters that start off with a bit more spacing between them will get packed together.

It looks like it might be a floating point / rounding issue.

I can work around the problem by rendering characters independently, but that’s a performance hit I don’t want to take if I don’t have to.

Just in case this is a video driver or screen DPI kind of issue and you have difficult reproducing it, I have also attached a screenshot.

https://www.dropbox.com/s/z6h5l4daem6x0hd/screenshot.png?dl=0

I’m running on Windows 10, screen resolution is 1820x1026, Desktop DPI scaling is set to 125%, video card is a NVIDIA GeForce GTX 970 with the latest drivers.

I just updated Phoenix to make sure it hasn’t already been fixed:

D:\cvs\teledigm\teledigm>pip install --upgrade --trusted-host wxpython.org --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix

Collecting wxPython_Phoenix

Downloading http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev2163+2b688df-cp35-cp35m-win32.whl (11.8MB)

100% |################################| 11.8MB 3.3MB/s

Installing collected packages: wxPython-Phoenix

Found existing installation: wxPython-Phoenix 3.0.3.dev2158+4d05434

Uninstalling wxPython-Phoenix-3.0.3.dev2158+4d05434:

Successfully uninstalled wxPython-Phoenix-3.0.3.dev2158+4d05434

Successfully installed wxPython-Phoenix-3.0.3.dev2163+2b688df

I also ran this on my desktop at the office and it is experiencing the same thing.

It is also Windows 10, 1920x1080, DPI scaling is 100%. Video card is an AMD Radeon HD 6900 Series that hasn’t had it’s drivers updated in a while.

I just updated that computer from wxPython-Phoenix-3.0.3.dev1964+f780b21 to wxPython-Phoenix-3.0.3.dev2163+2b688df, exists in both places.

wxPython 3.0 (non-phoenix) also seems to have this same problem.

Please forgive me, I don’t have the time to setup a C++ environment to confirm that this may be a bug in native wxWidgets and not the Python wrapper.