Generic Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## right-margin

Arguments: graphical-stream &optional (stream-units-p t)

Returns the current right margin of a `graphical-stream`, measured from the left edge of the stream. The right-margin is initially the page-width of the stream, except as noted below. (setf right-margin) may be called to set the margin at any time.

If stream-units-p is true, as it is by default, then the margin is measured in pixels. If `nil`, it is measured in space character widths (see space-width).

Margin attributes are provided primarily to allow an application to keep a drawing within arbitrary margins by drawing everything within the coordinates returned by left-margin, top-margin, right-margin, and bottom-margin. Common Graphics also uses them in a few special ways, though, as described below.

When printing text to a graphical-stream while `*print-pretty*` is true, the pretty printer will add newlines to the text so that it fits within the line-length of the stream. The line-length is equal to the left-margin of the stream subtracted from the right-margin. An application that is drawing text to a graphical stream in some other way generally should ensure that the text does not extend past the right-margin of the stream.

For a `text-edit-pane`, the function restore-right-margin will set the right-margin to the interior width of the window minus its special text-edit-margins. This function is called automatically when a `text-edit-pane` is created or resized, which causes the pretty-printer to format text within the visible width of the window. Printing may be done beyond the right margin of a `text-edit-pane`, though, which will either extend its horizontal scroll range as needed if its horizontal scrollbar is enabled (see scrollbars), or otherwise wrap the text to multiple lines.

A `printer` stream's coordinate system has position (0, 0) at the printer-physical-offset of the printer. To allow an application to avoid dealing with this arbitrary offset, Common Graphics sets the margins of a printer stream to the distance from the physical offset to the margins selected by the user in the print job dialog or page setup dialog. This allows the application to maintain the requested paper margins by simply drawing everything within the four margins that were set up automatically. See `*default-printer-left-margin*` for more information.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version