Determining the width of text drawn with CMD_TEXT

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Post Reply
kiabrin
LCD?
Posts: 3
Joined: Sun Feb 02, 2025 2:59 am
Contact:

Determining the width of text drawn with CMD_TEXT

Post by kiabrin »

Good morning!

I wonder if there is any way to find actual text string width in pixels when it is drawn with CMD_TEXT and ROM font?
I want to draw color highlighted multiline text on my screen, so I need to know where to start next portion of text after some text is drawn.

Ray
Matrix Orbital
Matrix Orbital
Posts: 745
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Re: Determining the width of text drawn with CMD_TEXT

Post by Ray »

While the eve offers no function to quickly get the size of a string, you can download the rom font header from the unit and calculate this your self, in AN_033 - BT81X programming guide see sections:

5.4.1 (Legacy Font Metrics Block) and
5.4.2 (Example to find the width of character)

do note that section 5.4.3 that directly follows and has a handy looking code sample, is NOT applicable to the rom fonts as they use the legacy font metrics block.

Post Reply