taviso / wpunix

WordPerfect for UNIX Character Terminals
603 stars 17 forks source link

WSL: minor screen corruption in Print Preview #40

Open emendelson opened 1 year ago

emendelson commented 1 year ago

I think @taviso and I talked about this in private, but I hope it won't hurt to file it as an issue.

Under WSL with Ubuntu, opening wp with xterm, Shift+F7, View Document produces this minor screen corruption:

Screenshot 2023-03-20 111042

Pressing Shift+F3 twice corrects it to the way it looks under real Linux:

Screenshot 2023-03-20 111120

Is there any possibility of either fixing this minor problem in the code or, under WSL, inserting two Shift+F3 keystrokes when switching to any graphic mode (equation, image editor, view document)?

taviso commented 1 year ago

It's hard to say where the bug is, I can't reproduce it on Linux or Windows 10 with VcxSrv.

If you run this command, how does it look?

$ convert -size 1000x32 -font Courier -pointsize 32 -fill white -annotate +0+24 "this is a test" canvas:black sixel:-

It should just be a black bar with the white text "this is a test". If that doesn't work either, then I'm thinking it's a WSLg bug.

Does it work if you set a black background in XTerm? I guess that might mean the BCE (Background Color Erase) isn't working.

emendelson commented 1 year ago

Apologies for taking so long to reply to this - I was a away from my Windows machine.

First, your guess in the last paragraph was right. There is no problem if I set a black background and white foreground in Xterm. Print preview works correctly. The problem exists in a mild form if I set a blue background: some artifacts appear in the line where the corruption appears in the screen shot above, and they clear up if I press Shift+F3 twice, as in the white-on-black setup.

Ignorant question coming: When you say that BCE isn't working, are you talking about Xterm under WSL or WP?

I tried running the convert command, but it isn't installed on my WSL setup. Ubuntu seems to be telling me to install imagemagick: is that what you had in mind? I installed imagemagick, and tried that command but got the error message unable to read font 'Courier' etc. I tried fonts that I know are installed, with the same result.

taviso commented 1 year ago

I'm not sure, XTerm supports BCE and WP uses it - if that was the problem I would have to think about how to workaround it! There are alternative ways to achieve the same thing, but I would be reluctant to turn it off to workaround a Windows bug.... I'd have to think about it!

Yes, convert is part of ImageMagick - you can get a list of fonts fontconfig knows about using fc-list. I don't think it will know about any Windows fonts if that's what you mean, but maybe if you do ln -s /mnt/c/Windows/Fonts ~/.fonts it will work! (just a guess).

(Note: that command assumes you don't already have a ~/.fonts directory you want).

emendelson commented 1 year ago

Well, I finally figured out that I'm supposed to run the convert command in xterm, not at the WSL command line, and I did, I couldn't get it to work with Courier, so I ran fc-list and couldn't get the convert command to work with any font that had a space in its name (it didn't work to put the name in quotation marks). So I found a font that had no space in its name, C-059-Bold and ran the command - and yes, it did produce a black bar with white text:

Screenshot 2023-03-26 165423

Does this help to narrow things down?

EDIT: Actually, the command seems only to work with OTF fonts, not TTF or Type 1 - at least that's the only consistent thing I can see when experimenting...