q5play
    Preparing search index...

    Function textAscent

    • 📘 Calculates and returns the ascent (the distance from the baseline to the top of the highest character) of the current font.

      Parameters

      • str: string

        string to measure

      Returns number

      ascent of the text in pixels

      q5.draw = function () {
      background(0.8);

      textSize(abs(mouseX));
      rect(-90, 90, textWidth('A'), -textAscent());
      text('A', -90, 90);
      };