We continue the study of path command. Take a look of the closed shape, a square.
startshape MyShape path Line { MOVETO {x -0.5 y -0.5} LINETO {x 0.5 y -0.5} LINETO {x 0.5 y 0.5} LINETO {x -0.5 y 0.5} LINETO {x -0.5 y -0.5} CLOSEPOLY {} STROKE {} } rule MyShape { Line {} }
If by any chances, you type the wrong position for the last end point or there is rounding error after a sequence of calculation, you may end of with:
startshape MyShape path Line { MOVETO {x -0.5 y -0.5} LINETO {x 0.5 y -0.5} LINETO {x 0.5 y 0.5} LINETO {x -0.5 y 0.5} LINETO {x -0.45 y -0.45} CLOSEPOLY {} STROKE {} } rule MyShape { Line {} }
Note the CLOSEPOLY command will connect an extra line segment to close the shape if there is a gap between the beginning and the end points. In case we want to get rid of the error, we can use the CLOSEPOLY command with an extra parameter align.
startshape MyShape path Line { MOVETO {x -0.5 y -0.5} LINETO {x 0.5 y -0.5} LINETO {x 0.5 y 0.5} LINETO {x -0.5 y 0.5} LINETO {x -0.45 y -0.45} CLOSEPOLY {p align} STROKE {} } rule MyShape { Line {} }