1. rmoveto

Sets the current point relative to the previous point, starting a new subpath.

1.1. Syntax

dx dy rmoveto → -

1.2. Stack Effects

Table 1. Before
Level Object

1

dy (number - vertical displacement)

0

dx (number - horizontal displacement)

Table 2. After
Level Object

(empty)

Stack cleared of operands

1.3. Description

rmoveto (relative moveto) starts a new subpath of the current path in the same manner as moveto. However, the number pair is interpreted as a displacement relative to the current point (x, y) rather than as an absolute coordinate. That is, rmoveto makes (x + dx, y + dy) the new current point, without connecting it to the previous point.

If the current point is undefined because the current path is empty, rmoveto executes the [nocurrentpoint] error.

1.4. PostScript Level

Level 1 and later

1.5. Examples

Basic relative movement
100 100 moveto           % Start at (100, 100)
50 0 rmoveto             % Move to (150, 100)
0 50 rmoveto             % Move to (150, 150)
-50 0 rmoveto            % Move to (100, 150)
0 -50 rmoveto            % Back to (100, 100)
Drawing a square with relative moves
newpath
100 100 moveto           % Start at corner
100 0 rlineto            % Right edge
0 100 rlineto            % Top edge
-100 0 rlineto           % Left edge
closepath
Creating offset subpaths
newpath
100 100 moveto
100 0 rlineto
closepath

50 50 rmoveto            % New subpath offset by (50, 50)
100 0 rlineto
closepath

1.6. Common Use Cases

1.6.1. Relative Path Construction

/drawSquare {
  % Stack: size
  /size exch def
  0 size rlineto
  size 0 rlineto
  0 size neg rlineto
  closepath
} def

100 100 moveto
50 drawSquare

1.6.2. Creating Patterns with Offsets

/drawDot {
  newpath
  0 0 5 0 360 arc
  fill
} def

newpath
10 {
  20 20 rmoveto           % Move to next position
  gsave
  drawDot
  grestore
} repeat

1.6.3. Text Line Spacing

/Helvetica findfont 12 scalefont setfont
100 500 moveto
(First line) show
0 -14 rmoveto             % Move down one line
(Second line) show
0 -14 rmoveto             % Move down another line
(Third line) show

1.7. Common Pitfalls

Requires Current Point - rmoveto requires a current point. Use moveto first to establish one.
newpath
10 10 rmoveto            % Error: nocurrentpoint
Displacement Not Position - The arguments are displacements (dx, dy), not absolute coordinates. Negative values move in the opposite direction.
100 100 moveto
-50 -50 rmoveto          % Moves to (50, 50), not (-50, -50)
Use for Relative Layouts - rmoveto is ideal for creating shapes or text layouts where elements are positioned relative to each other.

1.8. Error Conditions

Error Condition

[limitcheck]

Path becomes too complex for implementation

[nocurrentpoint]

Current path is empty (no current point defined)

[stackunderflow]

Fewer than 2 operands on stack

[typecheck]

Operands are not numbers

1.9. Implementation Notes

  • Displacements are in user space coordinates

  • The transformation by CTM happens after adding displacement to current point

  • Creates a new subpath (breaks any line continuation)

  • More efficient than calculating absolute coordinates manually

  • Negative displacements move in opposite directions

1.10. Performance Considerations

  • Slightly faster than computing absolute coordinates and using moveto

  • Useful for patterns and repeated structures

  • No performance difference from moveto in terms of path complexity

1.11. See Also


Back to top

Copyright © 2025 Ribose. PostScript is a trademark of Adobe. Distributed under the MIT License.