StyledTextPrinter seems broken in Windows with 2018r4

Is it me, or is StyledTextPrinter completely broken under Windows with Xojo 2018r4?

Either nothing prints to a canvas, or it intermittently disappears.

This has been working for years, now nothing.

I’ve filed bug report 55299, with an attached demo project.

Apiece of code may help to give an answer.

Do your code comply with the g removal in 2018r4 ? (read the release notes for details).

Sure…

Throw a Canvas and a TextArea on a window then put this code in the Canvas Paint Event:

dim stp as StyledTextPrinter stp=TextArea1.styledTextPrinter(g, TextArea1.Width) stp.DrawBlock 0, 0 , TextArea1.Width

Type some text in the TextArea then resize the window.

Run in Mac and Windows. See anything in Windows?

stp.DrawBlock  0, 0 , TextArea1.Width

where is the HEIGHT paramenter?

The third parameter is the height parameter. I should have typed TextArea1.height, but it works anyway as long as it’s a number larger than the text height.

You could also just do:

stp.DrawBlock  0, 0 ,100

Point is, it all works fine for me in Mac, not in Windows.

StyledTextPrinter stopped working properly on Windows with the switch to DirectWrite/Direct2D in 2016r4. I’m not sure if this is something we will be able to fix.

Related: <https://xojo.com/issue/49287>

In the meantime, I’ve updated the docs to indicate it does not work on Windows.

Wouldn’t it be more helpful to show him how to do it in a different way? Just as an idea?

Or can it not be done in Xojo?

Xojo needs to fix this. It’s a bug in an important feature. Changing the docs doesn’t make it go away.

[quote=430377:@Markus Winter]
Wouldn’t it be more helpful to show him how to do it in a different way? Just as an idea?

Or can it not be done in Xojo?[/quote]
You can duplicate this by going thru each StyleRun and using DrawString… it can be a bit complicated, but it can be done… Somewhere around here I think I have a method to do just that… but I’d have to find it