1. currentlinejoin

Returns current line join style.

1.1. Syntax

– currentlinejoin → int

1.2. Stack Effects

Table 1. Before
Level Object

(empty)

Table 2. After
Level Object

0

int (0, 1, or 2)

1.3. Description

currentlinejoin returns the current line join parameter from the graphics state. This is the value most recently set by setlinejoin.

Join styles:

  • 0 = Miter join (sharp corners)

  • 1 = Round join (curved corners)

  • 2 = Bevel join (flattened corners)

1.4. PostScript Level

Level 1 and later

1.5. Examples

Querying current line join
0 setlinejoin
currentlinejoin
% Stack: 0
Saving and restoring line join
currentlinejoin         % Save
/savedJoin exch def

1 setlinejoin           % Change to round
drawRectangle

savedJoin setlinejoin   % Restore
Conditional drawing
currentlinejoin 0 eq {
  % Miter - draw technical diagram
  drawBlueprintStyle
} {
  % Non-miter - draw artistic
  drawArtisticStyle
} ifelse

1.6. Common Use Cases

1.6.1. Join State Preservation

/DrawWithRoundJoins {
  currentlinejoin       % Save
  1 setlinejoin         % Round

  drawShape

  setlinejoin           % Restore
} def

1.6.2. Join-Dependent Rendering

/DrawCorner {
  currentlinejoin
  dup 0 eq {
    % Miter - sharp corner
    drawSharpCorner
  } if
  dup 1 eq {
    % Round - curved corner
    drawRoundCorner
  } if
  2 eq {
    % Bevel - flat corner
    drawFlatCorner
  } if
} def

1.6.3. Style Validation

/EnsureMiterJoin {
  currentlinejoin 0 ne {
    0 setlinejoin
  } if
} def

1.7. Common Pitfalls

Miter Limit Interaction - Miter joins (0) affected by miter limit setting.
0 setlinejoin
currentlinejoin  % Returns 0 (miter)
% But sharp miters may become bevels if
% angle exceeds miter limit
Use Round for Smooth - Round joins (1) produce smoothest appearance.

1.8. Error Conditions

Error Condition

[stackoverflow]

No room on operand stack

1.9. Implementation Notes

  • Very fast query operation

  • No modification to graphics state

  • Returns integer 0, 1, or 2

  • Default value is typically 0 (miter)

  • Miter joins controlled by miter limit

  • Widely supported (Level 1)

1.10. Line Join Styles

Miter (0):    ╱╲
              ╱  ╲

Round (1):    ╱⌢╲
              ╱  ╲

Bevel (2):    ╱─╲
              ╱  ╲

1.11. See Also


Back to top

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