Module: DUIM-formatting-internals Synopsis: DUIM formatted output Author: Scott McKay Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND // A bummed version of 'set-sheet-position' that doesn't propagate // geometry cache clearing define function %set-sheet-position (record :: , x :: , y :: ) => () let (old-x, old-y) = box-position(sheet-region(record)); let transform = sheet-transform(record); transform-coordinates!(transform, old-x, old-y); let dx :: = x - old-x; let dy :: = y - old-y; sheet-transform(record) := compose-translation-into!(dx, dy, transform) end function %set-sheet-position; define open generic process-spacing-arg (sheet, spacing, axis, #key form) => (spacing :: false-or()); define method process-spacing-arg (sheet :: , spacing == #f, axis, #key form) => (spacing :: singleton(#f)) ignore(sheet, axis, form); #f end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing :: , axis, #key form) => (spacing :: ) ignore(sheet, axis, form); spacing end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing :: , axis, #key form) => (spacing :: ) ignore(form); let (width, height) = text-size(sheet, spacing); if (axis == #"horizontal") floor(width) else floor(height) end end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing :: , axis, #key form) => (spacing :: ) ignore(form); let (width, height) = text-size(sheet, spacing); if (axis == #"horizontal") floor(width) else floor(height) end end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing :: , axis, #key form) => (spacing :: ) ignore(form); spacing(sheet, axis) end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing :: , axis, #key form) => (spacing :: ) ignore(form); let units = spacing[1]; let spacing = spacing[0]; let display = display(sheet); select (units) #"point" => floor(spacing * display-pixels-per-point(display)); #"pixel" => spacing; #"device" => spacing; #"mm" => if (axis == #"horizontal") spacing * floor/(display-pixel-width(display), display-mm-width(display)) else spacing * floor/(display-pixel-height(display), display-mm-height(display)) end; #"character" => begin let (width, height) = text-size(sheet, ' '); if (axis == #"horizontal") floor(spacing * width) else floor(spacing * height) end; end; #"line" => spacing * sheet-line-height(sheet) + (spacing - 1) * sheet-line-spacing(sheet); end end method process-spacing-arg; define method process-spacing-arg (sheet :: , spacing, axis, #key form) => (spacing :: ) ignore(axis); error("The spacing specification %= to %= was invalid", spacing, form) end method process-spacing-arg;