🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    The hight of character

    Units
    m5paper
    3
    3
    5.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Powersoft
      last edited by

      Hello,

      I use this font, and now I wont to know what is hight of a charchter?

      canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);
      canvas1.createRender(60);
      canvas1.setTextSize(60);

      I use the above commands.
      Any sugestion?

      Cheers,

      Jan

      K 1 Reply Last reply Reply Quote 0
      • K
        ksprayberry @Powersoft
        last edited by

        @powersoft I kind of ran into this the other day. I found a font I liked online, but was not sure how to gauge the height of the font and the placement of the text on the screen. I ended up using trial and error which kind of sucked due to the lengthy compile and upload process.

        1 Reply Last reply Reply Quote 0
        • M
          murraypaul
          last edited by

          This is available in the TFT_eSPI base class to canvas, but is not exposed to us.
          The following seems to work:

          int height = ((TFT_eSPI&)Canvas).fontHeight();
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post