/**
   * Sets the line style
   *
   * @param float  $width
   * @param        $cap
   * @param string $join
   * @param array  $dash
   *
   * @return void
   */
  protected function _set_line_style($width, $cap, $join, $dash) {

    if ( count($dash) == 1 )
      $dash[] = $dash[0];

    if ( count($dash) > 1 )
      $this->_pdf->setdashpattern("dasharray={" . implode(" ", $dash) . "}");
    else
      $this->_pdf->setdash(0,0);

    switch ( $join ) {
    case "miter":
      $this->_pdf->setlinejoin(0);
      break;

    case "round":
      $this->_pdf->setlinejoin(1);
      break;

    case "bevel":
      $this->_pdf->setlinejoin(2);
      break;

    default:
      break;
    }

    switch ( $cap ) {
    case "butt":
      $this->_pdf->setlinecap(0);
      break;

    case "round":
      $this->_pdf->setlinecap(1);
      break;

    case "square":
      $this->_pdf->setlinecap(2);
      break;

    default:
      break;
    }

    $this->_pdf->setlinewidth($width);

  }