function text$4(str, x, y, z) {
      var lines, linesCount;
      if(str.indexOf('\n') < 0) {
        lines = [str];
        linesCount = 1;
      } else {
        lines = str.split(/\r?\n/g);
        linesCount = lines.length;
      }
      // handle text line-by-line

      var yOffset = 0;
      if(verticalTextAlignment === PConstants.TOP) {
        yOffset = curTextAscent + curTextDescent;
      } else if(verticalTextAlignment === PConstants.CENTER) {
        yOffset = curTextAscent/2 - (linesCount-1)*curTextLeading/2;
      } else if(verticalTextAlignment === PConstants.BOTTOM) {
        yOffset = -(curTextDescent + (linesCount-1)*curTextLeading);
      }

      for(var i=0;i<linesCount;++i) {
        var line = lines[i];
        drawing.text$line(line, x, y + yOffset, z, horizontalTextAlignment);
        yOffset += curTextLeading;
      }
    }
/**
    * unbounded text function (z is an optional argument)
    */
unbounded text function (z is an optional argument)
unbounded text function ( z is an optional argument )
function text$4(str, x, y, z) {
      var lines, linesCount;
      if(str.indexOf('\n') < 0) {
        lines = [str];
        linesCount = 1;
      } else {
        lines = str.split(/\r?\n/g);
        linesCount = lines.length;
      }
      var yOffset = 0;
      if(verticalTextAlignment === PConstants.TOP) {
        yOffset = curTextAscent + curTextDescent;
      } else if(verticalTextAlignment === PConstants.CENTER) {
        yOffset = curTextAscent/2 - (linesCount-1)*curTextLeading/2;
      } else if(verticalTextAlignment === PConstants.BOTTOM) {
        yOffset = -(curTextDescent + (linesCount-1)*curTextLeading);
      }
      for(var i=0;i<linesCount;++i) {
        var line = lines[i];
        drawing.text$line(line, x, y + yOffset, z, horizontalTextAlignment);
        yOffset += curTextLeading;
      }
    }
function text$4 ( str , x , y , z ) { var lines , linesCount ; if ( str . indexOf ( '\n' ) < 0 ) { lines = [ str ] ; linesCount = 1 ; } else { lines = str . split ( / \r?\n / g ) ; linesCount = lines . length ; } var yOffset = 0 ; if ( verticalTextAlignment === PConstants . TOP ) { yOffset = curTextAscent + curTextDescent ; } else if ( verticalTextAlignment === PConstants . CENTER ) { yOffset = curTextAscent / 2 - ( linesCount - 1 ) * curTextLeading / 2 ; } else if ( verticalTextAlignment === PConstants . BOTTOM ) { yOffset = - ( curTextDescent + ( linesCount - 1 ) * curTextLeading ) ; } for ( var i = 0 ; i < linesCount ; ++ i ) { var line = lines [ i ] ; drawing . text$line ( line , x , y + yOffset , z , horizontalTextAlignment ) ; yOffset += curTextLeading ; } }
unbounded text function (z is an optional argument)
unbounded text function ( z is an optional argument )
// handle text line-by-line