text rotation macro for receipts/slips collab/phasefx/rotated_receipt_text
authorJason Etheridge <jason@esilibrary.com>
Mon, 14 May 2012 16:14:30 +0000 (12:14 -0400)
committerJason Etheridge <jason@esilibrary.com>
Mon, 14 May 2012 16:31:53 +0000 (12:31 -0400)
commit65cf372b67a0a7e6633af02317ae40fabf4b6d2d
tree9093d4b3cdcbcbb9929540d4af7f9a82ba7bba83
parenta4561f581eb54c088afb95d8758dd849d6f3d69e
text rotation macro for receipts/slips

%ROTATE(degrees)%
%ROTATE(degrees,'extra CSS')%
%ROTATE_END%

Degrees is an integer, but typically you'd use values like 90, -90, 180, 45 etc.

The things between %ROTATE% and %ROTATE_END% macros will be rotated by the
specified number of degrees.  Negative values rotate counter-clockwise.  Except
for very minimal receipts with judicious use of line breaks, simple rotation
will probably truncate part of whatever is being rotated.  So, there's an
'extra CSS' variant where you can specify more CSS to fine tune positioning of
the rotated text/objects.

For an example, try this for a hold_slip template:

    Header:
        This item needs to be routed to <b>%route_to%</b>:<br/>
        Barcode: %item_barcode%<br/>
        Title: %item_title%<br/>
        <br/>
        %ROTATE(90,'position: absolute; top: 150px; left: 100px')%
        %hold_for_msg%<br/>
        Barcode: %PATRON_BARCODE%<br/>
        Notify by phone: %notify_by_phone%<br/>
        Notified by text: %notify_by_text%<br/>
        Notified by email: %notify_by_email%<br/>
        %ROTATE_END%
        %ROTATE(760,'position: absolute; top: 150px; left: 50px')%

    Line Item:
        %formatted_note%<br/>

    Footer:
        %ROTATE_END%
        <br/><br/><br/><br/><br/><br/>
        <br/><br/><br/><br/><br/><br/>
        Request date: %request_date%<br/>
        Slip Date: %TODAY_TRIM%<br/>
        Printed by %STAFF_FIRSTNAME% at %SHORTNAME%<br/>
        <br/>

And then try replacing the

        %ROTATE(90,'position: absolute; top: 150px; left: 100px')%

with a mere

        %ROTATE(90)%

and note how the text starts overlapping and becomes truncated.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/xul/staff_client/chrome/content/util/print.js