Future of StyledTextPrinter?

Does Xojo have any plans for StyledTextPrinter functionality on Windows?

Several of my apps use StyledTextPrinter which means that I cannot move beyond version 2020r2.1. Converting the apps to output PDF is not an option in a few cases so I now have no way to print styled text.

Feedback report 63415 states that the issue has been “Fixed” by updating the documentation to indicate StyledTextPrinter is not available on Windows but that doesn’t solve the problem of not having the functionality or a suitable replacement.

I’ve filed a Feature Request in Feedback urging the functionality be restored in Windows.

Feedback Request 64529

2 Likes

Hi Dale. I’m completely surprised a feature was removed from Xojo without an alternative. I just spent the last month changing my primary product to the new API and now to be hit with this. It’s a bit sole destroying… :frowning:

1 Like

Chris: t is not the first one (to be remove from Xojo, silently or not) and this is common in our industry.

“I have to release, I remove this incomplete (or broken) feature, I will add it back later”…
Sometimes later become… never. Sometimes it comes n the following release.

1 Like

You can always print PDF with MBS Xojo DynaPDF Plugin and of course also use it to create PDF on the fly.

We can draw styled text from Xojo into PDF pages.

When the FTC is finally put out as open source, all of it or components of it can be used to create a styled text solution. Xojo could also import it and make it available as generalized text view in the IDE. The solution is there in the FTC.

Dr. Brian Gaines, who purchased FTC and open-sourced it, gave me permission to host it on Github recently. You can find the repository here: GitHub - atomiccity/FormattedTextControl: The Formatted Text Control for Xojo

I have a class which should allow you to emulate StyledTextPrinter. Is anybody interested?

Note, in the repository notes it says Bob Keeney created it. Actually, I originally wrote the FTC and then sold it to Bob later on.

Sorry, @Brendan_Murphy. I was worried I’d leave someone out because I only know the most recent history. I’ll update the notes. Thank you for the wonderful control!

Hi Keving - Is it open source or are you licensing this?

-Thnaks

I’ll probably attach some kind of license to it but it would be free of charge.

It’s code I wrote a while back to split text areas up so that I could draw them to a graphics context.

I did a quick test today implementing the StyledTextPrinter’s DrawBlock / EOF commands and it seems to work when drawing to a non printer graphics context so I assume it will work for a printer graphics context.

My replacement extends a text area subclass which means that you need to have a non visible instance of it on a window.

It would also require you to tweak your code as you need to call one method to calculate the data and then calls to draw the block(s).

I imagine I would have to create some kind of demo project but that shouldn’t be too hard.

1 Like

Very good :slight_smile: Any hep you can offer would be very appreciated - Thanks Keving

You can download it from here:

If it doesn’t work 100% i’m sure you can probably tweak it.

Kev.

2 Likes

Thanks very much. I’ll let you know how it goes

Thanks for making it available. I’ll take a look at it, too.

I haven’t looked into your code too closely but there does seem to be a problem with calculating the StyleRuns. I added the following code to your demo app’s Open event handler:

Dim start, ending, lngth As Integer

start = TextArea1.StyledText.Paragraph(3).StartPosition
ending = TextArea1.StyledText.Paragraph(3).EndPosition
lngth = ending - start
TextArea1.StyledText.TextColor(start, lngth) = Color.Green

I expected the third paragraph to show in green, and it did. But so did part of the first paragraph.


Do you have any suggestions as to what’s happening?

I would have to debug the code. What happens if you set a different property on that paragraph rather than the text colour?

I changed the

TextArea1.StyledText.TextColor(start, lngth) = Color.Green`

to

TextArea1.StyledText.Size(start, lngth) = 28

and below is the result.

New version which addresses a problem when parsing style run ranges.

1 Like

Hi Kevin. Thank you very much for posting this solution. I tried to get it to work but could only get so far (I expect an issue on my side). I found another work-around for the specific issue that was holding me up, so I went with that. Thanks again for your generosity with this. - Chris