Print a thin rectangle with RectShape and borderWidth<1.0

I can not draw rectangles “thin” to the printer.
In the doc “borderWidth” accepts value <1.0, but not effect.

Whatever borderwidth value (0.1 to 1.0) is identical rendering :
Example

[quote=174779:@Benoit Griveau]I can not draw rectangles “thin” to the printer.
In the doc “borderWidth” accepts value <1.0, but not effect.

Whatever borderwidth value (0.1 to 1.0) is identical rendering :
Example[/quote]

The trick is to use PrinterSetup.MaxHorizontalResolution and MaxVerticalResolution so the printed pixel becomes smaller than 1 point (the default). With a resolution of for instance 300 dots per inch, the thinest rectangle could be 1/300th of an inch (0.08 mm). You got to modify the size of your recantgle accordingly, otherwise it will appear smaller.

http://documentation.xojo.com/index.php/PrinterSetup

Thanks.
But it’s complex and this has no effect on the screen (Retina).

How can you draw a fractional line width on a pixelated screen…
On a non-retina screen 1pixel is smallest visible element, on retina it is 1 point (1/2 pixel width),

[quote=174819:@Benoit Griveau]Thanks.
But it’s complex and this has no effect on the screen (Retina).[/quote]

You said printer. Printing is inherently complex, even if Xojo abstracts a lot of it.

As for the screen you said nothing about in your original post, although Retina does indeed use two pixels for one point and would allow a half point line, it is not that simple : Xojo does not have Retina support. You need to use the Retina Kit from Ohanaware.com, or some probably rather complex declare.

I agree with your comments on screen.
@michel : for the printer MaxHorizontalResolution=-1 works, but it would be more practical than “BorderWidth” runs directly (to print high resolution text that is not useful).

[quote=174828:@Benoit Griveau]I agree with your comments on screen.
@michel : for the printer MaxHorizontalResolution=-1 works, but it would be more practical than “BorderWidth” runs directly (to print high resolution text that is not useful).[/quote]

Indeed if Xojo brought yet another level of abstraction in which it would deal transparently cross platform with the gazillion printers around, to manage fractional point precision to printing when the printer resolution exceeds 72 dots per an inch. Unfortunately that is not the case at the moment.

Thankfully, with a bit of effort, we can do it ourselves.

I use also DrawString, DrawRect, Drawpicture : ok i can modify size.
But with DrawBlock ? (StyledTextPrinter)…

[quote=174833:@Benoit Griveau]I use also DrawString, DrawRect, Drawpicture : ok i can modify size.
But with DrawBlock ? (StyledTextPrinter)…[/quote]

I ran into that a couple days ago. Drawblock simply does not size with resolution. The best workaround I found was to copy RTFData to an invisible TextArea, then iterate through all the stylerun, set SelStart and Sellenght to each, and change it’s SelTextSize by the needed factor. Then DrawBlock from that invisible TextArea.

I understand, but many complications!
Thanks!

Printing is never simple. It used to be even worse a few years ago. Think about it : before Mac OS X and Windows, programmers needed to address the printer using its own code ; in fact learn a brand new computer language, just to print graphics. Some old timers may probably tell horror stories about HPGL…

StyledTextPrinter is a wonderful piece of abstraction that spares the need to print every stylerun separately, as one would need to do with DrawString.

Now it is not perfect (perfection is not of this world). I need to change the line spacing. I tried using RTF code to change the line spacing within the TextArea but it is not supported. So I just created a routine where I print each line separately to be able to position them apart vertically by a set value.

I guess I enjoy working around limitations, the way some chess players do calculating moves.