in reply to Formatting Printed column output with variable width Fonts
Since the write() method allows you to specify the starting point of a string, *don't* join the lines. Instead, chop your postcard into two blocks, one for the message, and one for the address. Then write all your message lines in the message box, and write the address to the address box. That way, you can control your left margin without worrying about tabs, blanks, etc.
You might write a sub to write a block of text, something like this (*untested*):
--roboticus# Write message write_text($dc, 1.0, 1.0, 0.2, "Anonymous Monk--", "Am in Hell, having a terrible time.", "Wish *you* were here! (Ha, ha!)", "--roboticus" ); # Where to send it! write_text($dc, 4.0, 2.5, 0.25, "Anonymous Monk", "11 Two-bit lane", "Cyberspace, 11010-0101" ); sub write_text { my $hPrt = shift; my $Left = shift; my $Top = shift; my $NL = shift; for (@_) { $hPrt->write($_, $Left, $Top); $Top += $NL; } }
|
|---|