Feature Request: There should be a way to use and print RTF in a more advanced way (native?)

Hi,

i’m trying to handle a chemical formula since days now.

i’m realized that Xojo is really outdated in case of handling StyledText or RTF.

Without the use of Plugins (MBS) there is no way to open and save RTF with all of it’s possibilities.

So i’m struggling now to print the formula on a page of paper, because the only way to print is to use StyledTextprinter that is not supporting subscript.

This is a feature request! Please take a look at the StyledText and RTF handling and give us a more advanced solution!

Thank you!

<https://xojo.com/issue/46938>

Can you just draw the formula using a canvas or printing Graphics object?

I can print a canvas, but how i get the formula into it? The formula exists as RTFdataMBS in a Database

can you explain this with more details please?

do you mean:

Dim pic As New Picture(eingabe_formel.Width, eingabe_formel.Height, 32) eingabe_formel.DrawInto (pic.Graphics, 0, 0) g.DrawPicture pic,x,y

If StyledText won’t support some RTF features, but you can display them on the screen, there is another way : DrawInto.

Problem is, that method uses a resolution of 72 dpi only (144 on Retina), which is far from being as high as required by the printer.

When you use PrinterSetup, you get MaximumHorizontalResolution and MaxhimumVerticalResolution.
http://documentation.xojo.com/index.php/PrinterSetup
Usually, modern printers offer minimum 600 dpi.

The catch is to use a much larger version of the TextArea (divided by 72 and multiplied by 600), with every stylerun text size increased in the same proportion. Make the TextArea also large enough to display the text like you want it rendered in terms of line breaks, and long enough to show it all.

No need to worry about the underlying window, it works even if the TextArea is much bigger.

What I would do is use an invisible TextArea, and do something like this to draw it in the printer object

TextArea1.Visible = True TextArea1.DrawInto(g,100,100) TextArea1.visible = False

Finally, you must erase the border of the TextArea. This is obtained by drawing over it a white rectangle of about 3 pixels.

Tested on Mac, but I see no reason why it would not work on Windows.

Thanks, it looks like this is the easiest way to do that job