PCL5 Word Wrap

The word-wrap provided by ^[&s0C is really a character wrap as you know. Note: I'm going to use ^[ to represent the escape character here.

The only idea I have ever had to do a real word wrap is to define each word in a macro then play back the macros: forward invisible, then backwards invisible, then forwards visible. e.g. "Happy daze" would become

^[&fyXHappy ^[&f1X^[*vo1T^[&f2X^[&a180P^[&f2X^[*v1oT^[&a0P^[&f2X^[&fyXdaze ^[&f1X^[*vo1T^[&f2X^[&a180P^[&f2X^[*v1oT^[&a0P^[&f2X

You could compress that a bit by having a macro that did the play back:

^[&f1yX^[*vo1T^[&fy2X^[&a180P^[&f2X^[*v1oT^[&a0P^[&f2X^[&f1X

Then the text would be:

^[&fyXHappy ^[&f1x1y2X^[&fyXdaze ^[&f1x1y2X

The only advantage of this is that it doesn't matter what font size you print in. The printer will automatically wrap the text for you between the left and right margins. If you know how wide each character will be in advance (i.e. you know the font, and the width table for each letter in your string) then it would be much better to just insert a carriage return and line feed at the appropriate place.

Comments:

See also: