jrincayc / ucblogo-code

Berkeley Logo interpreter
https://people.eecs.berkeley.edu/~bh/logo.html
GNU General Public License v3.0
182 stars 34 forks source link

Issue 126: Print preview on Windows #128

Closed dmalec closed 2 years ago

dmalec commented 2 years ago

Resolves #126

Summary

This was an interesting bug as there were a few challenges in getting print preview to work on Windows which are Windows specific:

  1. The problem that was originally reported seems to be caused by not passing a parent frame to the wxHtmlEasyPrinting constructor.
  2. With that resolved, the preview was blank and I noticed the turtle graphics preview was also blank. Allowing the event loop to also process idle events appears to resolve this.
  3. After a turtle graphics preview (even prior to this change), the key event handling doesn't seem to be properly restored to the terminal. This appears to be resolved by using the logo frame as the parent of the turtle graphics preview.

The final challenge is that the way the text is passed in to the preview appears to cause some rendering problems for all platforms. In the case of Windows, it's particularly dramatic:

Screen Shot 2022-06-18 at 12 32 50 PM

On Linux and OSX, it seems to be limited to spacing problems: Screen Shot 2022-06-18 at 2 30 41 PM

This was resolved by fixing the closing tags on the HTML and replacing space characters with  : Screen Shot 2022-06-18 at 3 01 04 PM

Test Environments

OSX Catalina (10.15.7) w/ wxWidgets 3.0.5 Ubuntu Bionic (18.04.5) w/ wxWidgets 3.0.5
 Windows 10 Pro (19043.1766) w/ wxWidgets 3.0.5