Hi everyone-

I just found this board and have been searching and reading - Great Info!

I'm working with canvas and have some JavaScript that allows user entered text to display in the canvas, above an image (Company Name above a logo). I have figured out how to center the text and wrap it at a certain length, so that is great!
My problem is that when the text is too long and wraps, it drops down a line. This puts the text into the logo, not good. I know I can raise the text to allow for a second line but this puts the text higher than we want if only one line.

Is there a way that, If a second line is required, the text can move "up" instead of "down" to allow for the second line of text?

I'm a neophyte when it comes to JavaScript, So please keep this in mind when helping me out :-).
Below is part of the code I'm working with now. You will notice that I've tried both setting the "y" variable to a fixed size
(var y =45 and to the width of the canvas(var y = canvas.height / 2 but both have the same effect - I thought the canvas height option would do this but it does not:
:
Code:
 var message = 'Your Organization Name';	
      var maxWidth = 380;
      var lineHeight = 25;
       var x = canvas.width / 2;
//      var y = canvas.height / 2;
        var y =45;
...
 //	------------------ text wrap code -----------------------      
        function wrapText(context, text, x, y, maxWidth, lineHeight) {
        var words = text.split(' ');
        var line = '';
        for(var n = 0; n < words.length; n++) {
          var testLine = line + words[n] + ' ';
          var metrics = context.measureText(testLine);
          var testWidth = metrics.width;
          if (testWidth > maxWidth && n > 0) {
            context.fillText(line, x, y);
            line = words[n] + ' ';
            y += lineHeight;
          }
          else {
            line = testLine;
          }
        }
        context.fillText(line, x, y);
      }
...

      wrapText(context, message, x, y, maxWidth, lineHeight);
      
       }
Thank in advance for any help - I've searched and tried everything my limited mind could think of!